Skip to content

Commit

Permalink
Implements a global event filter to suppress help question mark
Browse files Browse the repository at this point in the history
  • Loading branch information
jamescowens committed Dec 14, 2019
1 parent b70ec15 commit 1c31749
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/qt/bitcoin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,9 @@ int StartGridcoinQt(int argc, char *argv[])
// Install global event filter that makes sure that long tooltips can be word-wrapped
app.installEventFilter(new GUIUtil::ToolTipToRichTextFilter(TOOLTIP_WRAP_THRESHOLD, &app));

// Install global event filter that suppresses help context question mark
app.installEventFilter(new GUIUtil::WindowContextHelpButtonHintFilter(&app));

#if QT_VERSION < 0x050000
// Install qDebug() message handler to route to debug.log
qInstallMsgHandler(DebugMessageHandler);
Expand Down
19 changes: 19 additions & 0 deletions src/qt/guiutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,25 @@ bool ToolTipToRichTextFilter::eventFilter(QObject *obj, QEvent *evt)
return QObject::eventFilter(obj, evt);
}

WindowContextHelpButtonHintFilter::WindowContextHelpButtonHintFilter(QObject *parent) :
QObject(parent)
{

}

bool WindowContextHelpButtonHintFilter::eventFilter (QObject *obj, QEvent *event)
{
if (event->type () == QEvent::Create)
{
if (obj->isWidgetType ())
{
auto w = static_cast<QWidget *> (obj);
w->setWindowFlags (w->windowFlags () & (~Qt::WindowContextHelpButtonHint));
}
}
return QObject::eventFilter (obj, event);
}

#ifdef WIN32
boost::filesystem::path static StartupShortcutPath()
{
Expand Down
18 changes: 18 additions & 0 deletions src/qt/guiutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,24 @@ namespace GUIUtil
int size_threshold;
};

/** Qt event filter that suppress context help question mark for all windows.
*/

class WindowContextHelpButtonHintFilter : public QObject
{
Q_OBJECT

public:
explicit WindowContextHelpButtonHintFilter(QObject *parent = 0);

protected:
bool eventFilter(QObject *obj, QEvent *evt);

private:
int size_threshold;
};


bool GetStartOnSystemStartup();
bool SetStartOnSystemStartup(bool fAutoStart);

Expand Down

0 comments on commit 1c31749

Please sign in to comment.