[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: Problem with QGraphicsLinearLayout
From:       Christophe Olinger <olingerc () binarylooks ! com>
Date:       2010-04-19 15:30:30
Message-ID: u2j1718db771004190830x1ca866e9vcd4bd6ed8fd237db () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


At last, the solultion:

Just hadd to remove my child layouts:
    m_layoutHorizontalTop->removeItem(m_layoutTopLeft);
    m_layoutHorizontalTop->removeItem(m_layoutTopMiddle);
    m_layoutHorizontalTop->removeItem(m_layoutTopRight);

Than I added my widgets and then:

    m_layoutHorizontalTop->addItem(m_layoutTopLeft);
    m_layoutHorizontalTop->addItem(m_layoutTopMiddle);
    m_layoutHorizontalTop->addItem(m_layoutTopRight);

Tadaa!

Thanks Alessandro!



2010/4/16 Christophe Olinger <olingerc@binarylooks.com>

> Looks like a problem I've run into as well, it's a bug in Qt:
>>  http://bugreports.qt.nokia.com/browse/QTBUG-6447
>>
>> If you do
>>
>> QGraphicsLinearLayout* m_layout = new QGraphicsLinearLayout(this);
>> m_outerLayout->addItem(m_layout);
>>
>> it'll crash, if you leave the parent out of the constructor:
>>
>> QGraphicsLinearLayout* m_layout = new QGraphicsLinearLayout;
>> m_outerLayout->addItem(m_layout);
>>
>> it should work. (And the parenting will be OK as well, as the addItem()
>> call will
>> reparent m_layout correctly anyway.)
>>
>> Is this the same bug you're running into?
>>
>>
> Unfortunately reparenting or no parents at all didn't change the outcome.
>
> Here is my code: http://pastebin.com/fqszdrK0
>
> - The layouts are initialized in the constructor
> - As soon as I uncomment line 57, the app crashes
> - At line 157 is the function that adds the widgets. At the moment it only
> adds to one layout, but this already causes it to crash if I enable another
> layout.
>

[Attachment #5 (text/html)]

At last, the solultion:<div><br></div><div>Just hadd to remove my child \
layouts:</div><div><div>    \
m_layoutHorizontalTop-&gt;removeItem(m_layoutTopLeft);</div><div>    \
m_layoutHorizontalTop-&gt;removeItem(m_layoutTopMiddle);</div> <div>    \
m_layoutHorizontalTop-&gt;removeItem(m_layoutTopRight);</div><div><br></div><div>Than \
I added my widgets and then:</div><div><br></div><div><div>    \
m_layoutHorizontalTop-&gt;addItem(m_layoutTopLeft);</div><div>    \
m_layoutHorizontalTop-&gt;addItem(m_layoutTopMiddle);</div> <div>    \
m_layoutHorizontalTop-&gt;addItem(m_layoutTopRight);</div><div><br></div><div>Tadaa!</div><div><br></div><div>Thanks \
Alessandro!</div></div><div><br></div><div><br></div><div><br><div \
class="gmail_quote">2010/4/16 Christophe Olinger <span dir="ltr">&lt;<a \
href="mailto:olingerc@binarylooks.com">olingerc@binarylooks.com</a>&gt;</span><br> \
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex;"><div class="gmail_quote"><div class="im"><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"> <div><div>Looks like a problem I&#39;ve run into as well, \
it&#39;s a bug in Qt:</div> </div>
<a href="http://bugreports.qt.nokia.com/browse/QTBUG-6447" \
target="_blank">http://bugreports.qt.nokia.com/browse/QTBUG-6447</a><br> <br>
If you do<br>
<br>
QGraphicsLinearLayout* m_layout = new QGraphicsLinearLayout(this);<br>
m_outerLayout-&gt;addItem(m_layout);<br>
<br>
it&#39;ll crash, if you leave the parent out of the constructor:<br>
<br>
QGraphicsLinearLayout* m_layout = new QGraphicsLinearLayout;<br>
m_outerLayout-&gt;addItem(m_layout);<br>
<br>
it should work. (And the parenting will be OK as well, as the addItem() call will<br>
reparent m_layout correctly anyway.)<br>
<br>
Is this the same bug you&#39;re running \
into?<br><br></blockquote><div><br></div></div><div>Unfortunately reparenting or no \
parents at all didn&#39;t change the outcome.</div><div><br></div><div>Here is my \
code: <a href="http://pastebin.com/fqszdrK0" \
target="_blank">http://pastebin.com/fqszdrK0</a></div>

<div><br></div><div>- The layouts are initialized in the constructor</div><div>- As \
soon as I uncomment line 57, the app crashes</div><div>- At line 157 is the function \
that adds the widgets. At the moment it only adds to one layout, but this already \
causes it to crash if I enable another layout. </div>

</div>
</blockquote></div><br></div></div>



>> 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