mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-21 23:09:40 +00:00
Initialize toolbar pop menu button on start
In 0aead96461997 it was introduced that the toolbar popup menu buttons are not initialized until they are being used (i.e. pressed at for the first time). As a consequence, these buttons are always enabled on start. Now that we have the sticky button for view and update, I'm now annoyed by this every time I start LyX.
This commit is contained in:
parent
64576f5421
commit
6b8ed2fa1d
@ -166,7 +166,7 @@ public:
|
||||
|
||||
|
||||
MenuButton::MenuButton(GuiToolbar * bar, ToolbarItem const & item, bool const sticky)
|
||||
: QToolButton(bar), bar_(bar), tbitem_(item), initialized_(false)
|
||||
: QToolButton(bar), bar_(bar), tbitem_(item)
|
||||
{
|
||||
setPopupMode(QToolButton::InstantPopup);
|
||||
QString const label = qt_(to_ascii(tbitem_.label_));
|
||||
@ -189,17 +189,12 @@ MenuButton::MenuButton(GuiToolbar * bar, ToolbarItem const & item, bool const st
|
||||
this, SLOT(actionTriggered(QAction *)));
|
||||
connect(bar, SIGNAL(iconSizeChanged(QSize)),
|
||||
this, SLOT(setIconSize(QSize)));
|
||||
initialize();
|
||||
}
|
||||
|
||||
void MenuButton::mousePressEvent(QMouseEvent * e)
|
||||
|
||||
void MenuButton::initialize()
|
||||
{
|
||||
if (initialized_) {
|
||||
QToolButton::mousePressEvent(e);
|
||||
return;
|
||||
}
|
||||
|
||||
initialized_ = true;
|
||||
|
||||
QString const label = qt_(to_ascii(tbitem_.label_));
|
||||
ButtonMenu * m = new ButtonMenu(label, this);
|
||||
m->setWindowTitle(label);
|
||||
@ -217,8 +212,6 @@ void MenuButton::mousePressEvent(QMouseEvent * e)
|
||||
if (!getStatus(it->func_).unknown())
|
||||
m->add(bar_->addItem(*it));
|
||||
setMenu(m);
|
||||
|
||||
QToolButton::mousePressEvent(e);
|
||||
}
|
||||
|
||||
|
||||
|
@ -45,16 +45,14 @@ public:
|
||||
///
|
||||
MenuButton(GuiToolbar * bar, ToolbarItem const & item,
|
||||
bool const sticky = false);
|
||||
///
|
||||
void mousePressEvent(QMouseEvent * e);
|
||||
|
||||
private:
|
||||
///
|
||||
void initialize();
|
||||
///
|
||||
GuiToolbar * bar_;
|
||||
///
|
||||
ToolbarItem const & tbitem_;
|
||||
///
|
||||
bool initialized_;
|
||||
|
||||
private Q_SLOTS:
|
||||
///
|
||||
|
Loading…
x
Reference in New Issue
Block a user