Results 1 to 5 of 5

Thread: How to "share" a QTreeWidget

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2011
    Posts
    51
    Thanks
    5
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to "share" a QTreeWidget

    Sory for 2 posts in row but I don't know how edit last one...
    The thing I was missing is

    Qt Code:
    1. void QStandardItem::setChild(int row, int column, QStandardItem * item)
    To copy to clipboard, switch view to plain text mode 

    function

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to "share" a QTreeWidget

    QTreeWidgets are independent of each other with separate data and selections. A shared selection is only really sensible if the underlying data model is also shared.

    If you want the same data presented in three view then you should use QTreeView and a separate model. You can build a usable tree model with QStandardItemModel or write your own custom model.
    If you have three views sharing the same model and want the same current and selected items in each then point them all at the same QItemSelectionModel (i.e. share one).

Similar Threads

  1. Replies: 1
    Last Post: 7th April 2010, 21:46
  2. Replies: 3
    Last Post: 15th February 2010, 17:27
  3. QTreeWidget and keep "focus drawing" every time
    By Lykurg in forum Qt Programming
    Replies: 0
    Last Post: 3rd April 2008, 17:04
  4. Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")
    By victor.yacovlev in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2008, 19:05
  5. QFile Problem~ "Unknow error" in "open(QIODevice::ReadWrite)"
    By fengtian.we in forum Qt Programming
    Replies: 3
    Last Post: 23rd May 2007, 15:58

Tags for this Thread

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
  •  
Qt is a trademark of The Qt Company.