[PyQt] Properties in PyQt5

Florian Bruhin me at the-compiler.org
Wed Sep 24 05:39:46 BST 2014


* Vincent Vande Vyvre <vincent.vande.vyvre at telenet.be> [2014-09-24 06:32:02 +0200]:
> Le 24/09/2014 06:03, Glenn Ramsey a écrit :
> >Hi,
> >
> >I have a dialog that has been created in Qt Designer and I would like to
> >be able to set a red border on a QLineEdit based on its contents (or lack thereof).
> >
> >Below is what I have tried, based on the PyQt4 version in Mark Summerfield's
> >book "Rapid GUI programming with Python and Qt", but it doesn't work.
> >
> >What have I done wrong here?
> >
> >Glenn
> >
> >ui = Ui_MyDialog()
> >ui.setupUi(self)
> >
> >...
> >
> >invalidStyle = """
> >QLineEdit[invalid="true"] {
> >     border: 2px solid red;
> >}
> >"""
> 
> true or True ?

"true" is the right thing to use in Qt styleshets for Qt properties
with Python boolean value. I guess the string conversion is done by
QVariant which uses C++ notation.

Florian

-- 
http://www.the-compiler.org | me at the-compiler.org (Mail/XMPP)
             GPG 0xFD55A072 | http://the-compiler.org/pubkey.asc
         I love long mails! | http://email.is-not-s.ms/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20140924/e4cd45a4/attachment.sig>


More information about the PyQt mailing list