[Interest] QGraphicsWidget and QWidget Dialog Windows...

BRM bm_witness at yahoo.com
Tue Jun 18 20:56:14 CEST 2013


I have a program that is using a QSceneGraph and a series of custom QGraphicsWidgets.
I now want to use a QProgressDialog as a top-level window (_not_ embedded in the QSceneGraph) from within the QGraphicsWidget.
My code is calling the hide/show on the QProgressDialog instance, but I don't see anything at run-time.

I first just used the QProgressDialog on its own; and the program worked at run-time but without the dialog showing; stopping the program would, however, cause it to crash.
So I looked at QGraphicsProxyWidget and wrapped it with that - which prevents the crashes but doesn't otherwise solve the issue.

My goal is to have the QProgressDialog widget pop-up while the program does a background task, then go away when its done.
I don't want it as part of the QGraphScene - more as a modal window.

Some example code of what I am basically doing:

class myGraphicsWidget : public QGraphicsWidget {
...
QProgressDialog progressDlg;
QGraphicsProxyWidget proxyProgressDlg;
...
};
...
myGraphcisWidget::myGraphicsWidget(QGraphicsItem* _parent) : QGraphicsWidget(_parent), progressDlg(NULL) {
proxyProgressDlg.setWidget(&progressDlg);
}
...
void myGraphicsWidget::someSignal1(int _someValue) {
progressDlg.show();
progressDlg.setMaximum(_someValue);
}
...
void myGraphicsWidget::someSignal2(int _progress) {
progressDlg.setValue(_progress);
}
...
void myGraphicsWidget::someSignal3() {
progressDlg.hide();
}
...

I'm sure that I must be doing something wrong, but I'm not sure what...I haven't tried this before with QGraphics functionality.

Ben
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130618/8c5ad544/attachment.html>


More information about the Interest mailing list