Results 1 to 7 of 7

Thread: How to subclass a control in *.ui?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2006
    Location
    Boulder, Colorado, USA
    Posts
    63
    Thanked 8 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to subclass a control in *.ui?

    Sorry my solution is for Qt4, I just noticed you are using Qt3.

    Anyway for folks that read this thread and are using 4 here is a clarification.

    In designer, with your form open, right click the widget in the form.

    The context menu from right clicking should look like this:
    Qt Code:
    1. Change objectName
    2. Change toolTip
    3. Change whatsThis
    4. ------------------
    5. Promote to Custom Widget
    6. ------------------
    7. Cut
    8. Copy
    9. ...
    To copy to clipboard, switch view to plain text mode 

    Select "Promote to Custom Widget". A dialog will appear where you can put in the name of the derived class and a header that defines it.

    You can edit the ui manually to achive the same effect. Try something like this:
    Qt Code:
    1. <ui version="4.0" >
    2. <class>Dialog</class>
    3. <widget class="QDialog" name="Dialog" >
    4. <property name="windowTitle" >
    5. <string>Dialog</string>
    6. </property>
    7. <widget class="QTableView" name="tableView" >
    8. </widget>
    9. <widget class="myCustomTable" name="customTableView" >
    10. </widget>
    11. </widget>
    12. <customwidgets>
    13. <customwidget>
    14. <class>myCustomTable</class>
    15. <extends>QTableView</extends>
    16. <header>mycustomtable.h</header>
    17. <container>0</container>
    18. <pixmap></pixmap>
    19. </customwidget>
    20. </customwidgets>
    21. </ui>
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Feb 2006
    Location
    Boulder, Colorado, USA
    Posts
    63
    Thanked 8 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to subclass a control in *.ui?

    For qt3 try tools->custom->Edit Custom Widget in designer

  3. The following user says thank you to jrideout for this useful post:

    coralbird (5th April 2006)

  4. #3
    Join Date
    Jan 2006
    Posts
    55
    Thanks
    13
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: How to subclass a control in *.ui?

    First special thanks to jrideout!

    Quote Originally Posted by jrideout
    For qt3 try tools->custom->Edit Custom Widget in designer
    I have find the entrance,and I will test tomorrow. Thanks again.

  5. #4
    Join Date
    Jan 2006
    Posts
    55
    Thanks
    13
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: How to subclass a control in *.ui?

    Quote Originally Posted by jrideout
    For qt3 try tools->custom->Edit Custom Widget in designer
    Sure,Through this function,I have reached my target.It's really a usful function.
    thanks jrideout again.

Similar Threads

  1. Replies: 6
    Last Post: 3rd February 2006, 09:48

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.