Results 1 to 3 of 3

Thread: Retrieving Column/Row from TreeWidgetItemIterator?

  1. #1
    Join Date
    Aug 2011
    Location
    The Internet
    Posts
    29
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Retrieving Column/Row from TreeWidgetItemIterator?

    I'm currently experimenting with QTreeWidgets and am wondering if it's possible to retrieve the column/row count from finding an item in a tree view using QTreeWidgetItemIterator? I am just simply dropping the example in the class as a slot.

    Qt Code:
    1. QTreeWidgetItemIterator it(treeWidget);
    2. while (*it) {
    3. if ((*it)->text(0) == itemText)
    4. (*it)->setSelected(true);
    5. ++it;
    6. }
    7. //itemText's row and column?
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Aug 2011
    Location
    The Internet
    Posts
    29
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Retrieving Column/Row from TreeWidgetItemIterator?

    I'm sorry I didn't mean the count. I'm wanting the row/column of where "itemText" is found.

  3. #3
    Join Date
    Sep 2011
    Location
    Mannheim, Germany
    Posts
    22
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Retrieving Column/Row from TreeWidgetItemIterator?

    if ((*it)->text(0) == itemText)

    the column is 0 .

    I think *it->parent() is more interesting in trees than the row. The row is relative to the parent.

    Take a look a model view programming:

    http://doc.qt.nokia.com/4.7/model-view-programming.html


Similar Threads

  1. retrieving data from a QWT plot
    By mobucl in forum Qwt
    Replies: 1
    Last Post: 26th May 2011, 13:00
  2. Replies: 3
    Last Post: 5th May 2011, 14:03
  3. QSqlRecord...retrieving informations
    By lord_shadow in forum Qt Programming
    Replies: 3
    Last Post: 5th March 2009, 12:54
  4. Retrieving and converting values
    By jcoop in forum Newbie
    Replies: 3
    Last Post: 19th February 2009, 08:01
  5. Storing and Retrieving a QFlags
    By darkadept in forum Qt Programming
    Replies: 3
    Last Post: 4th October 2007, 18:53

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.