[Qt-interest] QGridLayout addWidget
Leonardo M. Ramé
l.rame at griensu.com
Wed Sep 29 13:48:43 CEST 2010
Thanks Alex, indeed, I was using a QHash<int, QMyWidget *>.
Why don't you think it's a good idea to make a QHash? I need a
collection-like object where I can search items by an identifier, and
QHash seems to be doing the job.
Anyway, the SigSegv is still there :(.
--
Leonardo M. Ramé
http://leonardorame.blogspot.com
On 2010-09-27 18:31:28 -0700, Malyushytsky, Alex wrote:
> Your code look suspicious.
>
> First You can't insert pointer (obtained from new QMyWidget() ) into
> QHash<int, QMyWidget>, second I don't think it is a good idea to make QHash from the QObject.
>
> You may try to use QHash<int, QMyWidget*> as a storage.
> If you already done so find the reason you get SigSegv.
>
> Alex
>
>
>
> -----Original Message-----
> From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Leonardo M. Ramé
> Sent: Monday, September 27, 2010 12:12 PM
> To: Qt Interest
> Subject: [Qt-interest] QGridLayout addWidget
>
> Hi, I'm trying to replace the widget of a "cell" in a QGridLayout,
> but if I use the code below, I get a SigSegv:
>
> myLayout->addWidget(m_widgets.value(0), row, col);
>
> m_widgets is a QHash<int, QMyWidget>, where I have inserted one item
> using insert(0, new QMyWidget()).
>
> The layout is a 3x3 grid, so I want to replace the cell (row, col) with
> a different widget.
>
> How can I do this?.
>
> --
> Leonardo M. Ramé
> http://leonardorame.blogspot.com
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
> ---------------------------------------------------------------------------------------------------
> Weidlinger Associates, Inc. made the following annotations.
>
> “This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you.”
>
> “Please consider our environment before printing this email.”
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
More information about the Qt-interest-old
mailing list