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

Fix the regression that QT 5.7.0 doesn't support GTK3 theming #73

Closed
philmmanjaro opened this issue Jun 27, 2016 · 77 comments

Comments

@philmmanjaro
Copy link
Member

commented Jun 27, 2016

After upgrading Qt 5.6 -> 5.7, the GTK widget style disappeared and is not longer used by KDE applications as well as unavailable in System settings>Application style>Widget style

This has two reasons:

  • QGtkStyle was moved to the qtstyleplugins repository (package qt5-styleplugins)
  • qt5ct can be used as alternative

Using qt5-styleplugins:

  • change the /etc/environment override variable to: QT_STYLE_OVERRIDE=gtk2

Using qt5ct:

  • run qt5ct to set an icon theme, and set the environment variable QT_QPA_PLATFORMTHEME=qt5ct in /etc/environment.

To have the style also for applications you use sudo or any tools to get root rights you have to copy your dot-config file over with cp -a /etc/skel/.config /root/.

@philmmanjaro philmmanjaro added the todo label Jun 27, 2016
@philmmanjaro philmmanjaro added this to the 16.08 milestone Jun 27, 2016
@philmmanjaro

This comment has been minimized.

Copy link
Member Author

commented Jun 27, 2016

@philmmanjaro

This comment has been minimized.

Copy link
Member Author

commented Jun 27, 2016

Check also Arch Wiki on this topic.

@philmmanjaro

This comment has been minimized.

Copy link
Member Author

commented Jun 27, 2016

If you have seg-faults with QT apps please do this:

  • Install qt5-styleplugins and qt5ct
  • Set environment variable in /etc/environment QT_QPA_PLATFORMTHEME=qt5ct
  • Restart the system
  • Start qt5ct and select gtk2
  • Repeat it for your root account, if needed ...
@SanKro

This comment has been minimized.

Copy link

commented Jun 27, 2016

could we set the environment variables in a script in /etc/profile.d/somescript.sh ?
because there are people here who have XFCE AND KDE Plasma installed for different user. right now it just works the way that i use the normal manjaro design in XFCE (also for Qt apps) and on KDE Plasma breeze (also for GTK apps).

this solution in /etc/environment would force the style on both systems to use whatever is selected in qt5ct? so i would have to switch first after every start of a different desktop environment?

@philmmanjaro

This comment has been minimized.

Copy link
Member Author

commented Jun 27, 2016

@philmmanjaro

This comment has been minimized.

Copy link
Member Author

commented Jun 27, 2016

@SanKro: please read this thread.

@philmmanjaro

This comment has been minimized.

Copy link
Member Author

commented Jun 27, 2016

It will be fun when gtk2 support is dropped for good 1, 2

@SanKro

This comment has been minimized.

Copy link

commented Jun 27, 2016

@philmmanjaro for the long run. isnt it possible to change Breeze or Adwaita to be more "manjarosh" since the two of them are available with Qt4,5 and GTK2,3 support?

@philmmanjaro

This comment has been minimized.

Copy link
Member Author

commented Jun 27, 2016

@SanKro: please use the Maia themes, which is what you're searching for ...

@SanKro

This comment has been minimized.

Copy link

commented Jun 28, 2016

@philmmanjaro no it isnt. because there is no maia Qt widget style. here you need to use the GTK widget style for Qt apps.
what i mean is to create a widget style for:
GTK2, GTK3, Qt4, Qt5 that looks unified on every framework.
for the moment only 2 "styles" provide this:

what i mean is not to "emulate" a GTK look, but to have native styles for every framework that looks the same.

so again - for the long run - wouldnt it be better to use adwaita or breeze and change them to fit into manjaros styleguidelines than to workaround the situation by pulling in a gtk2 look into Qt without real upstream support?

@Kirek

This comment has been minimized.

Copy link

commented Jun 28, 2016

maia-gtk is breeze-gtk with the maia color scheme, so using breeze widgets + maia colorscheme + maia-gtk matches.

@SanKro

This comment has been minimized.

Copy link

commented Jun 28, 2016

@Kirek ohh i didnt knew that. thanks so its of course the thing i'm describing. but then, why using this workaround with gtk2 themes for Qt instead of just using native breeze+colors?

@philmmanjaro

