diff options
author | Sergiy Dubovik <sergiy.dubovik@nokia.com> | 2010-09-15 10:14:53 +0300 |
---|---|---|
committer | Sergiy Dubovik <sergiy.dubovik@nokia.com> | 2010-09-17 14:38:12 +0300 |
commit | 53e11765c865294ab58cf514fe2d11420e55961a (patch) | |
tree | 62ed67f7f7d518852adf5a894e068ecb54b142f6 /demos/widgetsgallery | |
parent | d9446738c8786dbc79fb45a3c4ffe45887edd7f0 (diff) |
Changes: Adds a new constructor to MObjectMenu which takes list of actions.
RevBy: Sergiy
Details: For MList long tap we need a possibility to create object menu based on actions and not on widget as it's done now.
Diffstat (limited to 'demos/widgetsgallery')
-rw-r--r-- | demos/widgetsgallery/mlistpage.cpp | 32 | ||||
-rw-r--r-- | demos/widgetsgallery/mlistpage.h | 4 |
2 files changed, 19 insertions, 17 deletions
diff --git a/demos/widgetsgallery/mlistpage.cpp b/demos/widgetsgallery/mlistpage.cpp index e7f182fd..afa715b5 100644 --- a/demos/widgetsgallery/mlistpage.cpp +++ b/demos/widgetsgallery/mlistpage.cpp @@ -64,7 +64,6 @@ MListPage::MListPage() imageLoader(NULL), comboListMode(NULL), objectMenu(NULL), - objectMenuHolder(NULL), actionAdvancedConfiguration(NULL), dialogAdvancedConfiguration(NULL), list(NULL), @@ -345,6 +344,21 @@ void MListPage::createActions() connect(actionAdvancedConfiguration, SIGNAL(triggered()), SLOT(showAdvancedConfigurationDialog())); } +void MListPage::createObjectMenuActions() +{ + //% "Remove" + MAction *action = new MAction(qtTrId("xx_listpage_list_remove"), this); + objectMenuActions.append(action); + connect(action, SIGNAL(triggered()), this, SLOT(removeListItem())); + + //% "Edit" + action = new MAction(qtTrId("xx_listpage_list_edit"), this); + objectMenuActions.append(action); + connect(action, SIGNAL(triggered()), this, SLOT(editListItem())); + + objectMenu = new MObjectMenu(objectMenuActions); +} + void MListPage::scrollToBottom() { list->scrollTo(model->index(model->rowCount() - 1, 0), MList::EnsureVisibleHint); @@ -646,6 +660,7 @@ void MListPage::createContent() { MApplicationPage::createContent(); createActions(); + createObjectMenuActions(); MTheme::addPixmapDirectory(QDir(CONTACTS_DIR).canonicalPath()); QGraphicsWidget *panel = centralWidget(); @@ -653,21 +668,6 @@ void MListPage::createContent() panel->setLayout(layout); list = new MList(panel); - objectMenuHolder = new MWidget(panel); - - objectMenu = new MObjectMenu(objectMenuHolder); - - //% "Remove" - MAction *action = new MAction(qtTrId("xx_listpage_list_remove"), objectMenuHolder); - action->setLocation(MAction::ObjectMenuLocation); - objectMenuHolder->addAction(action); - connect(action, SIGNAL(triggered()), this, SLOT(removeListItem())); - - //% "Edit" - action = new MAction(qtTrId("xx_listpage_list_edit"), objectMenuHolder); - action->setLocation(MAction::ObjectMenuLocation); - objectMenuHolder->addAction(action); - connect(action, SIGNAL(triggered()), this, SLOT(editListItem())); setPlainListModel(); diff --git a/demos/widgetsgallery/mlistpage.h b/demos/widgetsgallery/mlistpage.h index c59abfb1..b8ac422a 100644 --- a/demos/widgetsgallery/mlistpage.h +++ b/demos/widgetsgallery/mlistpage.h @@ -64,6 +64,7 @@ public: virtual void createContent(); void createActions(); + void createObjectMenuActions(); public slots: void loadPicturesInVisibleItems(); @@ -109,8 +110,9 @@ private: PhoneBookImageLoader *imageLoader; MComboBox *comboListMode; + MObjectMenu *objectMenu; - MWidget *objectMenuHolder; + QList<MAction *> objectMenuActions; MAction *actionAdvancedConfiguration; QPointer<MDialog> dialogAdvancedConfiguration; |