Qt5 Designer - preview different style options

A forum for research and development of the user interface of FreeCAD

Moderator: agryson

Post Reply
User avatar
Kunda1
Posts: 7456
Joined: Thu Jan 05, 2017 9:03 pm

Qt5 Designer - preview different style options

Post by Kunda1 » Tue Oct 01, 2019 3:53 pm

So noodling around in Qt5 Designer (v5.13 on Manjaro Linux) I discovered that one can preview dialogs as different styles.
QtDesigner-Preview-options-menu.png
QtDesigner-Preview-options-menu.png (86.37 KiB) Viewed 576 times


So, is there a way to find more styles then just what we see is provided ?
QtDesigner-Preview-options.png
QtDesigner-Preview-options.png (77.5 KiB) Viewed 576 times
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features

User avatar
Kunda1
Posts: 7456
Joined: Thu Jan 05, 2017 9:03 pm

Re: Qt5 Designer - preview different style options

Post by Kunda1 » Tue Oct 01, 2019 5:12 pm

Found this on StackOverflow

Code: Select all

QApplication::setStyle(QStyleFactory::create("Fusion"));
QPalette p;
p = qApp->palette();
p.setColor(QPalette::Window, QColor(53,53,53));
p.setColor(QPalette::Button, QColor(53,53,53));
p.setColor(QPalette::Highlight, QColor(142,45,197));
p.setColor(QPalette::ButtonText, QColor(255,255,255));
qApp->setPalette(p);
I guess you swap "Fusion" with any of the other widget styles. Haven't tried it yet.
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features

User avatar
Kunda1
Posts: 7456
Joined: Thu Jan 05, 2017 9:03 pm

Re: Qt5 Designer - preview different style options

Post by Kunda1 » Tue Oct 01, 2019 5:13 pm

Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features


User avatar
Kunda1
Posts: 7456
Joined: Thu Jan 05, 2017 9:03 pm

Re: Qt5 Designer - preview different style options

Post by Kunda1 » Tue Oct 01, 2019 6:53 pm

Unrelated but still relevant:
qstylizer is a Qt stylesheet builder utility for PyQt4, PyQt5, PySide and PySide2 - https://qstylizer.readthedocs.io/en/latest/index.html
pyside2-style-test is Qt-5 live updating styleable component test kit - https://github.com/M3TIOR/pyside2-style-test
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features

chrisb
Posts: 25107
Joined: Tue Mar 17, 2015 9:14 am

Re: Qt5 Designer - preview different style options

Post by chrisb » Tue Oct 01, 2019 9:15 pm

Since this became a mono-Kunda1-thread: Would you mind creating a QtDesigner-for-FreeCAD tutorial?

User avatar
Kunda1
Posts: 7456
Joined: Thu Jan 05, 2017 9:03 pm

Re: Qt5 Designer - preview different style options

Post by Kunda1 » Tue Oct 01, 2019 10:21 pm

chrisb wrote:
Tue Oct 01, 2019 9:15 pm
Since this became a mono-Kunda1-thread: Would you mind creating a QtDesigner-for-FreeCAD tutorial?
I'm just in the research gathering stage. c++ is pain in the a** to understand. I'm not sure il be the one writing a tutorial on this anytime soon. But u never know :)
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features

Post Reply