Tdesktop: Make tdesktop look native / Do not set Qt style to win by default

Created on 11 Aug 2015  Â·  41Comments  Â·  Source: telegramdesktop/tdesktop

Telegram does not use the gtk style which uses gtk+ engine to render the widgets. Please do not do this. Just do not set it manually at all. As far as I know qt takes the correct style automatically.

Further reads:
http://doc.qt.io/qt-5/qstyle.html#details
http://doc.qt.io/qt-4.8/qgtkstyle.html#details

enhancement linux

Most helpful comment

I've added -no-gtkstyle in the latest 0.9.57 alpha version (instead of "-style=0" fake param).
I cannot let Qt to load gtk, because it loads gtk-2, while I sometimes load gtk-3 for libappindicator3 and everything crashes.
I'm using gtk file dialog in 0.9.57 alpha version when it is available.

All 41 comments

Also stop using Open Sans, distance between symbols in some alphabets (russian e.g.) is too big

Linux users want native file dialog and tray menu! QFileDialog does not use the native dialog windows by default?

I do nothing with the styles, but I use Qt static build, perhaps that is the cause of non-native look.

Proper theming would be nice, but native picker would be even better. I don't how they do it, but Chrome on linux manages to chooses the gtk picker on Gnome and the kde picker ("KDE File Dialog Widget") on KDE. I would at least be happy with proper theming!

@nortexoid This would introduce unneccesary dependencies. Qt way is to do it platform independent.
@telegramdesktop At least the style set manually gets overidden.

@ManuelSchneid3r Why would it introduce dependecies? Make algorithm like: if there is gtkpeeker - use gtkpeeker, if there is KDE-file-dialog - use kdefile dialog. Otherwise use native. Chrome doesn't have any dependencies

@Yanpas Sounds right to me. The Qt5 build of QupZilla I'm using doesn't have any GTK/KDE dependencies but it still allows the use of native file picker.

@Yanpas, Qt-based applications should automatically use system-wide look without any algorithms. As @ManuelSchneid3r said, currently there is an overrride of default style in Telegram code (through fake args), that prevents it.

Everybody seems to be talking only about looks. Sure, looks are important, but it's not just about looks. Functionality is also impaired!

For example, mounted network drives, or "favourite places" are not shown in Telegram's file picker, although they exist in the native file picker. Another thing is that there is no file preview of the selected file on the right side. These are useful things and it's really annoying to not have those in the desktop client.

I completely subscribe to @Lesik's comment. Thank you for highlighting the visual impairments that affect productivity directly!

Please. File picker is really annoying to use and that is big shame considering how well Telegram works with media.

@michaldaniel If it is something easy and I just do not know how to do that, a pull request fix will be much appreciated. But it should not bring any new dependencies for the resulting binary (it should check library availability at runtime and use them only when they are available or static link them).

the main problem is not the style, but the lack of a picture preview

as a workaround I just use the default filebrowser and drag the image to the telegram window which works just perfectly

as a workaround I just use the default filebrowser and drag the image to the telegram window which works just perfectly

Cool workaround. Thanks for sharing! :)

~ Robert

@telegramdesktop I have no idea what is the reason, as far as I know QT should use GTK by default if not overriden. I'll give it a try soon anyway as I love Telegram. Don't really count on much tho, it's not like I've done any QT development before.

@michaldaniel and others,

hluk, developer of CopyQ, has successfully done the same here.

Maybe you can draw some inspiration?

~ Robert

Just to clarify as discussed in #982, this issue is about the style in general, not the filechooser. These are two different issues and #982 should be reopened for Lesiks arguments. If you check orschiros link you will see, that there even the Qt filedialog is rendered with the native renderer and blends in well with the set desktop theme.

As said the context menu of the systray icon is affected and presumably every not explicitely styled widget too.

Image

What prevents Telgram widgets from beeing rendered with the native renderer is this line in the code:

QByteArray args[] = { "-style=0" }; // prepare fake args

Is this fake arg really needed?

Just to show the effect: My own Qt application started without parameters: (Well integrated Vertex theme)
Image
My own Qt application started with --style=0 parameter: (Ugly fallback Winlike theme)
Image

