Results 1 to 4 of 4

Thread: QTreeWidget in a Dockwidget

  1. #1
    Join Date
    May 2007
    Location
    Germany
    Posts
    89
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default QTreeWidget in a Dockwidget

    Hello friends,

    after some experiences I´ve make my tree. My target is a dockwidget with a tree like the one in the designers left side. My code is :
    Qt Code:
    1. QDockWidget *docktree = new QDockWidget(tr("MyTestTree"), this);
    2. docktree->minimumHeight();
    3. docktree->setAutoFillBackground(true);
    4. docktree->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
    5. QTreeWidget *testTree = new QTreeWidget(docktree);
    6. testTree->setColumnCount(1);
    7.  
    8. QStringList headerLabels;
    9. headerLabels << "Label";
    10. testTree->setHeaderLabels(headerLabels);
    11.  
    12. QTreeWidgetItem* item[10];
    13. item[0] = new QTreeWidgetItem(testTree);
    14. item[0]->setText(0, "Node-One");
    15. for (int i=1; i< 5; ++i)
    16. item[i] = new QTreeWidgetItem(item[0]);
    17. item[1]->setText(0, "a");
    18. item[2]->setText(0, "b");
    19. item[3]->setText(0, "c");
    20. item[4]->setText(0, "d");
    21. item[5] = new QTreeWidgetItem(testTree);
    22. item[5]->setText(0, "Node-Two");
    23. for (int i=6; i< 10; ++i)
    24. item[i] = new QTreeWidgetItem(item[5]);
    25. item[6]->setText(0, "a");
    26. item[7]->setText(0, "b");
    27. item[8]->setText(0, "c");
    28. item[9]->setText(0, "d");
    To copy to clipboard, switch view to plain text mode 

    Is there any tips for me to make them nearly looks like the designer one´s??
    Attached Images Attached Images

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QTreeWidget in a Dockwidget

    I think this question has already been answered in thread: http://www.qtcentre.org/forum/f-qt-p...gner-8775.html
    J-P Nurmi

  3. #3
    Join Date
    May 2007
    Location
    Germany
    Posts
    89
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTreeWidget in a Dockwidget

    I think no. Your answer is like "here are the book read self"

    I think the philosophie of a forum is another i am not a trolltech men to read the code from the designer
    i am just at the beginning thats the reason i make my question for the same point twice.

    sorry for not beeing perfect !!!!!!!!!!!!

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QTreeWidget in a Dockwidget

    Quote Originally Posted by LordQt View Post
    Your answer is like "here are the book read self"
    So you want me to read a book for you or what?

    i am just at the beginning thats the reason i make my question for the same point twice.
    Do not start new threads on the same subject. Just ask for more details in the original thread, please.
    J-P Nurmi

Similar Threads

  1. QToolBar and DockWidget
    By baray98 in forum Qt Programming
    Replies: 3
    Last Post: 15th August 2007, 21:15
  2. resizing a QTreeWidget
    By drhex in forum Qt Programming
    Replies: 6
    Last Post: 27th October 2006, 22:32
  3. Replies: 1
    Last Post: 21st September 2006, 10:37
  4. How to capture resizing of QTreeWidget columns?
    By simk in forum Qt Programming
    Replies: 2
    Last Post: 27th April 2006, 06:10
  5. few questions related to QTreeWidget
    By prakash in forum Qt Programming
    Replies: 9
    Last Post: 10th March 2006, 07:32

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.