Mercurial > hg > svgui
comparison widgets/SubdividingMenu.h @ 152:6a3f3c13173f
* Add a friendlier setup mechanism to SubdividingMenu, and use it for all the
plugin menus, not just the by-name and by-maker ones
author | Chris Cannam |
---|---|
date | Mon, 25 Sep 2006 12:05:41 +0000 |
parents | 8f51db2434dc |
children | 42118892f428 |
comparison
equal
deleted
inserted
replaced
151:8f51db2434dc | 152:6a3f3c13173f |
---|---|
27 * (e.g. plugins). | 27 * (e.g. plugins). |
28 * | 28 * |
29 * The menu needs to be told, before any of the actions are added, | 29 * The menu needs to be told, before any of the actions are added, |
30 * what the set of entry strings will be, so it can determine a | 30 * what the set of entry strings will be, so it can determine a |
31 * reasonable categorisation. Do this by calling the setEntries() | 31 * reasonable categorisation. Do this by calling the setEntries() |
32 * method. | 32 * method. If it isn't practical to do this in advance, then add the |
33 * entries and call entriesAdded() afterwards instead. | |
33 */ | 34 */ |
34 | 35 |
35 class SubdividingMenu : public QMenu | 36 class SubdividingMenu : public QMenu |
36 { | 37 { |
37 public: | 38 public: |
38 SubdividingMenu(QWidget *parent = 0); | 39 SubdividingMenu(size_t lowerLimit = 0, size_t upperLimit = 0, |
39 SubdividingMenu(const QString &title, QWidget *parent = 0); | 40 QWidget *parent = 0); |
41 SubdividingMenu(const QString &title, size_t lowerLimit = 0, | |
42 size_t upperLimit = 0, QWidget *parent = 0); | |
40 virtual ~SubdividingMenu(); | 43 virtual ~SubdividingMenu(); |
41 | 44 |
42 void setEntries(const std::set<QString> &entries); | 45 void setEntries(const std::set<QString> &entries); |
46 void entriesAdded(); | |
43 | 47 |
44 // Action names and strings passed to addAction and addMenu must | 48 // Action names and strings passed to addAction and addMenu must |
45 // appear in the set previously given to setEntries. If you want | 49 // appear in the set previously given to setEntries. If you want |
46 // to use a different string, use the two-argument method and pass | 50 // to use a different string, use the two-argument method and pass |
47 // the entry string (used to determine which submenu the action | 51 // the entry string (used to determine which submenu the action |
55 virtual QMenu *addMenu(const QString &); | 59 virtual QMenu *addMenu(const QString &); |
56 virtual void addMenu(const QString &entry, QMenu *); | 60 virtual void addMenu(const QString &entry, QMenu *); |
57 | 61 |
58 protected: | 62 protected: |
59 std::map<QString, QMenu *> m_nameToChunkMenuMap; | 63 std::map<QString, QMenu *> m_nameToChunkMenuMap; |
64 | |
65 size_t m_lowerLimit; | |
66 size_t m_upperLimit; | |
67 | |
68 bool m_entriesSet; | |
69 std::map<QString, QObject *> m_pendingEntries; | |
60 }; | 70 }; |
61 | 71 |
62 #endif | 72 #endif |
63 | 73 |