[Qt-interest] textcolor of QLineEdit
Oszkar Ambrus
oszkar.ambrus at deri.org
Tue Jun 1 16:08:36 CEST 2010
On 01/06/10 14:48, sunny shah wrote:
> How can I change textcolor of QLineEdit ? Is it possible to make
> QLineEdit 's bg transparent ?
You need to use setPalette() with the QPallette::Text role.
See http://lists.trolltech.com/qt-interest/2006-01/thread00019-0.html
and http://doc.qt.nokia.com/4.6/qwidget.html#palette-prop
You can set the opacity with the QColor constructor.
See http://doc.qt.nokia.com/4.6/qcolor.html#QColor-2 and
http://doc.qt.nokia.com/4.6/qcolor.html#setAlpha
So an example would be:
QColor color;
color.setAlpha(0);
QPalette palette( lineEdit->palette() );
palette.setColor( QPalette::Text, color );
lineEdit->setPalette(palette);
Cheers,
Oszkar
More information about the Qt-interest-old
mailing list