Benutzen von Dialogen mit Qt4 - gelöst



  • Hi,
    Ich habe einen Dialog nach der Anleitung im Assistant im Designer erstellt. Im Kapitel "Using a Component in your app" ist dann beschrieben, wie man die projekt datei anpasst und wie man in der main dann den Dialog aufruft.

    Allerdings erhalte ich beim simplen aufruf

    QDialog *window = new QDialog;
    

    folgende Fehlermeldung:

    Dev-C++ schrieb:

    invalid use of undefined type struct QDialog' 38 C:\\Qt\\4.2.2\\src\\gui\\kernel\\qwindowdefs.h forward declaration ofstruct QDialog'

    Wie ihr Seht bezieht sich die zweite auf eine datei von Qt, die erste auf die main.cpp.

    Aber genau so steht es in der Doku, oder habe ich etwas übersehen?

    -edit- Gelöst
    perfekt ist die Qt doku auch nicht´:

    Qt Doku schrieb:

    The special feature of this file is the FORMS declaration that tells qmake which files it needs to process with uic. In this case, the imagedialog.ui file is used to create a ui_imagedialog.h file that can be used by any files listed in the SOURCES declaration. To ensure that qmake generates the ui_imagedialog.h file, we need to include it in a file listed in SOURCES. Since we only have main.cpp, we include it there:
    #include "ui_imagedialog.h"
    #include <QApplication>
    This additional check ensures that we do not generate code for .ui files that are not used.
    The main function creates the image dialog by constructing a standard QDialog that we use to host the user interface described by the imagedialog.ui file.
    int main(int argc, char *argv[])
    {
    QApplication app(argc, argv);
    QDialog *window = new QDialog;
    Ui::ImageDialog ui;
    ui.setupUi(window);

    window->show();
    return app.exec();
    }

    wer kann denn da ahnen, dass ich da oben hinschreiben muss
    [cpp]#include <QApplication.h>
    #include <QDialog.h>[/cpp]
    stand dann iwo in der hilfe dass jede klasse ihre eigene header datei hat, also mal ausprobiert - da gings...


Anmelden zum Antworten