Results 1 to 4 of 4

Thread: help setting up qt4 ui from qt3

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2006
    Posts
    29
    Qt products
    Qt3
    Platforms
    Windows
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default Re: help setting up qt4 ui from qt3

    Quote Originally Posted by marcel View Post
    You can choose between either the single inheritance approach or the multiple inheritance approach. You can read about both of them in the documentation.

    Single inheritance:

    For this case is a subclass of QMainWindow and contains a member of type Ui::testClass( this is the one generated by uic ).

    Right there...

    Assuming you have something like Ui::testClass ui;, then ui.setupUi(this) goes in the constructor of the subclass, meaning testSubClass.

    The multiple inheritance approach assumes you subclass QMainWindow but also Ui::testClass. Then you have direct access to it's members.

    Regards
    hi, thanks for the reply. i read all the documentation multiple times, but it is sparse and does not give complete examples, just snippets, and it's especially useless for mainwindows using multiple inheritance. the docs don't discuss the advantages or disadvantages of either approach.

    single inheritance is the approach i was taking for converting things to qt4, but the single inheritance approach doesn't seem correct or in line with the way i worked things in qt3. as a subclass, i had access to all members of the base class, which is a necessity. with this single inheritance, i'd have to do so much reprogramming to point to the right members i'd rather become a monk.

    honestly i don't even see the benefit of the single inheritance approach. it looks like i have to have the multiple inheritance.

    so, i know how to inherit from both classes, but how do the ui::setup commands change for multiple inheritance?
    is there any drawback to using multiple inheritance?

    thanks again! -- lou

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 541 Times in 521 Posts

    Default Re: help setting up qt4 ui from qt3

    so, i know how to inherit from both classes, but how do the ui::setup commands change for multiple inheritance?
    is there any drawback to using multiple inheritance?
    Well, it changes to setupUi(this), since you inherit the class now, and it is not a member anymore.

    Regards.

Similar Threads

  1. Replies: 3
    Last Post: 30th January 2007, 07:35
  2. Setting style in QApplication
    By Doug Broadwell in forum Newbie
    Replies: 2
    Last Post: 28th October 2006, 21:56
  3. form setting
    By mickey in forum Qt Tools
    Replies: 5
    Last Post: 27th September 2006, 00:28
  4. setting desktop background and screensaver in X11
    By nupul in forum Qt Programming
    Replies: 5
    Last Post: 2nd April 2006, 21:11
  5. Replies: 4
    Last Post: 29th March 2006, 23:44

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.