From 8aa137b35c18c0079189cd712c1a08ae09746060 Mon Sep 17 00:00:00 2001 From: Jeremy Borgman Date: Thu, 24 Sep 2020 09:54:57 -0500 Subject: [PATCH] lowered hover delay to 0.5 s --- src/config/CMakeLists.txt | 1 + src/config/styleoverride.cpp | 16 ++++++++++++++++ src/config/styleoverride.h | 21 +++++++++++++++++++++ src/main.cpp | 2 ++ 4 files changed, 40 insertions(+) create mode 100644 src/config/styleoverride.cpp create mode 100644 src/config/styleoverride.h diff --git a/src/config/CMakeLists.txt b/src/config/CMakeLists.txt index 72360542..a413e2ec 100644 --- a/src/config/CMakeLists.txt +++ b/src/config/CMakeLists.txt @@ -7,5 +7,6 @@ target_sources( filenameeditor.cpp geneneralconf.cpp strftimechooserwidget.cpp + styleoverride.cpp uicoloreditor.cpp visualseditor.cpp) diff --git a/src/config/styleoverride.cpp b/src/config/styleoverride.cpp new file mode 100644 index 00000000..cf95dd9f --- /dev/null +++ b/src/config/styleoverride.cpp @@ -0,0 +1,16 @@ +// +// Created by jeremy on 9/24/20. +// +#include "styleoverride.h" + +int StyleOverride::styleHint(StyleHint hint, + const QStyleOption* option, + const QWidget* widget, + QStyleHintReturn* returnData) const +{ + if (hint == SH_ToolTip_WakeUpDelay) { + return 500; + } else { + return baseStyle()->styleHint(hint, option, widget, returnData); + } +} diff --git a/src/config/styleoverride.h b/src/config/styleoverride.h new file mode 100644 index 00000000..19ff415c --- /dev/null +++ b/src/config/styleoverride.h @@ -0,0 +1,21 @@ +// +// Created by jeremy on 9/24/20. +// + +#ifndef FLAMESHOT_STYLEOVERRIDE_H +#define FLAMESHOT_STYLEOVERRIDE_H + +#include +#include + +class StyleOverride : public QProxyStyle +{ + Q_OBJECT +public: + int styleHint(StyleHint hint, + const QStyleOption* option = Q_NULLPTR, + const QWidget* widget = Q_NULLPTR, + QStyleHintReturn* returnData = Q_NULLPTR) const; +}; + +#endif // FLAMESHOT_STYLEOVERRIDE_H diff --git a/src/main.cpp b/src/main.cpp index 417f584d..e4a96d91 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -17,6 +17,7 @@ #include "singleapplication.h" #include "src/cli/commandlineparser.h" +#include "src/config/styleoverride.h" #include "src/core/capturerequest.h" #include "src/core/controller.h" #include "src/utils/confighandler.h" @@ -39,6 +40,7 @@ int main(int argc, char* argv[]) { + QApplication::setStyle(new StyleOverride); // required for the button serialization // TODO: change to QVector in v1.0 qRegisterMetaTypeStreamOperators>("QList");