Results 1 to 7 of 7

Thread: hidden a QTreeWidgetItem

  1. #1
    Join Date
    Oct 2007
    Location
    Italy
    Posts
    172
    Thanks
    39
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default hidden a QTreeWidgetItem

    Hi there,
    i have a QTreeWidget with some QTreeWidgetItem in, i'd like to hide one of them, i tried with setHidden method but it does not work, i add the item in this way:
    Qt Code:
    1. QTreeWidgetItem *parentFake = new QTreeWidgetItem ();
    2. parentFake->setText ( 0 , tr ("fake") );
    3. parentFake->setHidden(true);
    4. itemsList.append( parentFake );
    To copy to clipboard, switch view to plain text mode 
    and i'm able to see them on my GUI...thx

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: hidden a QTreeWidgetItem

    Append first, hide later.

  3. #3
    Join Date
    Oct 2007
    Location
    Italy
    Posts
    172
    Thanks
    39
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: hidden a QTreeWidgetItem

    thanks, but its always the same, i tried to disable the item with
    setDisabled(true)
    and its works, but i can't hide the item...it sounds quite strange...

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: hidden a QTreeWidgetItem

    Ok, but what is "itemList"? It's not a QTreeWidget, is it? You are adding the item to the tree elsewhere.

  5. #5
    Join Date
    Oct 2007
    Location
    Italy
    Posts
    172
    Thanks
    39
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: hidden a QTreeWidgetItem

    itemList is a QList<QTreeWidgetItem*>
    and then i add al the list in QTreeWidget
    Qt Code:
    1. QTreeWidget * treeWidget
    2. treeWidget->insertTopLevelItems ( 0 , itemList );
    To copy to clipboard, switch view to plain text mode 

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: hidden a QTreeWidgetItem

    So as I already said add those items to the tree before you hide them.

  7. #7
    Join Date
    Feb 2014
    Posts
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: hidden a QTreeWidgetItem

    Hi! wysota is right! Setting the hidden parameter of the QTreeWidgetItem is only works if it has a parent or container (QTreeWidget) or something like that.

Similar Threads

  1. Custom QTreeWidgetItem context menu?
    By AaronMK in forum Qt Programming
    Replies: 4
    Last Post: 1st February 2010, 04:42
  2. select a QTreeWidgetItem
    By mattia in forum Newbie
    Replies: 2
    Last Post: 21st December 2007, 11:01
  3. Replies: 2
    Last Post: 27th October 2007, 18:16
  4. Replies: 1
    Last Post: 28th September 2006, 06:21
  5. hidden QListView column suddenly visible
    By edb in forum Qt Programming
    Replies: 10
    Last Post: 27th January 2006, 08:00

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.