Forum > QT

Qt App Style and Component Style

(1/1)

LA.Center:
Maybe this is a dumb question, but I could not find any reference.

One of Qt's best feature is the styling of Application e.g. Motif, CDE, Windows, Platique etc. but more important than that is the ability to style components e.g.
QPushButton.SetStyle('font-size: 12px').

How is this achieved in Lazarus?, I mean the qt4.pas files has all the methods to support this? Is there a trick I can use styling in Qt-Laz?

vvzh:
The only resource on this subject I know is the following post on the Russian FPC forum:
http://www.freepascal.ru/forum/viewtopic.php?f=5&t=6311&p=46571#p46571
It contains code examples so it does not require you to learn another language.

The author of this post gives three notes:
1. Qt stylesheet examples can be found at http://doc.crossplatform.ru/qt/4.6.x/stylesheet-examples.html.
2. Applying stylesheets to widgets does not work if no style has been applied to the form containing these widgets.
3. To make example code work you must change one line of code in qt4.pas unit from "procedure QApplication_setStyleSheet(handle: QApplicationH; ..." to "procedure QApplication_setStyleSheet(handle: QCoreApplicationH; ...".

zeljko:
@vvzh: you're completely wrong.QtLCL have full support for stylesheets per widget or general using by passing stylesheet via command line. You can apply stylesheet to any supported widget eg via TQtWidget(MyWinControl.Handle).StyleSheet property. I'm using it for a long time.
Sometimes you don't need to change anything in your qtlcl based app since any qt app can read stylesheet params crom command line eg. -stylesheet mystylesheet.txt
I'm using such scenario for touch screens where I need wider scrollbars and bigger buttons.

LA.Center:
Thx for the info. Yes TQtWidget is what I was looking for, how about the app styles, is there a trick for it too.

Navigation

[0] Message Index

Go to full version