Results 1 to 3 of 3

Thread: Designer: How to promote to a existing Qt Widget?

  1. #1
    Join Date
    Jan 2009
    Location
    Germany
    Posts
    131
    Thanks
    11
    Thanked 16 Times in 16 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Designer: How to promote to a existing Qt Widget?

    Good Morning,

    I want to insert a QToolBar into my QWidget designed in the Designer. Since there is no direct support for this (except for QMainWindow, but I cant use this) I thought its best to use a normal QWidget and promote it to the QToolBar. But this seems not possible in the designer (4.6.0).

    However a can create a Custom Widget based on QToolBar, but I can not select it for promoting, since my Baseclass is QWidget and not QToolBar. For selecting this I need a QToolbar as Base (and this is exacly what I want)

    Attached Images Attached Images

  2. #2
    Join Date
    Dec 2007
    Posts
    628
    Thanks
    3
    Thanked 89 Times in 87 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Designer: How to promote to a existing Qt Widget?

    First of all you misconcepted the meaning of promotion. Promotion is used for promoting the default widgt to a customized widget in designer. e.g. You have subclassed QLabel and created a class MyLabel. Then while using MyLabel in designer you need to place a QLabel and promote it to MyLabel. There is no meaning of promoting it to QLabel because its a QLabel already.

    Secondly, whats the problem in subclassing QMenubar ? Have you tried that or what ?

  3. #3
    Join Date
    Jan 2009
    Location
    Germany
    Posts
    131
    Thanks
    11
    Thanked 16 Times in 16 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Designer: How to promote to a existing Qt Widget?

    After reading my post again I see, that it is a bit difficult to understand. So here is a longer explanation:

    I know the purpose of promoting, but I thought I could (ab)use it to achieve my goal inserting a QToolBar into my widget into the designer.

    Like: This a QWidget promoted to QToolBar. Adding the right header and setting it to global. In this way the uic would included the code for the QToolBar (that was my idea, but it didn't work, because the designer knows, that QToolBar is a special widget of Qt and don't allow this)

    While playing with this I detected, that it is possible to subclass from QToolBar in the promoting dialog. So I thought that is must be possible to insert a QToolBar directly, since its not possible to promote a normal QWidget to a class, that inherit from QToolBar. That was my state when I was writing the post: "There is a way to directly insert a QToolBar, else this feature would make no sense"

    But after a bit research the only way to insert a QToolBar seem to use QMainWindow and then "add toolbar". (and this one you could use to promote to a custom widget that is inheriting QToolBar)

    How could QMenuBar help me in my case? It seems to have the same limitations as the QToolBar

Similar Threads

  1. Replies: 3
    Last Post: 17th November 2009, 14:43
  2. how to promote layout in Designer?
    By homerli in forum Qt Tools
    Replies: 1
    Last Post: 11th May 2009, 16:40
  3. add an apps to the designer widget box
    By adamatic in forum Qt Tools
    Replies: 1
    Last Post: 5th March 2009, 06:31
  4. Replies: 4
    Last Post: 9th August 2007, 08:20
  5. Replies: 9
    Last Post: 8th May 2006, 14:21

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.