summaryrefslogtreecommitdiff
path: root/library/menubutton.cpp
Unidiff
Diffstat (limited to 'library/menubutton.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--library/menubutton.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/library/menubutton.cpp b/library/menubutton.cpp
index c34383a..6b1fa2b 100644
--- a/library/menubutton.cpp
+++ b/library/menubutton.cpp
@@ -72,65 +72,65 @@ void MenuButton::init()
72 connect(pop, SIGNAL(activated(int)), this, SLOT(select(int))); 72 connect(pop, SIGNAL(activated(int)), this, SLOT(select(int)));
73 setPopup(pop); 73 setPopup(pop);
74 //setPopupDelay(0); 74 //setPopupDelay(0);
75} 75}
76 76
77/*! 77/*!
78 Removes all items from the button and menu. 78 Removes all items from the button and menu.
79*/ 79*/
80void MenuButton::clear() 80void MenuButton::clear()
81{ 81{
82 delete pop; 82 delete pop;
83 init(); 83 init();
84} 84}
85 85
86/*! 86/*!
87 Inserts string \a items into the menu. The string "--" represents 87 Inserts string \a items into the menu. The string "--" represents
88 a separator. 88 a separator.
89*/ 89*/
90void MenuButton::insertItems( const QStringList& items ) 90void MenuButton::insertItems( const QStringList& items )
91{ 91{
92 QStringList::ConstIterator it=items.begin(); 92 QStringList::ConstIterator it=items.begin();
93 for (; it!=items.end(); ++it) { 93 for (; it!=items.end(); ++it) {
94 if ( (*it) == "--" ) 94 if ( (*it) == "--" )
95 insertSeparator(); 95 insertSeparator();
96 else 96 else
97 insertItem(*it); 97 insertItem(*it);
98 } 98 }
99} 99}
100 100
101/*! 101/*!
102 Inserts an \a icon and \a text into the menu. 102 Inserts an \a icon and \a text into the menu.
103*/ 103*/
104void MenuButton::insertItem( const QIconSet& icon, const QString& text=QString::null ) 104void MenuButton::insertItem( const QIconSet& icon, const QString& text )
105{ 105{
106 pop->insertItem(icon, text, nitems++); 106 pop->insertItem(icon, text, nitems++);
107 if ( nitems==1 ) select(0); 107 if ( nitems==1 ) select(0);
108} 108}
109 109
110/*! 110/*!
111 Inserts \a text into the menu. 111 Inserts \a text into the menu.
112*/ 112*/
113void MenuButton::insertItem( const QString& text ) 113void MenuButton::insertItem( const QString& text )
114{ 114{
115 pop->insertItem(text, nitems++); 115 pop->insertItem(text, nitems++);
116 if ( nitems==1 ) select(0); 116 if ( nitems==1 ) select(0);
117} 117}
118 118
119/*! 119/*!
120 Inserts a visual separator into the menu. 120 Inserts a visual separator into the menu.
121*/ 121*/
122void MenuButton::insertSeparator() 122void MenuButton::insertSeparator()
123{ 123{
124 pop->insertSeparator(); 124 pop->insertSeparator();
125} 125}
126 126
127/*! 127/*!
128 Selects the items with text \a s. 128 Selects the items with text \a s.
129*/ 129*/
130void MenuButton::select(const QString& s) 130void MenuButton::select(const QString& s)
131{ 131{
132 for (int i=0; i<nitems; i++) { 132 for (int i=0; i<nitems; i++) {
133 if ( pop->text(i) == s ) { 133 if ( pop->text(i) == s ) {
134 select(i); 134 select(i);
135 break; 135 break;
136 } 136 }