This comment has been minimized.

Copy link
Member Author

commented Jun 28, 2016

For xfce we are using vertex-maia theme. On KDE this issue should not be present. There we use maia.

philmmanjaro referenced this issue in manjaro/manjaro-xfce-settings Jun 29, 2016
philmmanjaro referenced this issue in manjaro/manjaro-xfce-settings Jun 29, 2016
philmmanjaro referenced this issue in manjaro/manjaro-xfce-settings Jun 29, 2016
@philmmanjaro

This comment has been minimized.

Copy link
Member Author

commented Jun 29, 2016

QT 5.7 source breaks are useful to find out what changed in regard of styling:

Changes to QStyle

QStyle::standardIconImplementation() and QStyle::layoutSpacingImplementation() are removed, and the QStyle::standardIcon() and QStyle::layoutSpacing() functions are made pure virtual now. The removed functions were introduced in Qt 4 for binary compatibility reasons.
QMotifStyle, QPlastiqueStyle, QCleanlooksStyle, and QCDEStyle are replaced with a new fusion style. If your application depends on any of these removed styles, you can either use the qtstyleplugins project to get these styles or update your application to use the new fusion style. For more details about this change, see this blog post.

The following QStyle implementations have been made internal:

  • QFusionStyle
  • QGtkStyle
  • QMacStyle
  • QWindowsCEStyle
  • QWindowsMobileStyle
  • QWindowsStyle
  • QWindowsVistaStyle
  • QWindowsXPStyle

Instead of creating instances or inheriting these classes directly, use:

  • QStyleFactory for creating instances of specific styles.
  • QProxyStyle for customizing existing style implementations.
  • QCommonStyle as a base for implementing full custom styles.
@philmmanjaro

This comment has been minimized.

Copy link
Member Author

commented Jun 29, 2016

Seems with the current dev-build I managed to restore the unified look at least for XFCE. KDE edition has still some issues we should resolve ...

@philmmanjaro

This comment has been minimized.

Copy link
Member Author

commented Jul 1, 2016

Some issues found with this:

cinnamon --replace overwrites QT_STYLE_OVERRIDE with gtk
LXDE has QT_PLATFORM_PLUGIN and QT_QPA_PLATFORMPLUGIN value hard coded in lxsession in environment.c within lines 678-679.

@ghost

This comment has been minimized.

Copy link

commented Jul 2, 2016

I confirm that dev-build resolved the issue, but still exist on my current xfce desktop:
https://forum.manjaro.org/t/theme-issue-with-manjaro-settings-manager/5145

@philmmanjaro

This comment has been minimized.

Copy link
Member Author

commented Jul 2, 2016

@kouros17: you have to select gtk2 as theme and rerun qt5ct with root rights to do the same.

@philmmanjaro

This comment has been minimized.

Copy link
Member Author

commented Jul 2, 2016

Seems the decision to remove gtk theme support was made almost one year ago. One month later it was moved to styleplugins. So far only two patches got added (1, 2). Lets see what the difference now is.

@philmmanjaro

This comment has been minimized.

Copy link
Member Author

commented Jul 2, 2016

I reviewed the code and as mentioned, the code was simplified as direct linkage to libraries is used, instead QLibrary as before. However this needed also been changed within LXDE, Mate, Cinnamon, Gnome etc. to make it work.

@sljunkie

This comment has been minimized.

Copy link

commented Jul 4, 2016

I'm on Arch Linux. I'm experimenting with the qt5-styleplugins and qt5ct packages since I was getting segfaults - these fixes won't work on gnome since starting a gnome-sessions overrides QT_QPA_PLATFORMTHEME=qgnomeplatform. This design worked with qt5 < 5.7. And the folks at Qt said that gtk3 plugin won't be provided until 5.8.0.

@v17564

This comment has been minimized.

Copy link

commented Aug 2, 2016

@philmmanjaro can you speak with developers of qt5ct to change the size of window?.

In a resolution of 1024x768 the size of the window for qt5ct are very large, it doesn't leave resize and therefore, the only way of gaining access to the buttons to "apply" and "ok" it's "moving" the window with alt+space with option "move".

@philmmanjaro

This comment has been minimized.

Copy link
Member Author

commented Aug 2, 2016

