Changeset View
Changeset View
Standalone View
Standalone View
applets/appmenu/lib/appmenuapplet.cpp
Show First 20 Lines • Show All 152 Lines • ▼ Show 20 Line(s) | 147 | } else if (view() == FullView) { | |||
---|---|---|---|---|---|
153 | } | 153 | } | ||
154 | } | 154 | } | ||
155 | 155 | | |||
156 | return menu; | 156 | return menu; | ||
157 | } | 157 | } | ||
158 | 158 | | |||
159 | void AppMenuApplet::onMenuAboutToHide() | 159 | void AppMenuApplet::onMenuAboutToHide() | ||
160 | { | 160 | { | ||
161 | m_model->setProperty("menuOpen", false); | ||||
161 | setCurrentIndex(-1); | 162 | setCurrentIndex(-1); | ||
162 | } | 163 | } | ||
163 | 164 | | |||
164 | void AppMenuApplet::trigger(QQuickItem *ctx, int idx) | 165 | void AppMenuApplet::trigger(QQuickItem *ctx, int idx) | ||
165 | { | 166 | { | ||
166 | if (m_currentIndex == idx) { | 167 | if (m_currentIndex == idx) { | ||
167 | return; | 168 | return; | ||
168 | } | 169 | } | ||
▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Line(s) | 214 | if (view() == FullView) { | |||
216 | if (oldMenu && oldMenu != actionMenu) { | 217 | if (oldMenu && oldMenu != actionMenu) { | ||
217 | //don't initialize the currentIndex when another menu is already shown | 218 | //don't initialize the currentIndex when another menu is already shown | ||
218 | disconnect(oldMenu, &QMenu::aboutToHide, this, &AppMenuApplet::onMenuAboutToHide); | 219 | disconnect(oldMenu, &QMenu::aboutToHide, this, &AppMenuApplet::onMenuAboutToHide); | ||
219 | oldMenu->hide(); | 220 | oldMenu->hide(); | ||
220 | } | 221 | } | ||
221 | } | 222 | } | ||
222 | 223 | | |||
223 | actionMenu->popup(pos); | 224 | actionMenu->popup(pos); | ||
225 | m_model->setProperty("menuOpen", true); | ||||
224 | 226 | | |||
225 | setCurrentIndex(idx); | 227 | setCurrentIndex(idx); | ||
226 | 228 | | |||
227 | // FIXME TODO connect only once | 229 | // FIXME TODO connect only once | ||
228 | connect(actionMenu, &QMenu::aboutToHide, this, &AppMenuApplet::onMenuAboutToHide, Qt::UniqueConnection); | 230 | connect(actionMenu, &QMenu::aboutToHide, this, &AppMenuApplet::onMenuAboutToHide, Qt::UniqueConnection); | ||
229 | } else { // is it just an action without a menu? | 231 | } else { // is it just an action without a menu? | ||
230 | const QVariant data = m_model->index(idx, 0).data(AppMenuModel::ActionRole); | 232 | const QVariant data = m_model->index(idx, 0).data(AppMenuModel::ActionRole); | ||
231 | QAction *action = static_cast<QAction *>(data.value<void *>()); | 233 | QAction *action = static_cast<QAction *>(data.value<void *>()); | ||
▲ Show 20 Lines • Show All 63 Lines • Show Last 20 Lines |