[Qt-interest] QVBoxLayout whats wrong in this

Sujan Dasmahapatra sdh at lmwindpower.com
Fri Mar 25 09:18:00 CET 2011


#include <QApplication>

#include <QWidget>

#include <QPushButton>

#include <QVBoxLayout>

#include <QPalette>

int main(int argc, char **argv)

{

        QApplication app(argc,argv);

        QWidget *widget = new QWidget;

        widget->resize(500,300);

 

        QPalette r(widget->palette());

        r.setColor(QPalette::Background, Qt::red);

        widget->setPalette(r);

 

 

        QWidget *w1 = new QWidget(widget);

        w1->resize(300,150);

        QPalette p(w1->palette());

        p.setColor(QPalette::Background, Qt::green);

        w1->setPalette(p);

 

        QWidget *w2 = new QWidget(widget);

        w2->resize(300,150);

        QPalette q(w2->palette());

        q.setColor(QPalette::Background, Qt::blue);

        w2->setPalette(q);

 

        QVBoxLayout *layout = new QVBoxLayout;

        layout->addWidget(w1);

        layout->addWidget(w2);

 

        widget->setLayout(layout);

 

        widget->show();

 

        return app.exec();

}

 

I  am not able to see the distinguished two colored widgets.

 

 

Kind Regards,

 

 

Sujan Dasmahapatra
Project Leader, Aero Group
Aero Group

Tel    +91 80 66470248
Mob  

sdh at lmwindpower.com <mailto:%25EMAIL%25> 

 

LM Wind Power Blades

lmwindpower.com

 

Together we capture the wind to power a cleaner world

________________________________

 

This e-mail and any attachments are confidential. If you are not the
named or intended recipient, please notify the sender immediately and do
not disclose the contents to any other person, use it for any purpose,
or store or copy the information in any medium. Any unauthorized
disclosure, use or storage is prohibited and might be unlawful.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110325/34b12630/attachment.html 


More information about the Qt-interest-old mailing list