0

I'm migrating a python 2 and GTK 2 application to Qt and python 3 on Windows 10. I've converted .glade files to .ui files and dialogs initially look bad as the layout was designed for a gtk style and are jarring with windows 10 style but not following windows 10 layout conventions. Is it possible to keep the GTK look on windows 10? I tried QApplication.setStyle(GTKStyle()) and got a crash. Is there another way or can I recompile pyside2 to include a gtk look and feel?

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
ayeayeron
  • 1
  • 1
  • what is the output of `from PySide2 import QtWidgets` `print(QtWidgets.QStyleFactory.keys())`? – eyllanesc Mar 20 '19 at 04:43
  • try with: `app = QtWidgets.QApplication()` `app.setStyle('gtk')` – eyllanesc Mar 20 '19 at 05:07
  • @eyllanesc the output is [u'windowsvista', u'Windows', u'Fusion'] – ayeayeron Mar 21 '19 at 01:37
  • Well these are the styles that your installation has by default, you could get more styles but you have to compile the project and install the dll in the styles folder where PySid2 is installed, the project that you have to compile is https://code.qt.io/cgit/qt/qtstyleplugins.git/ – eyllanesc Mar 21 '19 at 01:48
  • @eyllanesc I ran that project and added dlls so now I get [u'bb10dark', u'bb10bright', u'cleanlooks', u'cde', u'motif', u'plastique', u'windowsvista', u'Windows', u'Fusion'] , gtk isn't there, do I need to change some project settings to generate gtk dlls? – ayeayeron Mar 21 '19 at 23:13
  • Have you ever had a GTK-style GUI in windows? – eyllanesc Mar 21 '19 at 23:15
  • Yes this was a pygtk application on windows which is being migrated to use Qt and python 3. – ayeayeron Mar 22 '19 at 00:44
  • If you have compiled correctly you should have obtained the gtk2 style since the source code is there: https://code.qt.io/cgit/qt/qtstyleplugins.git/tree/src/plugins/styles, from the file you have downloaded enter the folder `src/plugins/styles/gtk2/` and compile that project although it seems that he is using as dependency the library gtk+-2 + X11. I presume that it can only be installed in Linux, unless you eliminate the dependency of X11 and change the code by the api of windows – eyllanesc Mar 22 '19 at 01:01
  • So analyzing all of the above, the gtk2 style of Qt only existed in Linux, so a solution for your case is that you create your own QStyle. – eyllanesc Mar 22 '19 at 01:06

0 Answers0