python,pyqt,pyqt4,python-3.3,qtreewidget
Using itemClicked signal: class window(QtGui.QMainWindow): def __init__(self, parent=None): super(window, self).__init__(parent) self.TreeWidget = QtGui.QTreeWidget() self.TreeWidget.setColumnCount(1) # self.item1/2/3 = .... save reference to the items # to access them in the callback (check_status) item1 = self.item1 = QtGui.QTreeWidgetItem(["Item 1"]) item1.setCheckState(0, QtCore.Qt.Checked) item2 = self.item2 = QtGui.QTreeWidgetItem(["Item 2"]) item2.setCheckState(0, QtCore.Qt.Unchecked) item3 = self.item3...
python,pyside,qtreeview,qtreewidget,qabstractitemmodel
Here's your QTreeWidget example, simplified: import sys from PySide import QtCore, QtGui class File_List( QtGui.QTreeWidget ): def __init__( self, parent=None): super( File_List, self ).__init__( parent ) self.setColumnCount(2) self.setHeaderLabels(["name","date"]) self.get_contents() def get_contents( self): self.clear() contents = ["path1","path2"] for path in contents: date = self.get_date(path) self.add_item(path,date) def add_item(self, name, date): item =...
qt,stylesheet,qtreewidget,qtreewidgetitem,qstyle
AFAIK stylesheet is not a panacea for everything. You want very specific thing so you should look deeper and use something more powerful. I suggest you to use delegate. You didn't provide specification, so I provide main idea. In QStyledItemDelegate subclass reimplement paint. For example: void ItemDelegatePaint::paint(QPainter *painter, const QStyleOptionViewItem...
I've implemented two solutions, you'll need to comment/uncomment the code. The result is the same in both case. Solution 1 is based on the reference of the asset you are using in PublishInfoUI class and. Once you press "OK", the modifcations are done inside the PublishInfoUI class on self.assets. On...
c++,qt,qtgui,qstring,qtreewidget
This solution does not avoid duplicate, so if you need that in the future, you could extend this piece of code with adding valiation for that. Anyway, this code produces the exact ame output for me that you have just described to wish to have. main.cpp #include <QTreeWidget> #include <QStringList>...
I think this is what you meant: UI has in a layout: Label, QTreeWidget, Label, Spacer (Spacer is important becaus else Qt might just expand the labels to fill the window.) Important: In Designer TreeWidget hight to preffered, vertical scrollbar off. UI Example: <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> <class>MainWindow</class> <widget...
qt,qtreeview,qtreewidget,qtreewidgetitem
This is a focus rectangle. To completely disable it: setFocusPolicy(Qt::NoFocus) ...
qt,design-patterns,treeview,qtreewidget,model-view
If your data is stored in a database model or if you want to have a single data model and show it in some views in different ways, then you are definitely better to go with QTreeView. But QTreeWidget has it's internal model in some way along with the methods...
c++,qt,qtreewidget,qtreewidgetitem
You can do the signal slot connection like below connect(this, SIGNAL(itemExpanded(QTreeWidgetItem*)), this, SLOT(onSubTreeDisplay(QTreeWidgetItem*))); Then inside onSubTreeDisplay(), dynamic cast QTreeWidgetItem argument to MyQTreeWidgetItem like below void onSubTreeDisplay(QTreeWidgetItem* item) { MyTreeWidgetItem* myItem = dynamic_cast<MyTreeWidgetItem*>(item); if (myItem) { //cast is successful. you can use myItem } } ...
python,qt,pyqt,pyside,qtreewidget
The itemClicked signal is not a good choice for handling treewidget checkboxes. On the one hand, it gives false positives when not clicking on the checkbox part of an item; and on the other hand, it gives false negatives when the checkbox is toggled using the keyboard. I think the...
qt,pyqt,pyqt4,qlistwidget,qtreewidget
to list items in groups here a simalar question: How to list items as groups in QListWidget if headeritems and normal items are different in one property they can be handled differently in slot. I'm not quite certain, if it's the way you want. I tried to place checked items...
Call treeWidget->header()->setStretchLastSection(false); at the initialization and treeWidget->resizeColumnToContent(column); each time your adding a column....
qt,qtreewidget,qtreewidgetitem,qitemdelegate
You can access the QTreeWidget from you delegate's paint routine to check if a condition for painting the background is met void custom_delegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const { const QTreeWidget* tree_widget = qobject_cast<const QTreeWidget*>(qstyleoption_cast<const QStyleOptionViewItemV3*>(&option)->widget); .... } or you store something in the QModelIndex UserData as...
Simply invoke setMouseTracking() to enable mouse tracking for a specific widget.
I found the solution: My first code was this QTreeWidgetItem* newVtxItem = new QTreeWidgetItem(parentItem); newVtxItem->setText(0, "vtx 1"); newVtxItem->setText(1, "-1"); childOfNameProfile->insertChild(0,newVtxItem); Then I correct it by deleting the parentItem of the new QTreeWidgetItem in this way: QTreeWidgetItem* newVtxItem = new QTreeWidgetItem(); newVtxItem->setText(0, "vtx 1"); newVtxItem->setText(1, "-1"); childOfNameProfile->insertChild(0,newVtxItem); The reason why the...