[Qt-interest] QGridLayout addWidget

Malyushytsky, Alex alex at wai.com
Tue Sep 28 03:31:28 CEST 2010


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




More information about the Qt-interest-old mailing list