Skip to content

Commit

Permalink
Merge pull request #1609 from jamescowens/suppresshelpquestionmark
Browse files Browse the repository at this point in the history
Implements a global event filter to suppress help question mark
  • Loading branch information
jamescowens authored Dec 15, 2019
2 parents 5c49d41 + e58e79e commit 9f8a356
Show file tree
Hide file tree
Showing 3 changed files with 37 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
15 changes: 15 additions & 0 deletions src/qt/guiutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,21 @@ 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);
};


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

Expand Down

0 comments on commit 9f8a356

Please sign in to comment.