is it possible to put a customize gtkwidget in a gtktreeview? - qt

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

Related

Qt: how to add a close and minimize button to a widget, that is embedded into another widget?

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

how to use QGroupBox in place of QButtonGroup

I'm trying to figure out how to use the QGroupBox widget in place of the QButtonGroup widget as the qt docs (link below) 'strongly advise against using it'.
https://doc.qt.io/archives/qt-4.7/q3buttongroup.html
The QButtonGroup had a handy method called QtGui.QButtonGroup.checkedButton() and I'm looking for a way to find the checked radio button contained in the QGroupBox. What is the new best practice for this?
The QButtonGroup Still exists and is in use only its implementation has changed and is no longer a Widget. In qt designer the QButtonGroup is no longer in the widget menu, you now select the buttons you wish to associate with a group and right click to add a QButtonGroup.

Qt: How to create a setting window like in GTK

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.

How to Remove Toolbar from QToolBox control in Qt?

How to Remove Toolbar from QToolBox in Qt?
Normal Toolbox looks like this:
I want to remove this button written with Page 1. Something like this :
I'm not sure if this makes much sense, since those buttons are needed for the functionality of the QToolBox. If you want a stack of widgets for which you can manually control if they are shown or not, then QStackedWidget provides similar functionality without displaying any elements of its own.
edit: No, as the QToolBox it doesn't come with a scrollbar. But since you 'fill' it with widgets of your own, which then are displayed with setCurrentWidget, you can use for example QScrollArea and placing your own widgets inside it.

Need help on basic Qt structure

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.

Resources