Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to access QTreeWidget items added using qt Creator gui builder
Forum Updated to NodeBB v4.3 + New Features

How to access QTreeWidget items added using qt Creator gui builder

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 2.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    adnan
    wrote on last edited by
    #1

    I created a tree using Qt Creator and added items and children using GUI only. Now I wish to access those. I can only check which item is selected using current Item.text property, but how to access the one's which are not selected.
    Actually I wish to change the currently selected item to another item, something like
    @if(ui->treewidget->currentItem()->text(0)!="something")
    // then it should select the item named something
    @

    1 Reply Last reply
    0
    • C Offline
      C Offline
      ChrisW67
      wrote on last edited by
      #2
      • To change the data in the current item use QTreeWidgetItem::setText().
      • To access the data in arbitrary cells use the QTreeWidget::model() to generate QModelIndex values and then use QAbstractItemModel::data()/setData()
      • To change which item is the current item use QtreeWidget::setCurrentItem()
      • To find another item by its content use QTreeWidget::findItems().
      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved