Results 1 to 3 of 3

Thread: The single Inheritance Approach

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    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 single Inheritance Approach

    You designed a widget in the designer, but are using the Ui for a dialog. It works this way, because QDialog inherits QWidget, but more appropriate way is to design a dialog for a dialog, a widget for a widget and a mainwindow for a mainwindow.

    Qt Code:
    1. // dialog.h
    2. #include "ui_widget1.h"
    3. // you must include this because you designed a widget in the designer
    4. #include <QDialog>
    5.  
    6. class Dialog : public QDialog
    7. {
    8. Q_OBJECT
    9.  
    10. public:
    11. Dialog(QWidget *parent = 0);
    12.  
    13. private:
    14. Ui::Widget1 ui; // corrected the name, check the object name property in the designer
    15. };
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

  2. #2
    Join Date
    Jan 2006
    Posts
    273
    Thanks
    42
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: The single Inheritance Approach

    Hi JPN!!
    Thanks it works. I will design a dialog for a dialog..
    Think DigitalGasoline

Similar Threads

  1. Multiple inheritance & Qt
    By dublet in forum Qt Programming
    Replies: 11
    Last Post: 8th March 2006, 08:12

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.