Skip to content

Commit

Permalink
fix: item menu may be empty due to error
Browse files Browse the repository at this point in the history
Parsing item context menu may fail, always check context menu in
mousePressEvent.

Log: fix item menu may be empty due to error
  • Loading branch information
asterwyx authored and tsic404 committed Jan 10, 2024
1 parent 01e2377 commit a222173
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions frame/window/quickpluginwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -829,8 +829,9 @@ void QuickDockItem::mousePressEvent(QMouseEvent *event)
if (event->button() != Qt::RightButton)
return QWidget::mousePressEvent(event);

static std::once_flag contextMenuInitialized;
std::call_once(contextMenuInitialized, &QuickDockItem::updateContextMenu, this);
if (m_contextMenu->actions().isEmpty()) {
updateContextMenu();
}

if (!m_contextMenu->actions().isEmpty()) {
m_contextMenu->exec(QCursor::pos());
Expand Down

0 comments on commit a222173

Please sign in to comment.