Sorry for the tons of reedits.

@telegramdesktop, why is the style explicitly set to zero? What is the purpose of "fake args?"

I am using Manjaro linux, tried to compile the binary and removing the "--style=0" fake argument from the binary. I can set environment variables for different apps but i cannot get the Telegram binary to switch to the native file-dialog

QTCreator switches correctly if i change my environment variables though...

Just to clearify again this bug is NOT about the filechooser. For filechooser check #982.

@TotalKrill I'm sure this argument did nothing with the filechooser.

@ManuelSchneid3r I don't quite remember what forced me to dislike reading of QT_STYLE_OVERRIDE env variable :( The main idea is to make the app look as designed in all the supported systems, but it seems that tray icon menu is not controlled by me anyway. Are there any other controls that depend on that argument? Except tray icon context menu.

@telegramdesktop This argument does nothing as you say. I do also agree that this issue is not about the filechooser only. I will continue my filechooser quest in #982.

For the --style=0 however, I would recommend to remove it unless it is really needed for something specific, having hardcoded arguments kind of destroys the point a bit. Maybe put that argument inside of the telegram.desktop file instead.

Currently I was forced to rollback the "--style=0" param, because it has very important meaning in some of the environments, see https://github.com/telegramdesktop/tdesktop/issues/1774 so it will be returned in the next version.

@telegramdesktop @john-preston I've been trying to get portable builds of a patched telegram I maintain for a few days. And it seems that this can be fixed more properly by adding -no-gtkstyle -no-glib to the Qt build options.

After this is works on a Xubuntu 16.04 system without the -style=0 argument. I cannot confirm how this might impact other platforms.

For others interested in build scripts (main is ubuntu_xenial atm) and what not, check out:
https://git.mel.vin/telegram_desktop/builds

@telegramdesktop @ManuelSchneid3r I've made PR for it https://github.com/telegramdesktop/tdesktop/pull/2221 by applying qgtk2 theme engine

@BOOtak I still find it rather odd that a Qt application gives me a GTK file picker of any sort since I use KDE myself. With this PR however I doubt that -no-gtkstyle -no-glib can be added to the Qt configure arguments. Which effectively means -style=0 needs to be forced still.

I've added -no-gtkstyle in the latest 0.9.57 alpha version (instead of "-style=0" fake param).
I cannot let Qt to load gtk, because it loads gtk-2, while I sometimes load gtk-3 for libappindicator3 and everything crashes.
I'm using gtk file dialog in 0.9.57 alpha version when it is available.

Works great for me, thanks! (elementary OS 0.4)

@john-preston Note that this option changes in Qt 5.7

@ManuelSchneid3r Looks like they are replacing it with "-no-gtk" or am I reading this wrong?

@ManuelSchneid3r I'm not moving to Qt 5.7 in the near future, at least widely — they drop support for many versions of Windows and one more OS X. I'm still not ready to develop two versions for Windows like I do for OS X :/

The usage of the GTK filechooser is a big improvement to the software, what is the stance on making it optional to provide your own theme to the application and how hard would it be to implement?

The usage of the GTK filechooser is a big improvement to the software

No, it is not and worst of all --no-gtkstyle does not work in 0.10.1

@TotalKrill and @KAMiKAZOW

I think everything regarding theming will be hacky, rigid, and partial until (if) #1815 gets prioritized.

@KAMiKAZOW Yes, this is a bit annoying if your desktop environment uses Qt.

#667 ?

image
Context menu has been fixed in 1.0.26.

2958 imho better ticket.

@Aokromes they're a bit different, this one is for Linux :)

maybe, but it's sort of generic issue, people wanting a setting to allow to select how GUI is :)
cc https://github.com/telegramdesktop/tdesktop/issues/4358

Actually this one is solved for me. Everything looks fine.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Mindstormer619 picture Mindstormer619  Â·  3Comments

JhonSane picture JhonSane  Â·  3Comments

slowaways picture slowaways  Â·  3Comments

beppe9000 picture beppe9000  Â·  3Comments

whywhyy picture whywhyy  Â·  3Comments