score:1

you need 4 things :

  • the .ui generated by qt designer

=> about.ui

<?xml version="1.0" encoding="utf-8"?>
<ui version="4.0">
<class>about</class>
<widget class="qdialog" name="dialog">
<property name="geometry">
<rect>
    <x>0</x>
    <y>0</y>
    <width>400</width>
    <height>300</height>
</rect>
</property>
<property name="windowtitle">
<string>a propos</string>
</property>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>
  • the cpp / h associated with the .ui, for example this :

an about window (about.cpp) =>

#include "about.h"
#include "ui_about.h"

about::about(qwidget *parent) : qdialog(parent), ui(new ui::about)
{
    ui->setupui(this);
}

about::~about()
{
    delete ui;
}

(about.h) =>

#ifndef about_h
#define about_h

#include <qdialog>

namespace ui {
    class about;
}

class about : public qdialog
{
    q_object
public:
    explicit about(qwidget *parent = 0);
    ~about();

private:
    ui::about *ui;
};

#endif // about_h

in the .pro file

sources += about.cpp
headers += about.h
forms   += about.ui

Related Query

More Query from same tag