Navigation

    Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Search
    1. Home
    2. Tags
    3. qtreewidget
    Log in to post

    • SOLVED Add TreeWidget item from another dialog
      General and Desktop • qmainwindow qdialog qlineedit qtreewidget • • HenrikSt.  

      3
      0
      Votes
      3
      Posts
      341
      Views

      Thanks, mrjj! That's it! Merry christmas
    • UNSOLVED QTreeView in QTreeWidgetItem
      General and Desktop • qtreeview qtreewidget qtreewidgetitem adjusttocontent • • Craetor  

      8
      0
      Votes
      8
      Posts
      1224
      Views

      @JonB This code is a small example to find solution. In my real project i need to show tree with different items and nested trees.
    • SOLVED Configuring checkbox when using QTreeWidget
      General and Desktop • pyqt5 qtreewidget checkbox • • MATTK  

      4
      0
      Votes
      4
      Posts
      4898
      Views

      @MATTK said in Configuring checkbox when using QTreeWidget: is this a bug or a known issue from Qt Designer? No, it's 100% intended behaviour. the condition is checked here You have 2 options: set the Qt::CheckStateRole for the indexes you want to have a checkbox. In your widget constructor you'd call something like setUnchecked(ui->treeWidget->model()); void setUnchecked(QAbstractItemModel* model, const QModelIndex& parent = QModelIndex()){ if(!model) return; for(int i=0, maxRow=model->rowCount(parent);i<maxRow;++i){ for(int j=0, maxCol=model->columnCount(parent);j<maxCol;++j){ const QModelIndex currIdx = model->index(i,j,parent); model->setData(currIdx,Qt::Unchecked,Qt::CheckStateRole); if(model->hasChildren(currIdx)) setUnchecked(model,currIdx); } } } subclass the delegate to check the flag instead of Qt::CheckStateRole and call something like ui->treeWidget->setItemDelegate(new CheckFlagDelegate(this)); in your widget constructor class CheckFlagDelegate : public QStyledItemDelegate{ Q_OBJECT Q_DISABLE_COPY(CheckFlagDelegate) public: explicit CheckFlagDelegate(QObject* parent = Q_NULLPTR) : QStyledItemDelegate(parent){} protected: void initStyleOption(QStyleOptionViewItem *option, const QModelIndex &index) const Q_DECL_OVERRIDE{ QStyledItemDelegate::initStyleOption(option,index); if(index.model()->flags(index) & Qt::ItemIsUserCheckable) option->features |= QStyleOptionViewItem::HasCheckIndicator; } }; Since the functionality is defined in a QObject (the delegate) and not in a QWidget this is not something designer can and probably ever will manage
    • UNSOLVED Padding/Margin is not applied to last two elements in QTreeView
      General and Desktop • stylesheet qtreeview qtreewidget • • JoseTomasTocino  

      6
      0
      Votes
      6
      Posts
      2466
      Views

      A late reply, but it looks like those elements are different in that they don't have children. Have you checked that you don't have a style with QTreeView::item:!has-children { padding: ... } defined anywhere which could be overriding the style when applied at the branch level?
    • UNSOLVED How to release memory in QTreeWidget.
      General and Desktop • qtreewidget qtreewidgetitem • • rohit713  

      7
      0
      Votes
      7
      Posts
      1226
      Views

      treeWidget->model()->removeRows(0,treeWidget->model()->rowCount()); clears the widget of all items and deletes them freeing the memory (see the sources if you don't believe me). Be aware that it's difficult to assess memory usage live in debug mode as the OS might keep the memory allocated for a while after you call delete
    • UNSOLVED QTableView vs subclassing QAbstractTableModel
      General and Desktop • qtableview qtreewidget modelview qabstracttablem • • Electric-Gecko  

      4
      0
      Votes
      4
      Posts
      2778
      Views

      You can use either QTreeWidget, QTableWidget, QTreeView+QStandardItemModel, QTableView+QStandardItemModel, QTreeView+QAbstactTableModel subclass, QTableView+QAbstactTableModel subclass for what you are trying to do. I would go with a QT*View+QStandardItemModel (tree or table doesn't matter). The functionalities you describe are: only some columns will be editable use QStandardItem::setFlag Entering a value in the cents column (a logarithmic measure of frequency) will change the value in the hertz column, and vice versa connect a slot to QStandardItemModel::dataChanged signal There will be a button next to the table to add an additional note to the scale connect a slot that calls QStandardItemModel::insertRows to the QPushButton::clicked signal
    • UNSOLVED Drag and Drop to a QTreeWidget subclass
      General and Desktop • drag and drop qtreewidget • • jcga  

      2
      0
      Votes
      2
      Posts
      533
      Views

      Hi, You should share the code of your MyWidgetTree class. That way it will make things easier to analyse.
    • SOLVED Problem with QTreeWidget Stylesheet
      General and Desktop • stylesheet qtreewidget background transparent selected item • • QT-static-prgm  

      14
      0
      Votes
      14
      Posts
      12942
      Views

      I was always searching at the wrong place. The blue hue wasn't a problem of the style, it was a problem of the icon. Here is the solution: for all icons m_clientIcon.normal.addFile("plugins\\qtTsOverlay\\client.png"); add this m_clientIcon.normal.addFile("plugins\\qtTsOverlay\\client.png", QSize(), QIcon::Selected);
    • UNSOLVED QTreeWidget with connecting lines for the tree branches
      General and Desktop • qtreewidget • • floatingWoods  

      5
      0
      Votes
      5
      Posts
      4180
      Views

      Again, thanks a lot for your help :)
    • UNSOLVED Animating opacity of QTreeWidget
      General and Desktop • c++ qtreewidget qgraphicseffect • • onesys  

      21
      0
      Votes
      21
      Posts
      5399
      Views

      @mrjj Thank you for your time. I'll investigate further and report if I find any. If anyone else knows anything of this inconsistent behavior please do reply.
    • UNSOLVED All problems I need help about QTreeWidget and QToolBar
      General and Desktop • qtoolbar qtreewidget • • nashge  

      7
      0
      Votes
      7
      Posts
      1830
      Views

      Depending on your needs you might be interested by DevMachines's QTitanRibbon which seems to be doing what you want. Note that it's a commercial product. What exactly are you trying to achieve with putting the scroll bar to the left ? There are already several applications written in QML for desktop. It really depends on what you want to do.
    • SOLVED QTreeWidget - Header always invisible
      General and Desktop • qtreewidget • • Andy314  

      13
      0
      Votes
      13
      Posts
      3036
      Views

      With my new installation Creator 3.6.0 (new version) and Qt 5.5.1 (same version as before) it works now.
    • UNSOLVED QTreeWidget editItem()
      General and Desktop • qtreewidget editable • • Lorence  

      5
      0
      Votes
      5
      Posts
      2292
      Views

      You might be getting the value before it has been transferred to the model
    • UNSOLVED catching keypressevent in void QTreeWidget::editItems();
      General and Desktop • qtreewidget • • Lorence  

      2
      0
      Votes
      2
      Posts
      791
      Views

      Hi You can try with eventfilter on the QTreeWidget.
    • SOLVED How can I handle the columns of a QTreeWidgetItem as a single entity?
      General and Desktop • qt5 qtreewidget qtreewidgetitem • • Jakob  

      3
      0
      Votes
      3
      Posts
      716
      Views

      After disabling a whole bunch of Windows policies suddenly I get the desired behaviour.... that is surprising. I still don't know the root cause, but I'll postpone looking further until the problem reappears
    • SOLVED How to style the background of a QTreeWidget?
      General and Desktop • qt5 stylesheet qtreewidget • • Jakob  

      2
      0
      Votes
      2
      Posts
      1800
      Views

      It turns out the style was overwritten by a style appearing at the end of the stylesheet...... bummer
    • UNSOLVED QTreeWidget with Tristate
      General and Desktop • qtreewidget tristate • • bcl79  

      3
      0
      Votes
      3
      Posts
      1309
      Views

      That worked. I knew it had to be something simple. Thanks.
    • SOLVED Qt5: Styling the checkbox of a checkable QTreeWidgetItem
      General and Desktop • qt5 stylesheet qtreewidget qtreewidgetitem • • Jakob  

      2
      0
      Votes
      2
      Posts
      2428
      Views

      As it turned out, one must explicitly say QTreeView::indicator:unchecked in order to set the general settings like background color for this checkbox. That was a bit surprising, as this is not needed for instance for QCheckbox::indicator or QGroupBox::indicator, but the solution is now here for posterity
    • QTreeWidget multiple sorts
      General and Desktop • qtreewidget sort • • Mailchuck  

      2
      0
      Votes
      2
      Posts
      923
      Views

      I figured it out, that information is the header of the QTreeWidget. So, the code to extract this value from within a QTreeWidgetItem is: self.treeWidget().header().sortIndicatorOrder() and this you can check for being equal to Qt.DescendingOrder (or Qt.AscendingOrder if you prefer).
    • How to save editing item text of QTreeWidget by writing some code?
      General and Desktop • qtreewidget • • JohnYork  

      1
      0
      Votes
      1
      Posts
      545
      Views

      No one has replied

    • Automatically highlight the first row of Qtreewidget?
      General and Desktop • c++ linux qtreewidget item row highlight • • marlenet15  

      2
      0
      Votes
      2
      Posts
      1339
      Views

      Hi, You are looking for QTreeWidget::setCurrentItem
    • [SOLVED] Qt Creator : How to list files and directories to Tree widget which placed in a stacked widget page
      Mobile and Embedded • qtcreator qtreewidget directory qt5.2.1 file navigation • • Ajith_P_V  

      4
      0
      Votes
      4
      Posts
      4446
      Views

      @SGaist Thank you once again! Now, I can manage to display the folder list inside the stacked widget page using QTreeView + QFileSystemModel combo!
    • Qtreewidget prevent duplicate parents
      General and Desktop • qtreewidget qtreewidgetitem • • Bart  

      5
      0
      Votes
      5
      Posts
      2040
      Views

      @Bart Hi, please put QHash<QString, QTreeWidgetItem * > Parents; outside the for loop. Also, you say if(blades.contains(ArraySet1[i][0])) Should that not be Parents? Anyway, when Contains is true, you do not create a new QTreeWidgetItem but instead use the one you store in the hash list. that way you will connect to the same Parent (the first one) when you see the same name again. We use the list to keep track of ParentName, and the QTreeWidgetItem that we created with that name. so if(blades.contains(ArraySet1[i][0])) { QTreeWidgetItem *y = new QTreeWidgetItem(); y>setText(0,ArraySet1[i][1]); x->addChild(y); <----------------- x here should be the parent you stored in the hash list } becomes if(Parents.contains(ArraySet1[i][0])) { QTreeWidgetItem *NewChild = new QTreeWidgetItem(); NewChild>setText(0,ArraySet1[i][1]); QTreeWidgetItem *StoredParent =Parents.value(ArraySet1[i][0]); StoredParent ->addChild(NewChild) } else { // create the new parent and store in list QTreeWidgetItem *x = new QTreeWidgetItem(ui->treeWidget); x->setText(0,ArraySet1[i][0]); ui->treeWidget->addTopLevelItem(x); Parents->Insert( ArraySet1[i][0], x ); // store our parent under that name QTreeWidgetItem *y = new QTreeWidgetItem(); y->setText(0,ArraySet1[i][1]); x->addChild(y); QTreeWidgetItem *z = new QTreeWidgetItem(); z->setText(0,ArraySet1[i][2]); y->addChild(z); l } something like that. Hope it makes sense. ps. did not try to compile so might be syntax errors.
    • Bug with Qt 5.4.1 drag and drop between two QTreeWidgets
      General and Desktop • qt 5.4.1 drag and drop bug qtreewidget • • zcoder  

      1
      0
      Votes
      1
      Posts
      738
      Views

      No one has replied

    • Looping thru QTreeWidget items extremly slow
      General and Desktop • performance qtreewidget • • EMC3  

      3
      0
      Votes
      3
      Posts
      2134
      Views

      Looping is not slow, what takes time is string comparison, cause you basically do brute force string searching. As Chris mentioned in normal circumstances this can't lag your GUI. But if you fill your tree with huge number of data there might be a few performance problems. Possible solutions: a) QTreeView with custom model may be faster for multiple reasons including no need for frequent memory allocation and reduced data duplication. b) Consider using additional data structure ( temporary or permanent) to speed up large modifications. Example will be usage of hash table which will speed up your search. But keep in mind that maintenance of such data structure may actually make it even slower depending on your usage case.
    • How to delete all QTreeWidgetItems having the same text as selected QTreeWidgetItem?
      General and Desktop • qtreewidget qtreewidgetitem • • WDR_937  

      24
      0
      Votes
      24
      Posts
      6948
      Views

      @SGaist Oh, OK... Then I'll implement that too and see how it goes. Thanks.