[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 &lt;QApplication&gt;<br>#include \
&lt;QPushButton&gt;<br>#include &lt;QStackedLayout&gt;<br><br>int main(int argc, char \
* argv[])<br>{<br>&nbsp;&nbsp;&nbsp; QApplication app(argc, \
argv);<br><br>&nbsp;&nbsp;&nbsp; QWidget * w = new QWidget();<br> &nbsp;&nbsp;&nbsp; \
/// init widgets<br>&nbsp;&nbsp;&nbsp; QPushButton * btn0 = new \
QPushButton(&quot;header&quot;, w);<br>&nbsp;&nbsp;&nbsp; \
btn0-&gt;setMaximumHeight(120); // NOTE<br>&nbsp;&nbsp;&nbsp; QPushButton * btn1 = \
new QPushButton(&quot;body&quot;, w);<br>&nbsp;&nbsp;&nbsp; /// init layouts<br> \
&nbsp;&nbsp;&nbsp; QStackedLayout * head_lay0 = new \
QStackedLayout();<br>&nbsp;&nbsp;&nbsp; \
head_lay0-&gt;addWidget(btn0);<br>&nbsp;&nbsp;&nbsp; QStackedLayout * body_lay1 = new \
QStackedLayout();<br>&nbsp;&nbsp;&nbsp; \
body_lay1-&gt;addWidget(btn1);<br>&nbsp;&nbsp;&nbsp; /// init main \
layout<br>&nbsp;&nbsp;&nbsp; QVBoxLayout * gridlay = new QVBoxLayout(w);<br> \
&nbsp;&nbsp;&nbsp; gridlay-&gt;addLayout(head_lay0);<br>&nbsp;&nbsp;&nbsp; \
gridlay-&gt;addLayout(body_lay1);<br><br>&nbsp;&nbsp;&nbsp; \
w-&gt;show();<br><br>&nbsp;&nbsp;&nbsp; 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>&nbsp;&nbsp;&nbsp; /// init layouts<br>&nbsp;&nbsp;&nbsp; \
//QStackedLayout * head_lay0 = new QStackedLayout();<br>&nbsp;&nbsp;&nbsp; \
//head_lay0-&gt;addWidget(btn0);<br>&nbsp;&nbsp;&nbsp; QVBoxLayout * head_lay0 = new \
                QVBoxLayout();<br>&nbsp;&nbsp;&nbsp; \
                head_lay0-&gt;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