diff --git a/src/widgets/capture/capturewidget.cpp b/src/widgets/capture/capturewidget.cpp index 08b1c23d..e11cbe89 100644 --- a/src/widgets/capture/capturewidget.cpp +++ b/src/widgets/capture/capturewidget.cpp @@ -219,7 +219,8 @@ CaptureWidget::CaptureWidget(uint id, QGuiAppCurrentScreen().currentScreen()->geometry()); if (m_config.showHelp()) { - pushHelpMessage(); + initHelpMessage(); + OverlayMessage::push(m_helpMessage); } updateCursor(); @@ -317,9 +318,9 @@ void CaptureWidget::initButtons() m_buttonHandler->setButtons(vectorButtons); } -void CaptureWidget::pushHelpMessage() +void CaptureWidget::initHelpMessage() { - static QList> keyMap; + QList> keyMap; if (keyMap.isEmpty()) { keyMap << QPair(tr("Mouse"), tr("Select screenshot area")); using CT = CaptureTool; @@ -342,7 +343,7 @@ void CaptureWidget::pushHelpMessage() tr("Open side panel")); keyMap << QPair(tr("Esc"), tr("Exit")); } - OverlayMessage::pushKeyMap(keyMap); + m_helpMessage = OverlayMessage::compileFromKeyMap(keyMap); } QPixmap CaptureWidget::pixmap() @@ -1022,8 +1023,8 @@ void CaptureWidget::initSelection() } }); connect(m_selection, &SelectionWidget::visibilityChanged, this, [this]() { - if (!m_selection->isVisible() && ConfigHandler().showHelp()) { - pushHelpMessage(); + if (!m_selection->isVisible()) { + OverlayMessage::push(m_helpMessage); } }); } diff --git a/src/widgets/capture/capturewidget.h b/src/widgets/capture/capturewidget.h index 29194839..a3d444f2 100644 --- a/src/widgets/capture/capturewidget.h +++ b/src/widgets/capture/capturewidget.h @@ -107,7 +107,7 @@ private: void initSelection(); void initShortcuts(); void initButtons(); - void pushHelpMessage(); + void initHelpMessage(); void updateSizeIndicator(); void updateCursor(); void updateSelectionState(); @@ -173,6 +173,7 @@ private: NotifierBox* m_notifierBox; HoverEventFilter* m_eventFilter; SelectionWidget* m_selection; + QString m_helpMessage; SelectionWidget::SideType m_mouseOverHandle;