[Qt-interest] How add a QTreeView widget to a QTabBar?
Ed Sutton
edsutton at gmail.com
Wed Jul 29 18:01:23 CEST 2009
Hi Raja,
[ I am resending using my gmail as our Exchange server seems to being having
trouble sending to qt-interest at trolltech.com ]
Thank you very much for the very helpful reply. I had read something that
made me think QTabBar was a new improved version of QTabWidget. However,
QTabWidget does exactly what I needed with your help.
>I assume you want to add a tab in the QTabBar in which the QTreeView will
be shown when that tab is clicked? If so..
>QTabBar provides only a bar with tabs on it and doesn't enclose any other
widgets inside it. So if you want to use
>a tab interface where each tab encloses other widgets, you must use
QTabWidget. So your code will be like this:
>modelGoodDevices = new DomModel(QDomDocument(), this);
>thetabs = new QTabWidget(this);
>viewGoodDevices = new QTreeView(this);
>thetabs->addTab(viewGoodDevices,"Good Devices");
>Alternatively you may use a QTabBar for accomplishing the exact same but
you must do it conjunction with QStackedWidget
>or QStackedLayout. In these two, you can add some widgets to them but only
one will be visible.You can use the void currentChanged(int index)
>signal emitted by the QTabBar when a tab is clicked to switch the
QStackWidget/QStackLayout to the
>appropriate widget.
Thanks. I will investigate the QStacked option, it may be handy in the
future.
Thank you very much for your time and assistance!
-Ed
With Regards,
Raja Sekharan
http://www.expeditionpost.com
Ed Sutton wrote:
How do I add a QTreeView to a tab on a QTabBar ?
modelGoodDevices = new DomModel(QDomDocument(), this);
qtabBar = new QTabBar(this);
viewGoodDevices = new QTreeView(this);
qtabBar->addTab(“Good Devices”);
qtabBar->addTab(“Failed Devices”);
// How do I add viewGoodDevices to the “Good Devices” tab?
Thanks in advance,
-Ed
------------------------------
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090729/359cc3d1/attachment.html
More information about the Qt-interest-old
mailing list