Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implements a global event filter to suppress help question mark #1609

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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