mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-06-05 21:59:17 +02:00
Finishing of dimension plugin
This commit is contained in:
@ -375,7 +375,31 @@ void PDFViewerMainWindow::loadPlugins()
|
||||
|
||||
menu->addAction(action);
|
||||
toolbarButton->menu()->addAction(action);
|
||||
connect(action, &QAction::triggered, toolbarButton, [action, toolbarButton](){ toolbarButton->setDefaultAction(action); });
|
||||
|
||||
auto onPluginActionTriggered = [toolbarButton, action]()
|
||||
{
|
||||
if (action->isEnabled())
|
||||
{
|
||||
toolbarButton->setDefaultAction(action);
|
||||
}
|
||||
};
|
||||
auto onPluginActionStateChanged = [toolbarButton, action]()
|
||||
{
|
||||
if (!action->isEnabled() && toolbarButton->defaultAction() == action)
|
||||
{
|
||||
for (QAction* action : toolbarButton->menu()->actions())
|
||||
{
|
||||
if (action->isEnabled())
|
||||
{
|
||||
toolbarButton->setDefaultAction(action);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
connect(action, &QAction::triggered, toolbarButton, onPluginActionTriggered);
|
||||
connect(action, &QAction::changed, toolbarButton, onPluginActionStateChanged);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user