[Interest] how to change color of placeholderText in Quick Controls 2 TextField ?

Mitch Curtis mitch.curtis at qt.io
Mon Dec 11 08:06:01 CET 2017


> -----Original Message-----
> From: Interest [mailto:interest-bounces+mitch.curtis=qt.io at qt-project.org]
> On Behalf Of Alexander Ivash
> Sent: Saturday, 9 December 2017 10:54 PM
> To: interest at qt-project.org
> Subject: [Interest] how to change color of placeholderText in Quick Controls
> 2 TextField ?
> 
> Do I understand correctly that the only way to achieve it - is to create new
> style and specify it in config? I

With Qt 5.10 you can use the new palette support (https://blog.qt.io/blog/2017/11/23/ready-qt-quick-controls-2-3/) by specifying the colour in the qtquickcontrols2.conf file:

https://doc.qt.io/qt-5/qtquickcontrols2-configuration.html#palette-configuration

As mentioned in the blog post, currently only the Default, Fusion and Imagine styles are supported, but the others are coming later.

Although, it seems there is currently no distinction between text and placeholder text:

http://code.qt.io/cgit/qt/qtquickcontrols2.git/tree/src/imports/controls/TextField.qml

I guess we'd need to add support for a placeholder text role to QPalette in order to support distinguishing between the two.

More info on palettes:

https://doc.qt.io/qt-5/qml-qtquick-controls2-control.html#palette-prop

> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest



More information about the Interest mailing list