ich probiere gerade meine mit Qt4-Designer erstellte Anwendung auszutesten. Es handelt sich um ein QMainWindow Objekt in dem eine MDI (QMdiArea) mit zwei SubWindows(QWidget) Klassen platziert sind. Meine UI-Datei heisst UI/hauptfenster.ui und die Klasse heisst HauptFenster. Dazu habe ich wie in meinem QT4 Buch beschrieben folgende Dateien erstellt:
src/main.cpp
Code: Alles auswählen
#include <QApplication>
#include <QMainWindow>
#include "../include/hauptfenster.h"
using namespace std;
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
HauptFenster ui;
QMainWindow *hauptfenster = new QMainWindow;
ui.setupUI(hauptfenster);
hauptfenster->show();
return app.exec();
}Code: Alles auswählen
#include <QtGui>
#include "../include/hauptfenster.h"
HauptFenster::HauptFenster(QWidget *parent):QMainWindow(parent)
{
setupUI(this);
}include/hauptfenster.h
Code: Alles auswählen
#ifndef HAUPTFENSTER_H
#define HAUPTFENSTER_H
#include <QMainWindow>
#include "../UI/ui_hauptfenster.h"
class HauptFenster : public QMainWindow, public UI::HauptFenster
{
Q_OBJECT
public:
HauptFenster(QWidget *parent = 0);
};
#endifCode: Alles auswählen
.
|-- UI
| `-- hauptfenster.ui
|-- doc
| |-- README.odt
| |-- README.txt~
| |-- punkt-in-polygon.pdf
| `-- search_intersect.ppt
|-- include
| `-- hauptfenster.h
|-- src
| |-- hauptfenster.cpp
| `-- main.cpp
|-- uml
| |-- 129282.diagram
| |-- 2.session
| |-- cpp_includes
| |-- generation_settings
| |-- idl_includes
| |-- install.sh
| |-- install.sh~
| |-- java_imports
| |-- meisterhilfe.pro
| |-- python_imports
| |-- stereotypes
| |-- tools
| `-- uml.prj
|-- Makefile
|-- install.sh
|-- install.sh~
`-- meisterhilfe.proCode: Alles auswählen
. . .
# Input
HEADERS += include/hauptfenster.h
FORMS += UI/hauptfenster.ui
SOURCES += src/hauptfenster.cpp src/main.cppGrüße Markus