2018-05-08 16:05:59 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*/
|
|
|
|
|
2018-06-01 15:28:26 +02:00
|
|
|
#include <Qt5Frame.hxx>
|
2018-08-09 17:14:14 +02:00
|
|
|
#include <Qt5MainWindow.hxx>
|
2018-09-05 01:37:28 +02:00
|
|
|
#include <Qt5Bitmap.hxx>
|
2018-11-22 12:55:06 +03:00
|
|
|
#include <Qt5Tools.hxx>
|
2018-06-01 15:28:26 +02:00
|
|
|
#include <Qt5Menu.hxx>
|
2018-05-24 15:04:02 +02:00
|
|
|
#include <Qt5Menu.moc>
|
2018-05-08 16:05:59 +02:00
|
|
|
|
2018-05-15 16:29:15 +02:00
|
|
|
#include <QtWidgets/QtWidgets>
|
|
|
|
|
2018-05-09 14:34:24 +02:00
|
|
|
#include <vcl/svapp.hxx>
|
2018-07-28 15:57:23 +02:00
|
|
|
#include <sal/log.hxx>
|
2018-11-22 12:55:06 +03:00
|
|
|
#include <vcl/pngwrite.hxx>
|
|
|
|
#include <tools/stream.hxx>
|
2018-05-09 14:34:24 +02:00
|
|
|
|
2018-05-31 12:14:55 +02:00
|
|
|
Qt5Menu::Qt5Menu(bool bMenuBar)
|
|
|
|
: mpVCLMenu(nullptr)
|
|
|
|
, mpParentSalMenu(nullptr)
|
|
|
|
, mpFrame(nullptr)
|
|
|
|
, mbMenuBar(bMenuBar)
|
2018-11-22 12:27:26 +03:00
|
|
|
, mpQMenuBar(nullptr)
|
|
|
|
, mpQMenu(nullptr)
|
|
|
|
, mpQActionGroup(nullptr)
|
2018-05-08 16:05:59 +02:00
|
|
|
{
|
2018-11-01 13:57:56 +01:00
|
|
|
connect(this, &Qt5Menu::setFrameSignal, this, &Qt5Menu::SetFrame, Qt::BlockingQueuedConnection);
|
2018-05-08 16:05:59 +02:00
|
|
|
}
|
|
|
|
|
2018-05-31 12:14:55 +02:00
|
|
|
Qt5Menu::~Qt5Menu() { maItems.clear(); }
|
2018-05-08 16:05:59 +02:00
|
|
|
|
2018-08-10 15:14:07 +02:00
|
|
|
bool Qt5Menu::VisibleMenuBar() { return true; }
|
2018-05-08 16:05:59 +02:00
|
|
|
|
2018-11-22 12:55:06 +03:00
|
|
|
QMenu* Qt5Menu::InsertMenuItem(Qt5MenuItem* pSalMenuItem, unsigned nPos)
|
2018-11-22 12:27:26 +03:00
|
|
|
{
|
|
|
|
QMenu* pQMenu = mpQMenu;
|
|
|
|
sal_uInt16 nId = pSalMenuItem->mnId;
|
|
|
|
OUString aText = mpVCLMenu->GetItemText(nId);
|
|
|
|
NativeItemText(aText);
|
|
|
|
vcl::KeyCode nAccelKey = mpVCLMenu->GetAccelKey(nId);
|
|
|
|
bool bChecked = mpVCLMenu->IsItemChecked(nId);
|
|
|
|
MenuItemBits itemBits = mpVCLMenu->GetItemBits(nId);
|
|
|
|
|
2018-11-22 12:55:06 +03:00
|
|
|
if (mbMenuBar)
|
|
|
|
{
|
2018-11-22 12:27:26 +03:00
|
|
|
// top-level menu
|
2018-11-22 12:55:06 +03:00
|
|
|
if (mpQMenuBar)
|
|
|
|
{
|
|
|
|
if ((nPos != MENU_APPEND)
|
|
|
|
&& (static_cast<size_t>(nPos) < static_cast<size_t>(mpQMenuBar->actions().size())))
|
|
|
|
{
|
|
|
|
pQMenu = new QMenu(toQString(aText), mpQMenuBar);
|
|
|
|
mpQMenuBar->insertMenu(mpQMenuBar->actions()[nPos], pQMenu);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pQMenu = mpQMenuBar->addMenu(toQString(aText));
|
|
|
|
}
|
|
|
|
|
|
|
|
connect(pQMenu, &QMenu::aboutToShow, this,
|
|
|
|
[pSalMenuItem] { slotMenuAboutToShow(pSalMenuItem); });
|
|
|
|
connect(pQMenu, &QMenu::aboutToHide, this,
|
|
|
|
[pSalMenuItem] { slotMenuAboutToHide(pSalMenuItem); });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (pQMenu)
|
2018-11-22 12:27:26 +03:00
|
|
|
{
|
|
|
|
if (pSalMenuItem->mpSubMenu)
|
|
|
|
{
|
|
|
|
// submenu
|
|
|
|
pQMenu = pQMenu->addMenu(toQString(aText));
|
|
|
|
mpQActionGroup = new QActionGroup(pQMenu);
|
2018-11-22 12:55:06 +03:00
|
|
|
|
|
|
|
connect(pQMenu, &QMenu::aboutToShow, this,
|
|
|
|
[pSalMenuItem] { slotMenuAboutToShow(pSalMenuItem); });
|
|
|
|
connect(pQMenu, &QMenu::aboutToHide, this,
|
|
|
|
[pSalMenuItem] { slotMenuAboutToHide(pSalMenuItem); });
|
2018-11-22 12:27:26 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-11-22 12:55:06 +03:00
|
|
|
delete pSalMenuItem->mpAction;
|
|
|
|
|
2018-11-22 12:27:26 +03:00
|
|
|
if (pSalMenuItem->mnType == MenuItemType::SEPARATOR)
|
2018-11-22 12:55:06 +03:00
|
|
|
{
|
|
|
|
if ((nPos != MENU_APPEND)
|
|
|
|
&& (static_cast<size_t>(nPos) < static_cast<size_t>(pQMenu->actions().size())))
|
|
|
|
{
|
|
|
|
pSalMenuItem->mpAction = pQMenu->insertSeparator(pQMenu->actions()[nPos]);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pSalMenuItem->mpAction = pQMenu->addSeparator();
|
|
|
|
}
|
|
|
|
}
|
2018-11-22 12:27:26 +03:00
|
|
|
else
|
|
|
|
{
|
|
|
|
// leaf menu
|
2018-11-22 12:55:06 +03:00
|
|
|
QAction* pAction = nullptr;
|
|
|
|
|
|
|
|
if ((nPos != MENU_APPEND)
|
|
|
|
&& (static_cast<size_t>(nPos) < static_cast<size_t>(pQMenu->actions().size())))
|
|
|
|
{
|
|
|
|
pAction = new QAction(toQString(aText), pQMenu);
|
|
|
|
pQMenu->insertAction(pQMenu->actions()[nPos], pAction);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pAction = pQMenu->addAction(toQString(aText));
|
|
|
|
}
|
|
|
|
|
2018-11-22 12:27:26 +03:00
|
|
|
pSalMenuItem->mpAction = pAction;
|
|
|
|
pAction->setShortcut(toQString(nAccelKey.GetName(GetFrame()->GetWindow())));
|
|
|
|
|
|
|
|
if (itemBits & MenuItemBits::CHECKABLE)
|
|
|
|
{
|
|
|
|
pAction->setCheckable(true);
|
|
|
|
pAction->setChecked(bChecked);
|
|
|
|
}
|
|
|
|
else if (itemBits & MenuItemBits::RADIOCHECK)
|
|
|
|
{
|
|
|
|
pAction->setCheckable(true);
|
|
|
|
if (!mpQActionGroup)
|
|
|
|
{
|
|
|
|
mpQActionGroup = new QActionGroup(pQMenu);
|
|
|
|
mpQActionGroup->setExclusive(true);
|
|
|
|
}
|
2018-11-22 12:55:06 +03:00
|
|
|
// NOTE: QActionGroup support may need improvement
|
|
|
|
// if menu item is added not to the end of menu,
|
|
|
|
// it may be needed to add new item to QActionGroup different from last created one for this menu
|
2018-11-22 12:27:26 +03:00
|
|
|
mpQActionGroup->addAction(pAction);
|
|
|
|
pAction->setChecked(bChecked);
|
|
|
|
}
|
|
|
|
|
|
|
|
pAction->setEnabled(pSalMenuItem->mbEnabled);
|
|
|
|
pAction->setVisible(pSalMenuItem->mbVisible);
|
|
|
|
|
|
|
|
connect(pAction, &QAction::triggered, this,
|
|
|
|
[pSalMenuItem] { slotMenuTriggered(pSalMenuItem); });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return pQMenu;
|
|
|
|
}
|
|
|
|
|
2018-05-31 12:14:55 +02:00
|
|
|
void Qt5Menu::InsertItem(SalMenuItem* pSalMenuItem, unsigned nPos)
|
2018-05-08 16:05:59 +02:00
|
|
|
{
|
2018-05-09 14:34:24 +02:00
|
|
|
SolarMutexGuard aGuard;
|
2018-05-31 12:14:55 +02:00
|
|
|
Qt5MenuItem* pItem = static_cast<Qt5MenuItem*>(pSalMenuItem);
|
2018-05-09 14:34:24 +02:00
|
|
|
|
2018-05-31 12:14:55 +02:00
|
|
|
if (nPos == MENU_APPEND)
|
|
|
|
maItems.push_back(pItem);
|
2018-05-09 14:34:24 +02:00
|
|
|
else
|
2018-05-31 12:14:55 +02:00
|
|
|
maItems.insert(maItems.begin() + nPos, pItem);
|
2018-05-09 14:34:24 +02:00
|
|
|
|
|
|
|
pItem->mpParentMenu = this;
|
2018-11-22 12:55:06 +03:00
|
|
|
|
|
|
|
InsertMenuItem(pItem, nPos);
|
2018-05-08 16:05:59 +02:00
|
|
|
}
|
|
|
|
|
2018-05-31 12:14:55 +02:00
|
|
|
void Qt5Menu::RemoveItem(unsigned nPos)
|
2018-05-08 16:05:59 +02:00
|
|
|
{
|
2018-05-09 14:34:24 +02:00
|
|
|
SolarMutexGuard aGuard;
|
2018-05-31 12:14:55 +02:00
|
|
|
maItems.erase(maItems.begin() + nPos);
|
2018-05-08 16:05:59 +02:00
|
|
|
}
|
|
|
|
|
2018-06-01 15:28:26 +02:00
|
|
|
void Qt5Menu::SetSubMenu(SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsigned)
|
2018-05-08 16:05:59 +02:00
|
|
|
{
|
2018-05-23 10:51:30 +02:00
|
|
|
SolarMutexGuard aGuard;
|
2018-05-31 12:14:55 +02:00
|
|
|
Qt5MenuItem* pItem = static_cast<Qt5MenuItem*>(pSalMenuItem);
|
|
|
|
Qt5Menu* pQSubMenu = static_cast<Qt5Menu*>(pSubMenu);
|
2018-05-23 10:51:30 +02:00
|
|
|
|
2018-05-31 12:14:55 +02:00
|
|
|
if (pQSubMenu == nullptr)
|
2018-05-23 10:51:30 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
pQSubMenu->mpParentSalMenu = this;
|
|
|
|
pItem->mpSubMenu = pQSubMenu;
|
2018-05-08 16:05:59 +02:00
|
|
|
}
|
|
|
|
|
2018-05-31 12:14:55 +02:00
|
|
|
void Qt5Menu::SetFrame(const SalFrame* pFrame)
|
2018-05-08 16:05:59 +02:00
|
|
|
{
|
2018-11-01 13:57:56 +01:00
|
|
|
if (qApp->thread() != QThread::currentThread())
|
|
|
|
{
|
|
|
|
SolarMutexReleaser aReleaser;
|
|
|
|
return Q_EMIT setFrameSignal(pFrame);
|
|
|
|
}
|
|
|
|
|
2018-05-15 16:29:15 +02:00
|
|
|
SolarMutexGuard aGuard;
|
|
|
|
assert(mbMenuBar);
|
2018-05-31 12:14:55 +02:00
|
|
|
mpFrame = const_cast<Qt5Frame*>(static_cast<const Qt5Frame*>(pFrame));
|
2018-05-15 16:29:15 +02:00
|
|
|
|
2018-05-31 12:14:55 +02:00
|
|
|
mpFrame->SetMenu(this);
|
2018-05-15 16:29:15 +02:00
|
|
|
|
2018-08-09 17:14:14 +02:00
|
|
|
Qt5MainWindow* pMainWindow = mpFrame->GetTopLevelWindow();
|
2018-05-31 12:14:55 +02:00
|
|
|
if (pMainWindow)
|
2018-11-01 13:57:56 +01:00
|
|
|
{
|
2018-05-15 16:29:15 +02:00
|
|
|
mpQMenuBar = pMainWindow->menuBar();
|
|
|
|
|
2018-11-01 13:57:56 +01:00
|
|
|
DoFullMenuUpdate(mpVCLMenu);
|
|
|
|
}
|
2018-05-15 16:29:15 +02:00
|
|
|
}
|
|
|
|
|
2018-05-31 12:14:55 +02:00
|
|
|
void Qt5Menu::DoFullMenuUpdate(Menu* pMenuBar, QMenu* pParentMenu)
|
2018-05-16 11:37:09 +02:00
|
|
|
{
|
2018-11-22 12:27:26 +03:00
|
|
|
mpQMenu = pParentMenu;
|
2018-05-16 11:37:09 +02:00
|
|
|
|
2018-05-31 12:14:55 +02:00
|
|
|
if (mbMenuBar && mpQMenuBar)
|
2018-05-17 16:48:53 +02:00
|
|
|
mpQMenuBar->clear();
|
2018-11-22 12:27:26 +03:00
|
|
|
mpQActionGroup = nullptr;
|
2018-05-17 16:48:53 +02:00
|
|
|
|
2018-05-31 12:14:55 +02:00
|
|
|
for (sal_Int32 nItem = 0; nItem < static_cast<sal_Int32>(GetItemCount()); nItem++)
|
2018-05-16 11:37:09 +02:00
|
|
|
{
|
2018-05-31 12:14:55 +02:00
|
|
|
Qt5MenuItem* pSalMenuItem = GetItemAtPos(nItem);
|
2018-11-22 12:55:06 +03:00
|
|
|
QMenu* pQMenu = InsertMenuItem(pSalMenuItem, MENU_APPEND);
|
2018-05-23 10:51:30 +02:00
|
|
|
|
2018-05-31 12:14:55 +02:00
|
|
|
if (pSalMenuItem->mpSubMenu != nullptr)
|
2018-05-16 11:37:09 +02:00
|
|
|
{
|
2018-05-23 10:51:30 +02:00
|
|
|
pMenuBar->HandleMenuActivateEvent(pSalMenuItem->mpSubMenu->GetMenu());
|
2018-05-31 12:14:55 +02:00
|
|
|
pSalMenuItem->mpSubMenu->DoFullMenuUpdate(pMenuBar, pQMenu);
|
2018-05-23 10:51:30 +02:00
|
|
|
pMenuBar->HandleMenuDeActivateEvent(pSalMenuItem->mpSubMenu->GetMenu());
|
2018-05-16 11:37:09 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-09-05 01:37:28 +02:00
|
|
|
void Qt5Menu::ShowItem(unsigned nPos, bool bShow)
|
|
|
|
{
|
|
|
|
if (nPos < maItems.size())
|
|
|
|
{
|
|
|
|
Qt5MenuItem* pSalMenuItem = GetItemAtPos(nPos);
|
|
|
|
if (pSalMenuItem->mpAction)
|
|
|
|
pSalMenuItem->mpAction->setVisible(bShow);
|
|
|
|
pSalMenuItem->mbVisible = bShow;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Qt5Menu::CheckItem(unsigned nPos, bool bChecked)
|
|
|
|
{
|
|
|
|
if (nPos < maItems.size())
|
|
|
|
{
|
|
|
|
Qt5MenuItem* pSalMenuItem = GetItemAtPos(nPos);
|
|
|
|
if (pSalMenuItem->mpAction)
|
|
|
|
pSalMenuItem->mpAction->setChecked(bChecked);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Qt5Menu::EnableItem(unsigned nPos, bool bEnable)
|
|
|
|
{
|
|
|
|
if (nPos < maItems.size())
|
|
|
|
{
|
|
|
|
Qt5MenuItem* pSalMenuItem = GetItemAtPos(nPos);
|
|
|
|
if (pSalMenuItem->mpAction)
|
|
|
|
pSalMenuItem->mpAction->setEnabled(bEnable);
|
|
|
|
pSalMenuItem->mbEnabled = bEnable;
|
|
|
|
}
|
|
|
|
}
|
2018-05-08 16:05:59 +02:00
|
|
|
|
2018-10-23 12:06:00 +02:00
|
|
|
void Qt5Menu::SetItemText(unsigned, SalMenuItem* pItem, const OUString& rText)
|
2018-09-05 01:37:28 +02:00
|
|
|
{
|
|
|
|
Qt5MenuItem* pSalMenuItem = static_cast<Qt5MenuItem*>(pItem);
|
|
|
|
if (pSalMenuItem->mpAction)
|
|
|
|
pSalMenuItem->mpAction->setText(toQString(rText));
|
|
|
|
}
|
2018-05-08 16:05:59 +02:00
|
|
|
|
2018-09-05 01:37:28 +02:00
|
|
|
void Qt5Menu::SetItemImage(unsigned, SalMenuItem* pItem, const Image& rImage)
|
|
|
|
{
|
2018-11-22 12:55:06 +03:00
|
|
|
if (!rImage)
|
2018-09-05 01:37:28 +02:00
|
|
|
return;
|
2018-05-08 16:05:59 +02:00
|
|
|
|
2018-09-05 01:37:28 +02:00
|
|
|
Qt5MenuItem* pSalMenuItem = static_cast<Qt5MenuItem*>(pItem);
|
|
|
|
if (pSalMenuItem->mpAction)
|
2018-11-22 12:55:06 +03:00
|
|
|
{
|
|
|
|
SvMemoryStream aMemStm;
|
|
|
|
vcl::PNGWriter aWriter(rImage.GetBitmapEx());
|
|
|
|
aWriter.Write(aMemStm);
|
|
|
|
|
|
|
|
QImage aImage;
|
|
|
|
|
|
|
|
if (aImage.loadFromData(static_cast<const uchar*>(aMemStm.GetData()), aMemStm.TellEnd()))
|
|
|
|
{
|
|
|
|
pSalMenuItem->mpAction->setIcon(QPixmap::fromImage(aImage));
|
|
|
|
}
|
|
|
|
}
|
2018-09-05 01:37:28 +02:00
|
|
|
}
|
2018-05-08 16:05:59 +02:00
|
|
|
|
2018-09-05 01:37:28 +02:00
|
|
|
void Qt5Menu::SetAccelerator(unsigned, SalMenuItem* pItem, const vcl::KeyCode&,
|
|
|
|
const OUString& rText)
|
|
|
|
{
|
|
|
|
Qt5MenuItem* pSalMenuItem = static_cast<Qt5MenuItem*>(pItem);
|
|
|
|
if (pSalMenuItem->mpAction)
|
|
|
|
pSalMenuItem->mpAction->setShortcut(
|
|
|
|
QKeySequence(toQString(rText), QKeySequence::PortableText));
|
|
|
|
}
|
2018-05-08 16:05:59 +02:00
|
|
|
|
2018-06-01 15:28:26 +02:00
|
|
|
void Qt5Menu::GetSystemMenuData(SystemMenuData*) {}
|
2018-05-08 16:05:59 +02:00
|
|
|
|
2018-05-25 16:04:24 +02:00
|
|
|
Qt5Menu* Qt5Menu::GetTopLevel()
|
|
|
|
{
|
2018-05-31 12:14:55 +02:00
|
|
|
Qt5Menu* pMenu = this;
|
2018-05-25 16:04:24 +02:00
|
|
|
while (pMenu->mpParentSalMenu)
|
|
|
|
pMenu = pMenu->mpParentSalMenu;
|
|
|
|
return pMenu;
|
|
|
|
}
|
|
|
|
|
2018-05-23 17:39:44 +02:00
|
|
|
const Qt5Frame* Qt5Menu::GetFrame() const
|
|
|
|
{
|
|
|
|
SolarMutexGuard aGuard;
|
|
|
|
const Qt5Menu* pMenu = this;
|
2018-05-31 12:14:55 +02:00
|
|
|
while (pMenu && !pMenu->mpFrame)
|
2018-05-23 17:39:44 +02:00
|
|
|
pMenu = pMenu->mpParentSalMenu;
|
|
|
|
return pMenu ? pMenu->mpFrame : nullptr;
|
|
|
|
}
|
|
|
|
|
2018-10-22 14:30:20 +02:00
|
|
|
void Qt5Menu::slotMenuTriggered(Qt5MenuItem* pQItem)
|
2018-05-24 15:04:02 +02:00
|
|
|
{
|
2018-05-31 12:14:55 +02:00
|
|
|
if (pQItem)
|
2018-05-25 16:04:24 +02:00
|
|
|
{
|
|
|
|
Qt5Menu* pSalMenu = pQItem->mpParentMenu;
|
|
|
|
Qt5Menu* pTopLevel = pSalMenu->GetTopLevel();
|
2018-10-22 14:30:20 +02:00
|
|
|
|
2018-11-22 12:55:06 +03:00
|
|
|
Menu* pMenu = pSalMenu->GetMenu();
|
|
|
|
auto mnId = pQItem->mnId;
|
|
|
|
|
|
|
|
pTopLevel->GetMenu()->HandleMenuCommandEvent(pMenu, mnId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Qt5Menu::slotMenuAboutToShow(Qt5MenuItem* pQItem)
|
|
|
|
{
|
|
|
|
if (pQItem)
|
|
|
|
{
|
|
|
|
Qt5Menu* pSalMenu = pQItem->mpSubMenu;
|
|
|
|
Qt5Menu* pTopLevel = pSalMenu->GetTopLevel();
|
|
|
|
|
|
|
|
Menu* pMenu = pSalMenu->GetMenu();
|
|
|
|
|
|
|
|
// following function may update the menu
|
|
|
|
pTopLevel->GetMenu()->HandleMenuActivateEvent(pMenu);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Qt5Menu::slotMenuAboutToHide(Qt5MenuItem* pQItem)
|
|
|
|
{
|
|
|
|
if (pQItem)
|
|
|
|
{
|
|
|
|
Qt5Menu* pSalMenu = pQItem->mpSubMenu;
|
|
|
|
Qt5Menu* pTopLevel = pSalMenu->GetTopLevel();
|
|
|
|
|
|
|
|
Menu* pMenu = pSalMenu->GetMenu();
|
|
|
|
|
|
|
|
pTopLevel->GetMenu()->HandleMenuDeActivateEvent(pMenu);
|
2018-05-25 16:04:24 +02:00
|
|
|
}
|
2018-05-24 15:04:02 +02:00
|
|
|
}
|
|
|
|
|
2018-10-26 23:09:24 +02:00
|
|
|
void Qt5Menu::NativeItemText(OUString& rItemText)
|
|
|
|
{
|
|
|
|
// preserve literal '&'s in menu texts
|
|
|
|
rItemText = rItemText.replaceAll("&", "&&");
|
|
|
|
|
|
|
|
rItemText = rItemText.replace('~', '&');
|
|
|
|
}
|
2018-05-08 16:05:59 +02:00
|
|
|
|
2018-05-31 12:14:55 +02:00
|
|
|
Qt5MenuItem::Qt5MenuItem(const SalItemParams* pItemData)
|
2018-09-05 01:37:28 +02:00
|
|
|
: mpParentMenu(nullptr)
|
2018-05-31 12:14:55 +02:00
|
|
|
, mpSubMenu(nullptr)
|
2018-09-05 01:37:28 +02:00
|
|
|
, mpAction(nullptr)
|
|
|
|
, mnId(pItemData->nId)
|
|
|
|
, mnType(pItemData->eType)
|
|
|
|
, mbVisible(true)
|
|
|
|
, mbEnabled(true)
|
2018-05-08 16:05:59 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2018-11-22 12:55:06 +03:00
|
|
|
Qt5MenuItem::~Qt5MenuItem() { delete mpAction; }
|
|
|
|
|
2018-05-08 16:05:59 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|