feat: add Widebar::InsertWidgetBefore method

Signed-off-by: leo78913 <leo3758@riseup.net>
This commit is contained in:
leo78913 2022-12-30 21:06:14 -03:00
parent b9df10c8bd
commit 3da1d6a464
2 changed files with 11 additions and 0 deletions

View File

@ -111,6 +111,16 @@ void WideBar::insertActionAfter(QAction* after, QAction* action)
m_menu_state = MenuState::Dirty; m_menu_state = MenuState::Dirty;
} }
void WideBar::insertWidgetBefore(QAction* before, QWidget* widget)
{
auto iter = getMatching(before);
if (iter == m_entries.end())
return;
BarEntry entry;
entry.bar_action = insertWidget(iter->bar_action, widget);
}
void WideBar::insertSpacer(QAction* action) void WideBar::insertSpacer(QAction* action)
{ {
auto iter = getMatching(action); auto iter = getMatching(action);

View File

@ -22,6 +22,7 @@ class WideBar : public QToolBar {
void insertSeparator(QAction* before); void insertSeparator(QAction* before);
void insertActionBefore(QAction* before, QAction* action); void insertActionBefore(QAction* before, QAction* action);
void insertActionAfter(QAction* after, QAction* action); void insertActionAfter(QAction* after, QAction* action);
void insertWidgetBefore(QAction* before, QWidget* widget);
QMenu* createContextMenu(QWidget* parent = nullptr, const QString& title = QString()); QMenu* createContextMenu(QWidget* parent = nullptr, const QString& title = QString());
void showVisibilityMenu(const QPoint&); void showVisibilityMenu(const QPoint&);