Qt Combo box with Check able not working - qt

I have created a QCombobox with checkable items in Qt according to this link. But it works only when i apply QPlastiqueStyle .This style does not work in QT5. What should i do to solve this problem?

The way that I found to solve this problem was to create a custom Widget using QListWidget and QButtons and then promoting my QCombobox to the Custom widget.

Related

QT Arbitrary View Widget

plz click here to show the image
I want to create a set of UI like this.
I don't have source code, but I knew it's done by QT.
So I guess, overall, this is QTreeView
but how is its ChildWidget done?
All the child are different,
There are QCheckBox,
There are QLabel + QLineEdit
There are QTreeView too.
So I want to know how the child widgets are created and inserted to the QTreeView?
Thank you!
http://doc.qt.io/qt-5/modelview.html
ChildWidget are created by delegate. You can read more about delegate in Qt Model/View architecture

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

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

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.

Customize List View Item in Nokia Qt App

I am writing a simple file browser app with Nokia Qt4.7 on Symbian^3 platform. I can display the directory/file list in the listview widget using QFileSystemModel. But I want to customize the list view item. And I am using QItemDelegate to do the trick overriding sizHint and paint functions. I want to display a checkbox in the end of every item (ListMode) or in the right down corder of the icon(IconMode). How can I do it?
Thanks.
I'd suggest you to reimplement QItemDelegate::paint function and use QStylePainter and use QStylePainter::drawControl to render checkbox element. Depending on the mode you can vary your painting.
You can also do this using QML . Styling rows is much easier in QML.
To be more specific your Model will still be c++ . Only the list can be in QML.

How to customize a listview in Qt

I want to customize a listview in Qt, can anyone provide me some example or hints of how to do it? I am new to Qt.
You can apply stylesheet to your QListView.
Check out here for the Qt documentation of customizing QListView using stylesheets.
If you're using a standard item model or a QListWidget (or any other model that uses QStandardItem), you can set appearance properties on the items using setData.
So, The following will add a red item to a list widget:
QListWidgetItem *colorItem = new QListWidgetItem("Red");
colorItem->setData(QBrush(QColor(Qt::red)), Qt::ForegroundRole);
list.addItem(colorItem);
For a working code example and more detailed explanation, please see: http://ynonperek.com/qt-mvc-customize-items

Resources