summaryrefslogtreecommitdiff
path: root/vcl/qt5/Qt5Menu.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/qt5/Qt5Menu.cxx')
-rw-r--r--vcl/qt5/Qt5Menu.cxx84
1 files changed, 42 insertions, 42 deletions
diff --git a/vcl/qt5/Qt5Menu.cxx b/vcl/qt5/Qt5Menu.cxx
index 98615247035a..f7c2e480118c 100644
--- a/vcl/qt5/Qt5Menu.cxx
+++ b/vcl/qt5/Qt5Menu.cxx
@@ -356,21 +356,21 @@ void Qt5Menu::RemoveItem(unsigned nPos)
{
SolarMutexGuard aGuard;
- if (nPos < maItems.size())
- {
- Qt5MenuItem* pItem = maItems[nPos];
- pItem->mpAction.reset();
- pItem->mpMenu.reset();
+ if (nPos >= maItems.size())
+ return;
- maItems.erase(maItems.begin() + nPos);
+ Qt5MenuItem* pItem = maItems[nPos];
+ pItem->mpAction.reset();
+ pItem->mpMenu.reset();
- // Recalculate action groups if necessary:
- // if separator between two QActionGroups was removed,
- // it may be needed to merge them
- if (nPos > 0)
- {
- ReinitializeActionGroup(nPos - 1);
- }
+ maItems.erase(maItems.begin() + nPos);
+
+ // Recalculate action groups if necessary:
+ // if separator between two QActionGroups was removed,
+ // it may be needed to merge them
+ if (nPos > 0)
+ {
+ ReinitializeActionGroup(nPos - 1);
}
}
@@ -421,26 +421,26 @@ void Qt5Menu::SetFrame(const SalFrame* pFrame)
mpFrame->SetMenu(this);
Qt5MainWindow* pMainWindow = mpFrame->GetTopLevelWindow();
- if (pMainWindow)
+ if (!pMainWindow)
+ return;
+
+ mpQMenuBar = pMainWindow->menuBar();
+ if (mpQMenuBar)
{
- mpQMenuBar = pMainWindow->menuBar();
- if (mpQMenuBar)
+ mpQMenuBar->clear();
+ QPushButton* pButton
+ = static_cast<QPushButton*>(mpQMenuBar->cornerWidget(Qt::TopRightCorner));
+ if (pButton && ((mpCloseButton != pButton) || !maCloseButtonConnection))
{
- mpQMenuBar->clear();
- QPushButton* pButton
- = static_cast<QPushButton*>(mpQMenuBar->cornerWidget(Qt::TopRightCorner));
- if (pButton && ((mpCloseButton != pButton) || !maCloseButtonConnection))
- {
- maCloseButtonConnection
- = connect(pButton, &QPushButton::clicked, this, &Qt5Menu::slotCloseDocument);
- mpCloseButton = pButton;
- }
+ maCloseButtonConnection
+ = connect(pButton, &QPushButton::clicked, this, &Qt5Menu::slotCloseDocument);
+ mpCloseButton = pButton;
}
+ }
- mpQMenu = nullptr;
+ mpQMenu = nullptr;
- DoFullMenuUpdate(mpVCLMenu);
- }
+ DoFullMenuUpdate(mpVCLMenu);
}
void Qt5Menu::DoFullMenuUpdate(Menu* pMenuBar)
@@ -578,21 +578,21 @@ const Qt5Frame* Qt5Menu::GetFrame() const
void Qt5Menu::slotMenuTriggered(Qt5MenuItem* pQItem)
{
- if (pQItem)
- {
- Qt5Menu* pSalMenu = pQItem->mpParentMenu;
- Qt5Menu* pTopLevel = pSalMenu->GetTopLevel();
+ if (!pQItem)
+ return;
- Menu* pMenu = pSalMenu->GetMenu();
- auto mnId = pQItem->mnId;
-
- // HACK to allow HandleMenuCommandEvent to "not-set" the checked button
- // LO expects a signal before an item state change, so reset the check item
- if (pQItem->mpAction->isCheckable()
- && (!pQItem->mpActionGroup || pQItem->mpActionGroup->actions().size() <= 1))
- pQItem->mpAction->setChecked(!pQItem->mpAction->isChecked());
- pTopLevel->GetMenu()->HandleMenuCommandEvent(pMenu, mnId);
- }
+ Qt5Menu* pSalMenu = pQItem->mpParentMenu;
+ Qt5Menu* pTopLevel = pSalMenu->GetTopLevel();
+
+ Menu* pMenu = pSalMenu->GetMenu();
+ auto mnId = pQItem->mnId;
+
+ // HACK to allow HandleMenuCommandEvent to "not-set" the checked button
+ // LO expects a signal before an item state change, so reset the check item
+ if (pQItem->mpAction->isCheckable()
+ && (!pQItem->mpActionGroup || pQItem->mpActionGroup->actions().size() <= 1))
+ pQItem->mpAction->setChecked(!pQItem->mpAction->isChecked());
+ pTopLevel->GetMenu()->HandleMenuCommandEvent(pMenu, mnId);
}
void Qt5Menu::slotMenuAboutToShow(Qt5MenuItem* pQItem)