[Qt-interest] How to dynamic add child from file

hhocean hhocean at gmail.com
Mon Jun 21 14:58:29 CEST 2010


Hello

I have a project for dynamic changing UI. I write some codes below

----codes--------
QStackedWidget *ui = new QStackedWidget();

if (!isAlloc(ui_numer)) {
  UIWidget *page = new UIWidget(ui_number);
  ui->addWidget(page);
}

ui->setCurrentWidget(page);
--------------------

When created a new UIWidget that inherit QWidget class, the program will
load a ui layout from a file and dynamic create Qt Objects that include
qlable, qpushbutton and qimage..etc. This project has more than 100 ui
layout file. The action of changing UI was happend in every touch event.
This project run smoothly in most time. But it'll crash in sometimes. I used
gdb to trace the segmentation that occur in *setUpdatesEnabeled_helper(bool
enable)* of qwidget.cpp. I have no sense about this issue. Maybe my thought
is wrong for dynamic changing widget logic?
Anyone can give me suggestions?
Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100621/eddd818a/attachment.html 


More information about the Qt-interest-old mailing list