[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Help with QStackedLayout (I forgot something?)
From: "=?ISO-8859-1?Q?Percy_Camilo_Trive=F1o_Aucahuasi?=" <orgyforever () gmail ! com>
Date: 2008-06-08 3:55:20
Message-ID: 579229230806072055s20710bh68b8e26066a55f68 () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
Hi all, please I need some help with this issue. When I put 2
QStackedLayouts inside of QGridLayout and try to resize the main widget then
I got a unexpected behaviour, the resize event makes crazy to layouts. This
is the code:
//BEGIN
#include <QApplication>
#include <QPushButton>
#include <QStackedLayout>
int main(int argc, char * argv[])
{
QApplication app(argc, argv);
QWidget * w = new QWidget();
/// init widgets
QPushButton * btn0 = new QPushButton("header", w);
btn0->setMaximumHeight(120); // NOTE
QPushButton * btn1 = new QPushButton("body", w);
/// init layouts
QStackedLayout * head_lay0 = new QStackedLayout();
head_lay0->addWidget(btn0);
QStackedLayout * body_lay1 = new QStackedLayout();
body_lay1->addWidget(btn1);
/// init main layout
QVBoxLayout * gridlay = new QVBoxLayout(w);
gridlay->addLayout(head_lay0);
gridlay->addLayout(body_lay1);
w->show();
return app.exec();
}
//END
However, when I change the header layout with another kind (QVBoxLayout for
instance) then the problem seem solved ...
//BEGIN
...
/// init layouts
//QStackedLayout * head_lay0 = new QStackedLayout();
//head_lay0->addWidget(btn0);
QVBoxLayout * head_lay0 = new QVBoxLayout();
head_lay0->addWidget(btn0);
....
//END
This are the screenshots when I use QStackedLayout:
Default
http://img368.imageshack.us/my.php?image=stackedlayoutdefaultls7.png
Resized (problem)
http://img406.imageshack.us/my.php?image=stackedlayoutunexpectedsz8.png
and this are when I use QVBoxLayout
Default
http://img369.imageshack.us/my.php?image=withotherheaderlayoutdeui8.png
Resized (expected)
http://img368.imageshack.us/my.php?image=withotherheaderlayoutexlw1.png
any ideas?
Thanks in advance ; )
Regards,
Percy
[Attachment #5 (text/html)]
Hi all, please I need some help with this issue. When I put 2 QStackedLayouts inside \
of QGridLayout and try to resize the main widget then I got a unexpected behaviour, \
the resize event makes crazy to layouts. This is the code:<br> \
<br>//BEGIN<br>#include <QApplication><br>#include \
<QPushButton><br>#include <QStackedLayout><br><br>int main(int argc, char \
* argv[])<br>{<br> QApplication app(argc, \
argv);<br><br> QWidget * w = new QWidget();<br> \
/// init widgets<br> QPushButton * btn0 = new \
QPushButton("header", w);<br> \
btn0->setMaximumHeight(120); // NOTE<br> QPushButton * btn1 = \
new QPushButton("body", w);<br> /// init layouts<br> \
QStackedLayout * head_lay0 = new \
QStackedLayout();<br> \
head_lay0->addWidget(btn0);<br> QStackedLayout * body_lay1 = new \
QStackedLayout();<br> \
body_lay1->addWidget(btn1);<br> /// init main \
layout<br> QVBoxLayout * gridlay = new QVBoxLayout(w);<br> \
gridlay->addLayout(head_lay0);<br> \
gridlay->addLayout(body_lay1);<br><br> \
w->show();<br><br> return \
app.exec();<br>}<br>//END<br><br>However, when I change the header layout with \
another kind (QVBoxLayout for instance) then the problem seem solved ... <br> \
<br>//BEGIN<br>...<br> /// init layouts<br> \
//QStackedLayout * head_lay0 = new QStackedLayout();<br> \
//head_lay0->addWidget(btn0);<br> QVBoxLayout * head_lay0 = new \
QVBoxLayout();<br> \
head_lay0->addWidget(btn0);<br>
....<br>//END<br><br>This are the screenshots when I use \
QStackedLayout:<br>Default<br><a \
href="http://img368.imageshack.us/my.php?image=stackedlayoutdefaultls7.png">http://img368.imageshack.us/my.php?image=stackedlayoutdefaultls7.png</a><br>
Resized (problem)<br><a \
href="http://img406.imageshack.us/my.php?image=stackedlayoutunexpectedsz8.png">http://img406.imageshack.us/my.php?image=stackedlayoutunexpectedsz8.png</a><br><br>and \
this are when I use QVBoxLayout <br> <br>Default <br><a \
href="http://img369.imageshack.us/my.php?image=withotherheaderlayoutdeui8.png">http://img369.imageshack.us/my.php?image=withotherheaderlayoutdeui8.png</a><br>Resized \
(expected)<br><a href="http://img368.imageshack.us/my.php?image=withotherheaderlayoute \
xlw1.png">http://img368.imageshack.us/my.php?image=withotherheaderlayoutexlw1.png</a><br>
<br>any ideas?<br><br>Thanks in advance ; )<br><br>Regards,<br>Percy<br><br>
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic