Results 1 to 10 of 10

Thread: The Widget in qt´s Designer

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

    Default The Widget in qt´s Designer

    HEllo friends,

    I have a question early in the morning ;o). What widget tyle is in use in the left side of the designer (qt) . I would like to program the same widget. How can i do that, it seems it is no standard widget? Isn´t it?

  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: The Widget in qt´s Designer

    If you mean the Widget Box, it's a QTreeWidget with a custom delegate which renders top level items as buttons. See Designer's sources for more details:
    • $QTDIR/tools/designer/src/components/widgetbox.*
    • $QTDIR/tools/designer/src/lib/shared/sheet_delegate.*
    J-P Nurmi

  3. #3
    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: The Widget in qt´s Designer

    Quote Originally Posted by LordQt View Post
    I think the philosophie of a forum is another i am not a trolltech men to read the code from the designer
    Hey, me neither! However, they use a custom technique for painting top level items. It's not a built-in feature one can just turn on nor it's documented anywhere. That's why I pointed out where it's implemented so you could have taken look how they do it.

    I don't have Qt sources on this computer so right now I'm unable to give you more detailed instructions than looking for SheetDelegate::paint() in the source files that were already mentioned. As far as I remember, it checks whether an item being painted is a top level item and if so, paints it as a button with the help of styles. Implement a similar item delegate, and use QAbstractItemView::setItemDelegate() to take it into use.
    J-P Nurmi

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

    Default Re: The Widget in qt´s Designer

    Thanks for your explanations, but I don´t say that you are a Troll. I have just pointest out my opinion thats the reason I asked twice the same think because the answet that you gave me don´t satisfied me.
    Whatever I thank you that you show me the that i must go. It seems to be a hard way ;o))

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

    Default Re: The Widget in qt´s Designer

    Hello friends,

    I´am always coding my treeview like the designer one.
    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. ControlView= new QTreeView();
    6. ControlView->setItemsExpandable(true);
    7.  
    8.  
    9. for (int i = 0; i < 5; ++i)
    10. itemmodel->setItem(i, new QStandardItem(QString("Row: ") + QString::number(i)));
    11.  
    12.  
    13. ControlView->setModel(itemmodel);
    14. SheetDelegate *myDelegate = new SheetDelegate(ControlView,docktree);
    15. ControlView->setItemDelegate(myDelegate);
    To copy to clipboard, switch view to plain text mode 

    ;o) See the attachment how it looks ;o))

    but i have some question.
    How can I add some children´s to my items?
    And how can I hide the root above my first item in my view?
    Attached Images Attached Images

  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: The Widget in qt´s Designer

    As far as I remember, to hide the root, you need to set the "rootIsDecorated" property of the tree to false. As for adding items, you need to create a model that will contain a hierarchy of items. If you don't want to create your own model, you can use QStandardItemModel, it's capable of creating hierarchies.

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

    Default Re: The Widget in qt´s Designer

    Hello thanx for reply,

    when I set rootIsDecorated to false my View changes in see attachment. But the Label with the string "1" also exists.

    hm and now ??
    Attached Images Attached Images

  8. #8
    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: The Widget in qt´s Designer

    Oh come on... why don't you try something yourself before asking here for each and every problem you are facing? You won't learn much this way... The "1" is the default name of the header of the tree. If you hide the header, the problem will go away. You can access the header through one of the members of QTreeView class.

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

    Default Re: The Widget in qt´s Designer

    So thats enough,

    I think about never write here again.
    What do you talkin about. I am searching now 1 hour for this fuckin member. As far as I remember this is a forum about those "silly" question ( sorry for my badness).



    P.S.: Pride goes before a fall.


    Thanks for your professional help.

  10. #10
    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: The Widget in qt´s Designer

    Quote Originally Posted by LordQt View Post
    What do you talkin about. I am searching now 1 hour for this fuckin member.
    Try the one that is called "header". And watch your language, please - no need to be upset. Our policy is to give fishing rods and not fish. If you refuse a rod, you'll get your fish, but you'll be unable to catch one by yourself next time.

Similar Threads

  1. Replies: 4
    Last Post: 9th August 2007, 09:20
  2. Replacing Central Widget in Designer
    By Max Yaffe in forum Qt Tools
    Replies: 2
    Last Post: 11th July 2007, 12:41
  3. Replies: 10
    Last Post: 9th July 2007, 23:02
  4. QT4: Custom widget for QT Designer
    By Michiel in forum Qt Tools
    Replies: 4
    Last Post: 4th May 2006, 14:35
  5. Replies: 4
    Last Post: 6th February 2006, 15:30

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.