| Home · All Classes · Main Classes · Deprecated |
00001 /*************************************************************************** 00002 ** 00003 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 00004 ** All rights reserved. 00005 ** Contact: Nokia Corporation (directui@nokia.com) 00006 ** 00007 ** This file is part of libmeegotouch. 00008 ** 00009 ** If you have questions regarding the use of this file, please contact 00010 ** Nokia at directui@nokia.com. 00011 ** 00012 ** This library is free software; you can redistribute it and/or 00013 ** modify it under the terms of the GNU Lesser General Public 00014 ** License version 2.1 as published by the Free Software Foundation 00015 ** and appearing in the file LICENSE.LGPL included in the packaging 00016 ** of this file. 00017 ** 00018 ****************************************************************************/ 00019 00020 #include "maction.h" 00021 #include "maction_p.h" 00022 00023 #include <QApplication> 00024 #include <QEvent> 00025 #include <QActionEvent> 00026 #include <QGraphicsWidget> 00027 00028 MActionPrivate::MActionPrivate() 00029 : location(MAction::EveryLocation), styleAction(false), q_ptr(0) 00030 { 00031 } 00032 00033 MActionPrivate::~MActionPrivate() 00034 { 00035 } 00036 00037 void MActionPrivate::sendDataChanged() 00038 { 00039 Q_Q(MAction); 00040 QActionEvent e(QEvent::ActionChanged, q); 00041 00042 QList<QGraphicsWidget *> gWidgets = q->associatedGraphicsWidgets(); 00043 00044 const int size = gWidgets.size(); 00045 for (int i = 0; i < size; ++i) { 00046 QGraphicsWidget *w = gWidgets.at(i); 00047 QApplication::sendEvent(w, &e); 00048 } 00049 00050 QApplication::sendEvent(q, &e); 00051 00052 emit q->changed(); 00053 } 00054 00055 MAction::MAction(QObject *parent) 00056 : QAction(parent), 00057 d_ptr(new MActionPrivate) 00058 { 00059 Q_D(MAction); 00060 d->q_ptr = this; 00061 } 00062 00063 MAction::MAction(MActionPrivate &dd, QObject *parent) 00064 : QAction(parent), 00065 d_ptr(& dd) 00066 { 00067 Q_D(MAction); 00068 d->q_ptr = this; 00069 } 00070 00071 MAction::MAction(const QString &text, QObject *parent) 00072 : QAction(text, parent), 00073 d_ptr(new MActionPrivate) 00074 { 00075 Q_D(MAction); 00076 d->q_ptr = this; 00077 } 00078 00079 MAction::MAction(const QString &iconID, const QString &text, QObject *parent) 00080 : QAction(text, parent), 00081 d_ptr(new MActionPrivate) 00082 { 00083 Q_D(MAction); 00084 d->iconID = iconID; 00085 d->q_ptr = this; 00086 } 00087 00088 MAction::~MAction() 00089 { 00090 delete d_ptr; 00091 } 00092 00093 QString MAction::iconID() const 00094 { 00095 Q_D(const MAction); 00096 return d->iconID; 00097 } 00098 00099 void MAction::setIconID(const QString &iconID) 00100 { 00101 Q_D(MAction); 00102 if (d->iconID == iconID) 00103 return; 00104 00105 d->iconID = iconID; 00106 d->sendDataChanged(); 00107 } 00108 00109 MAction::Locations MAction::location() const 00110 { 00111 Q_D(const MAction); 00112 return d->location; 00113 } 00114 00115 void MAction::setLocation(MAction::Locations location) 00116 { 00117 Q_D(MAction); 00118 if (d->location == location) 00119 return; 00120 00121 d->location = location; 00122 d->sendDataChanged(); 00123 } 00124 00125 void MAction::setStyleAction(bool styleAction) 00126 { 00127 Q_D(MAction); 00128 if (d->styleAction != styleAction) { 00129 d->styleAction = styleAction; 00130 d->sendDataChanged(); 00131 } 00132 } 00133 00134 bool MAction::isStyleAction() const 00135 { 00136 Q_D(const MAction); 00137 return d->styleAction; 00138 }
| Copyright © 2010 Nokia Corporation | Generated on Thu Nov 4 2010 18:14:19 (PDT) Doxygen 1.7.1 |
MeeGo Touch |