diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2013-05-31 17:43:38 +1000 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-05-31 17:43:38 +1000 |
commit | 5c2a2691fdccb9d355fe7f71c19aa104b9d570f4 (patch) | |
tree | 9cf63cd7cffe4b58ef23019775dccdf5e527e29e /qt-gui.cpp | |
parent | a31a8ca7599f66bf2a6cfab062241d000699d346 (diff) | |
download | subsurface-5c2a2691fdccb9d355fe7f71c19aa104b9d570f4.tar.gz |
Much better solution to avoid the gtk+ style on Linux
Thiago showed me how to find out which style is in use and if we see a
user is running gtk+ we simply switch Subsurface to Oxygen (using the
old plastique in the previous patch was a result of reading an old Qt
book, I guess).
Solved-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-gui.cpp')
-rw-r--r-- | qt-gui.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/qt-gui.cpp b/qt-gui.cpp index 31b6c1b0b..bab27a318 100644 --- a/qt-gui.cpp +++ b/qt-gui.cpp @@ -30,6 +30,8 @@ #include <QTranslator> #include <QSettings> #include <QDesktopWidget> +#include <QStyle> +#include <QDebug> const char *default_dive_computer_vendor; const char *default_dive_computer_product; @@ -84,17 +86,14 @@ const char *getSetting(QSettings &s, QString name) void init_ui(int *argcp, char ***argvp) { QVariant v; -#ifdef __linux__ - // for people running under Gnome the default style is - // really ugly; this seems like a bad hack, but it makes - // things look somewhat better - // I'd much rather be able to check if it is using the Gnome - // style and only then force plastique but I haven't been - // able to figure out how to do that - QApplication::setStyle("plastique"); -#endif + application = new QApplication(*argcp, *argvp); + // the Gtk theme makes things unbearably ugly + // so switch to Oxygen in this case + if (application->style()->objectName() == "gtk+") + application->setStyle("Oxygen"); + #if QT_VERSION < 0x050000 // ask QString in Qt 4 to interpret all char* as UTF-8, // like Qt 5 does. |