[Qt-interest] dockwidget problem

Malyushytsky, Alex alex at wai.com
Wed Oct 20 21:35:37 CEST 2010


Great way to learn how to design ui  - is to do it in Qt Designer and then study the code generated.

At the first glance you need  :
- change the way you allocate QDockWidget ( I expect it does not live long enough to be displayed) ;
- remove show() and addDockWidget

Something like this:
        dockWidgetContents = new QTreeWidget();

        dockWidget = new QDockWidget( mainWindow );
        dockWidget->setWidget(dockWidgetContents); /* will also set dockWidget as a parent for dockWidgetContents */

        mainWindow->addDockWidget(static_cast<Qt::DockWidgetArea>(1), dockWidget);


Regards,
   Alex



From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Sujan Dasmahapatra
Sent: Wednesday, October 20, 2010 2:29 AM
To: qt-interest at trolltech.com
Subject: [Qt-interest] dockwidget problem

Dear Friends
In my QMainwindow i have QGraphicsView and QTreeWidget, I want these widgets to dockable and resizable, I am trying like this

QTreeWidget *treeWidget = new QTreeWidget(this)
QDockWidget dock(this,QT::Window);
dock.setWidget(treeWidget);
dock.show();

QGraphicsView *view = new QGraphicsView(this)
QDockWidget dock(this,QT::Window);
dock.setWidget(view);
dock.show();

But this is not working can someone give me some hints how could I achieve this. Thanks in advance


Kind Regards,


Sujan Dasmahapatra
Project Leader, Aero Group
Aero Group
Tel    +91 80 66470248
Mob
sdh at lmwindpower.com


LM Wind Power Blades
lmwindpower.com
________________________________________

This e-mail and any attachments are confidential. If you are not the named or intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Any unauthorized disclosure, use or storage is prohibited and might be unlawful.


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