- Timestamp:
- Jan 24, 2022 3:27:29 PM (3 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationCenter.cpp
r93413 r93414 19 19 #include <QApplication> 20 20 #include <QHBoxLayout> 21 #include <QMenu> 21 22 #include <QPainter> 22 23 #include <QPaintEvent> … … 421 422 } 422 423 424 void UINotificationCenter::sltHandleOpenButtonContextMenuRequested(const QPoint &) 425 { 426 /* Create menu: */ 427 QMenu menu(m_pButtonOpen); 428 429 /* Create action: */ 430 QAction action( m_enmAlignment == Qt::AlignTop 431 ? tr("Align Bottom") 432 : tr("Align Top"), 433 m_pButtonOpen); 434 menu.addAction(&action); 435 436 /* Execute menu, check if any (single) action is clicked: */ 437 QAction *pAction = menu.exec(m_pButtonOpen->mapToGlobal(QPoint(m_pButtonOpen->width(), 0))); 438 if (pAction) 439 { 440 const Qt::Alignment enmAlignment = m_enmAlignment == Qt::AlignTop 441 ? Qt::AlignBottom 442 : Qt::AlignTop; 443 gEDataManager->setNotificationCenterAlignment(enmAlignment); 444 } 445 } 446 423 447 void UINotificationCenter::sltHandleOpenTimerTimeout() 424 448 { … … 576 600 m_pButtonOpen->setIcon(UIIconPool::iconSet(":/notification_center_16px.png")); 577 601 m_pButtonOpen->setCheckable(true); 602 m_pButtonOpen->setContextMenuPolicy(Qt::CustomContextMenu); 578 603 connect(m_pButtonOpen, &QIToolButton::toggled, 579 604 this, &UINotificationCenter::sltHandleOpenButtonToggled); 605 connect(m_pButtonOpen, &QIToolButton::customContextMenuRequested, 606 this, &UINotificationCenter::sltHandleOpenButtonContextMenuRequested); 580 607 m_pLayoutButtons->addWidget(m_pButtonOpen); 581 608 } -
trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationCenter.h
r93408 r93414 115 115 /** Removes finished notifications. */ 116 116 void sltHandleRemoveFinishedButtonClicked(); 117 118 /** Invokes open button context menu at specified @a position. */ 119 void sltHandleOpenButtonContextMenuRequested(const QPoint &position); 117 120 118 121 /** Handles open-timer timeout. */
Note:
See TracChangeset
for help on using the changeset viewer.