PDA

View Full Version : How to make a business application using QT? QTreeWidget, Custom Widget



paulb
12th August 2010, 06:38
hi all,

I want the following interface for my accounting application.

MainWindow
QTreeWidget on the left side
Custom Widget on the right side which is based on the item selected in the
QTreeWidget

My question is how can I determine the item selected and display the corresponding custom widget. Do I need to use 'switch'?

I can't use QTabWidget and QStackedWidget since I need a lot of views.

tbscope
12th August 2010, 06:44
My question is how can I determine the item selected and display the corresponding custom widget. Do I need to use 'switch'?

http://doc.qt.nokia.com/4.6/qtreewidget.html#itemClicked

And what is switch? Do you mean a switch statement?
Why is a stacked widget not possible? You can also try using a stacked layout and create your own stacked widget.

paulb
12th August 2010, 07:15
And what is switch? Do you mean a switch statement?
Ya. for performing an action corresponding to the item selected.


Why is a stacked widget not possible? You can also try using a stacked layout and create your own stacked widget.
but what to do if there are lot of pages in stackedwidget. memory matters.

tbscope
12th August 2010, 07:20
I doubt you get into memory problems unless you want to add thousands of widgets.

You can create a central widget (like in the main window) and set it to the corresponding widget. Unused widgets can then be deleted. Care should be given to prevent data corruption though.