QT_STYLE_OVERRIDE='gtk' is the old and needs to be changed to `QT_STYLE_OVERRIDE='gtk2'``as used by the new package styles. I think with the latest setup it should be fine now.

@oberon-manjaro

This comment has been minimized.

Copy link
Member

commented Aug 2, 2016

@v17564 qt5ct has a bugtracker and I made the experience that they reply really quickly :) Please open a ticket there!

@v17564

This comment has been minimized.

Copy link

commented Aug 2, 2016

Ok @philmmanjaro i open a ticket.
Thanks.

@v17564

This comment has been minimized.

Copy link

commented Aug 3, 2016

Like clarification only.

Qbittorrent aspect without installing qt5ct and without changing the values of the variables in /etc / environment:

manjaro 16 06 x64 clonar corriendo - oracle vm virtualbox_005

After installed only qt5ct but "not" run the command, isn't necessary, and change the variables:

manjaro 16 06 x64 clonar corriendo - oracle vm virtualbox_006

The aspect has changed.

@philmmanjaro

This comment has been minimized.

Copy link
Member Author

commented Aug 3, 2016

@v17564: that is the default fusion theme QT5 uses now.

@v17564

This comment has been minimized.

Copy link

commented Aug 15, 2016

Hello.
I think that it would be necessary to change the parameters of configuration of qt5ct to avoid the exhibited in the following entry of the qt5ct bugtracer:

Size of window is very large
https://sourceforge.net/p/qt5ct/tickets/23/

It would be necessary to remove from the configuration parameters the QT_STYLE_OVERRIDE in the /etc/environment and in the .xprofile of the users and only leave the QT_QPA_PLATFORMTHEME ='qt5ct'

For whom it has already installed qt5ct with qt5-styleplugins, it is recommended to erase the configuration subdirectory of the user: rm -rf ~/.config/qt5ct

For test that it work follow this steps:

rm -rf ~/.config/qt5ct
export -n QT_STYLE_OVERRIDE
export QT_QPA_PLATFORMTHEME=qt5ct
qt5ct
@philmmanjaro

This comment has been minimized.

Copy link
Member Author

commented Aug 15, 2016

This is already taken care of with 16.08-pre4.

@philmmanjaro

This comment has been minimized.

Copy link
Member Author

commented Aug 21, 2016

Seems root user is still missing partly ...

@philmmanjaro philmmanjaro reopened this Aug 21, 2016
@udeved

This comment has been minimized.

Copy link

commented Aug 26, 2016

To automatically set QT_QPA_PLATFORMTHEME for user session, add the following line to ~/.profile.

[ "$XDG_CURRENT_DESKTOP" = "KDE" ] || [ "$XDG_CURRENT_DESKTOP" = "GNOME" ] || export QT_QPA_PLATFORMTHEME="qt5ct"

This will export QT_QPA_PLATFORMTHEME environment variable for the whole user session.

https://wiki.archlinux.org/index.php/qt

@TomaszGasior

This comment has been minimized.

Copy link

commented Feb 19, 2017

Would be better to use by default in Manjaro XFCE this package — https://aur.archlinux.org/packages/qt5gtk2/ — instead of qt5ct? It seems to me, that Manjaro's users don't need Qt5 configuration tool. This solution is simpler to maintenance (QT_QPA_PLATFORMTHEME=qt5gtk2 variable is only needed, you don't have to keep qt5 configs in /etc/skel).

@embluk

This comment has been minimized.

Copy link

commented May 2, 2017

Hello,
I am using the Cinnamon desktop and I am trying to get https://github.com/mattanger/ckb-next working. I can install CKB but whenever I click on change colour the app crashes and after submitting an issue on https://github.com/mattanger/ckb-next the devs say it is something to do with Qt not supporting GTK theming anymore, they said they won't help as its not an issue directly around CKB.

I feel this issue where the app crashes when clicking on 'Change Colour' is something to do with what is referenced in this thread. I've gone through this thread and tried everything mentioned and still no luck.

I installed qt5ct but I cannot open it from the menu as it displays 1 error being:
Please remove the QT_STYLE_OVERRIDE environment variable
Inside /etc/enviroment all I have is QT_QPA_PLATFORMTHEME=qt5ct

To get qt5ct to run I have to use (From @v17564 ):

rm -rf ~/.config/qt5ct
export -n QT_STYLE_OVERRIDE
export QT_QPA_PLATFORMTHEME=qt5ct
qt5ct

All I can select then is only GTK+, no other GTK variant...

If this helps here are the errors when the app crashes:

(ckb:18458): GLib-GObject-WARNING **: cannot register existing type 'GtkWidget'

(ckb:18458): GLib-GObject-WARNING **: cannot add class private field to invalid type '<invalid>'

(ckb:18458): GLib-GObject-WARNING **: cannot add private field to invalid (non-instantiatable) type '<invalid>'

(ckb:18458): GLib-GObject-CRITICAL **: g_type_add_interface_static: assertion 'G_TYPE_IS_INSTANTIATABLE (instance_type)' failed

(ckb:18458): GLib-GObject-WARNING **: cannot register existing type 'GtkBuildable'

(ckb:18458): GLib-GObject-CRITICAL **: g_type_interface_add_prerequisite: assertion 'G_TYPE_IS_INTERFACE (interface_type)' failed

(ckb:18458): GLib-CRITICAL **: g_once_init_leave: assertion 'result != 0' failed

(ckb:18458): GLib-GObject-CRITICAL **: g_type_add_interface_static: assertion 'G_TYPE_IS_INSTANTIATABLE (instance_type)' failed

(ckb:18458): GLib-GObject-CRITICAL **: g_type_register_static: assertion 'parent_type > 0' failed

(ckb:18458): GLib-GObject-WARNING **: cannot add private field to invalid (non-instantiatable) type '<invalid>'
@TomaszGasior

This comment has been minimized.

Copy link

commented May 2, 2017

@embluk please test qt5gtk2.
install https://aur.archlinux.org/packages/qt5gtk2/
and use QT_QPA_PLATFORMTHEME=qt5gtk2

@philmmanjaro

This comment has been minimized.

Copy link
Member Author

commented May 2, 2017

@embluk: what happens if you call in a terminal echo $QT_STYLE_OVERRIDE? The current code should unset that variable ...

@embluk

This comment has been minimized.

Copy link

commented May 3, 2017

I seem to have solved my issue by installing Qt 5.5 and building CKB with that. Then everything worked.
But because I wanted Qt 5.8, I uninstalled Qt 5.5 and installed Qt 5.8 and CKB still works, no issues. I guess it is because I built it from source using Qt 5.5 where the Gtk styling issue is not there...

Anyway, I tried @philmmanjaro suggestion to use echo $QT_STYLE_OVERRIDE and it gives me gtk in the terminal.

@niccolatorres

This comment has been minimized.

Copy link

commented Jul 25, 2017

I've unset QT_STYLE_OVERRIDE on linux to avoid annoying

QApplication invalid style override passed ignoring it

@Yanpas

This comment has been minimized.

Copy link

commented Sep 5, 2017

The only Qt5 application which doesn't use qt5ct theming is Qt creator. It still looks unfriendly with Xfce and any other Gtk DE

@sljunkie

This comment has been minimized.

Copy link

commented Sep 12, 2017

Under Gnome only Texmaker overrides qt5ct's color theme.

@J-J-Chiarella

This comment has been minimized.

Copy link

commented Jan 25, 2018

May be relevant: On Xubuntu, the qt5-style-plugins package works with Qbittorrent just fine, but Lyx does not use the file chooser from gtk and does not use the GTK button order (even though theming of bars and icons works). Maybe it affects Manjaro, too. Something you may want to check.

@codesardine

This comment has been minimized.

Copy link

commented Jan 27, 2018

Theming on linux is a mess, i still dont have uniform look across toolkits, what is the manjaro team using in 2018 for uniform look and witch themes are more supported.

@TomaszGasior

This comment has been minimized.

Copy link

commented Jan 27, 2018

qt5ct is unneeded now. It is possible to safely uninstall it*. Instead install qt5-styleplugins and use QT_QPA_PLATFORMTHEME=gtk2 environment variable, for example in /etc/environment.
In the past it didn't work but currently problem is fixed in Qt and this way you can easly get more consistent look of dialogs and skin without additional software.

* — Not in Manjaro, where it is dependency for manjaro-<desktop>-settings package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
You can’t perform that action at this time.