[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: Problem with QT designer Qt3 -> Qt4
From:       David Johnson <david () usermode ! org>
Date:       2009-06-23 13:01:29
Message-ID: 200906230601.29593.david () usermode ! org
[Download RAW message or body]

On Tuesday 23 June 2009 05:14:57 am Robin Atwood wrote:
> This seems to be quite different from QT3 generated code but shouldn't
> Ui_ReniceUI at least be inheriting QDialog?

Qt4 uic no longer generates a QWidget class. It instead generates a Ui class. 
This class contains all the child widgets and layouts, along with two 
functions. On function translates the UI, but the other, setupUi() is the key 
to everything. It is passed a host widget, and then instantiates all the child 
widgets, sets their properties, lays them out, and reparents them to the host 
widget.

There are several ways to use this Ui class. The most common is multiple 
inheritance. Your dialog inherits from both QDialog and your new Ui class. 
Then in the constructor you call "setupUi(this)". From that point in it should 
behave just like a Qt3 uic generated file.

For example:

#include "ui_mydialog.h"

class MyDialog: public QDialog, private Ui::MyDialog
{
    MyDialog(QWidget *parent)
    {
        setupUi(this);
        ...
    }
    ...
};

-- 
David Johnson
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic