[Qt-interest] QWidget stylesheet

pepone.onrez pepone.onrez at gmail.com
Thu Nov 26 05:28:39 CET 2009


Hi,

I trying to set the background color of a custom widget using a style sheet
but i cannot get it working

Here is my Widget

 class LoginForm : public QWidget

{

Q_OBJECT

public:

 LoginForm(QWidget* parent);

private slots:

 void login();

private:

 QLabel* _lblUsername;

QLineEdit* _lneUsername;

QLabel* _lblPassword;

QLineEdit* _lnePassword;

QPushButton* _pbtLogin;

};

 LoginForm::LoginForm(QWidget* parent) :

QWidget(parent)

{

setObjectName("loginForm");
    //.......

QVBoxLayout* vLayout = new QVBoxLayout();
    //-...

setLayout(vLayout);

}

In the style sheet i have try to set the background with these two variants.

 QWidget#loginForm{ background: red;}


LoginForm{ background: red;}


Regards,
José
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091126/6c183e1f/attachment.html 


More information about the Qt-interest-old mailing list