In Qt 4.8 I want to create a window that looks like the following.
please note that my main concern is the tab-like behaviour of left-side icon+text combination.
The question is what would you recommend me to achieve that look? A QListWidget or a customized QTabWidget?
thanks
Qt Creator - which is written in Qt - has a settings page which might just be what you want:
I would look into the source code of that at http://qt.gitorious.org/qt-creator/qt-creator/trees/master
[Edit]
Found the relevant class here:
https://github.com/qt-creator/qt-creator/tree/master/src/plugins/coreplugin/dialogs
It is the class SettingsDialog. The GUI is setup in createGUI, they are not using an UI file actually.
This class is using a QListView on the left-hand side and a QStackedLayout with several QTabWidgets inside it on the right-hand side
I'd go with a QListWidget on the left connected to a QStackedWidget on the right.
Items in a QListWidget(View) can have icons on their left, selection can be exclusive (single selection) and when clicked emit signals which can change the current widget shown in the QStackedWidget.
Related
Qt's QMainWindow has a ability to dock windows derived from QDockWidget. It also would put one on top on the other if few of them are stacked, producing a tab bar. Whenever a QDockWidget's state changes a signal topLevelChanged() is emmitted. At this point I would like to get access to underlying QTabWidget to set an icon for a a newly added tab. How can I do it? My patience is over trying to dig the answer out from Qt's documentation and source code. Thank you in advance.
So icon I want to be on Contents/Index tabs.
Once at least one dockwidget has been tabified, the main-window will create a QTabBar to provide the dock-tabs. Each dock-area can have its own tab-bar. These tab-bars will become children of the main-window, so you can use findChildren() or children() to get references to them.
The main difficulty will be in finding which dock-widget belongs to which tab and in which tab-bar. If the dock-widget window-titles are all unique, you can just search using the tabText(). Otherwise, you might be able to use the tabData(), which Qt sets internally to a quintptr from the dock-widget.
Once you have the correct tab, you can of course use setTabIcon() to add your icon. But note that every time a dock-widget is untabified or moved to another tab-bar, the icon will be lost.
I want to embed some widgets into anothe Qt widget (into docking widget, for example). But I want to let user minimize or close them (just like the widgets on the right half of the picture)
Can you tell me, how can it be done?
You can implement it by using the QMdiArea
Read this blog How to tile widgets in a MDI application
here is Qt example code
The Qt desktop application I am required to develop has the following GUI:
The application window is split into 3 parts -
left-side window - has a stack of clickable menu items one below the other. Clicking on each item will show up the corresponding UI elements on the prominent right-side window which is much bigger.
right-side window - contains UI to display some data depending on which menu item is clicked on the left-side window. Each left-side window menu item has a different corresponding right-side window UI.
top (header) window - contains some company "brand" related graphics and also a panel to select a serial port from a list along with graphics to represent connect/disconnect status.
How do I develop this kind of UI? What Qt classes should I be using? I'm a beginner to Qt and would deeply appreciate any help. Thank you.
I'd suggest starting in Qt Designer or Qt Creator to create your UI by dragging and dropping different kinds of objects. Qt Designer is a standalone form designer where Qt Creator is full development environment that also includes the functionality of Qt Designer. Using the form designer is a lot easier, particularly when starting out, than creating widgets programmatically.
There's multiple ways to do the list of items on the left. You can use a QListWidget or a series of individual QPushButton instances, one per option. If the list of items changes, then managing the QListWidget content is going to be easier than instantiating a QPushButton for each item, but you might like the appearance of the QPushButton better. It just depends on what you want.
For the right side, look into QStackedWidget. It's specifically designed to display a stack of content where only one item is available at a time.
For the top panel, again, use the form designer to create the layout. You can store an image in a QLabel. A QComboBox might be what you want for the list, or again, you may want a QListWidget. It just depends on what appearance and user experience you're looking for. For the connect/disconnect status, you can use a QLabel and change out the graphics as the status changes.
You'll need to learn about slots and signals; those are crucial to anything Qt-related.
I'm learning GTK+ in this moment (after Qt) just to know what is possible with it thus Qt is for digia. Put a custom widget in a QListWidget is possible so I want to know if it is possible to do something like that using GTK+. An example of this widget could be one pixmap, one label and one button all in the same Cell and layout with a container like Gtktable.
Thanks
Yes, of course. You just need a "custom cell renderer":
http://scentric.net/tutorial/ch-treeview.html
http://gtk.php.net/manual/en/html/tutorials/tutorials.treeview.view.html
Hi I am a Qt beginner. I want to make something like a column of icons on the left, after click the icons different forms and results appear on the right, how can I do this? Should I choose QMainWindow or QWidget for this project?
should I choose mainwindow or widget for this
project?
If what you described are the only things present in the window, you should use a QMainWindow. If you think you will want to re-use this arrangement in the future, I'd use a QWidget. It will probably be easier to implement each set of forms as a separate QWidget (in Designer; if you're building the GUI programmatically, just add the forms to a QLayout in a QFrame).
a column of icons on the left, after click the icons different
forms and results appear on the right
For the column of icons, you should look at QListWidget. It provides a vertical list of QListWidgetItems, and the items can contain icons, and nothing else. Your main window can then connect to the list widget's currentItemChanged signal (or itemChanged or something else; there are several choices), and modify the forms in the right-hand side of the window appropriately.