Qt-Oberfläche in Programm einbinden!?
-
Hi,
nächstes Problem,
ich möchte eine GUI die ich mit dem Qt Designer erstellt habe in mein Programm einbinden.
Jedoch bekomme ich immer folgenden Fehler beim compilieren:
error: 'class Ui_MainWindow' has no member named 'show'|Hier die main.cpp:
#include <J:\Eigene Dateien\Development\Projekte+\SpeedPenner\GUI.h> #include <QApplication> int main( int argc, char* argv[]) { QApplication a(argc, argv); Ui_MainWindow g; g.show(); return a.exec(); }
Hier die gui.h:
/******************************************************************************** ** Form generated from reading ui file 'mainjlP188.ui' ** ** Created: Thu 6. Nov 17:08:21 2008 ** by: Qt User Interface Compiler version 4.4.3 ** ** WARNING! All changes made in this file will be lost when recompiling ui file! ********************************************************************************/ #ifndef MAINJLP188_H #define MAINJLP188_H #include <QtCore/QVariant> #include <QtGui/QAction> #include <QtGui/QApplication> #include <QtGui/QButtonGroup> #include <QtGui/QDoubleSpinBox> #include <QtGui/QLabel> #include <QtGui/QLineEdit> #include <QtGui/QMainWindow> #include <QtGui/QProgressBar> #include <QtGui/QPushButton> #include <QtGui/QSpinBox> #include <QtGui/QStackedWidget> #include <QtGui/QToolButton> #include <QtGui/QWidget> QT_BEGIN_NAMESPACE class Ui_MainWindow { public: QWidget *centralwidget; QStackedWidget *stackedWidget; QWidget *page; QLineEdit *Link; QLabel *label; QPushButton *pushButton; QSpinBox *Aufrufe; QLabel *Aufrufe_2; QProgressBar *progressBar; QWidget *page_2; QLabel *Reconnectmethode; QLineEdit *lineEdit_2; QToolButton *toolButton; QLabel *Wartezeit; QDoubleSpinBox *doubleSpinBox; QLabel *Sekunden; QLabel *Copyright; void setupUi(QMainWindow *MainWindow) { if (MainWindow->objectName().isEmpty()) MainWindow->setObjectName(QString::fromUtf8("MainWindow")); MainWindow->resize(350, 200); MainWindow->setMinimumSize(QSize(350, 200)); MainWindow->setMaximumSize(QSize(350, 200)); MainWindow->setAcceptDrops(true); centralwidget = new QWidget(MainWindow); centralwidget->setObjectName(QString::fromUtf8("centralwidget")); stackedWidget = new QStackedWidget(centralwidget); stackedWidget->setObjectName(QString::fromUtf8("stackedWidget")); stackedWidget->setGeometry(QRect(-1, 0, 350, 250)); stackedWidget->setMinimumSize(QSize(350, 250)); stackedWidget->setMaximumSize(QSize(350, 250)); page = new QWidget(); page->setObjectName(QString::fromUtf8("page")); Link = new QLineEdit(page); Link->setObjectName(QString::fromUtf8("Link")); Link->setGeometry(QRect(10, 30, 311, 21)); label = new QLabel(page); label->setObjectName(QString::fromUtf8("label")); label->setGeometry(QRect(10, 10, 81, 16)); pushButton = new QPushButton(page); pushButton->setObjectName(QString::fromUtf8("pushButton")); pushButton->setGeometry(QRect(180, 70, 161, 61)); pushButton->setFlat(false); Aufrufe = new QSpinBox(page); Aufrufe->setObjectName(QString::fromUtf8("Aufrufe")); Aufrufe->setGeometry(QRect(10, 90, 51, 31)); Aufrufe->setMaximum(200); Aufrufe_2 = new QLabel(page); Aufrufe_2->setObjectName(QString::fromUtf8("Aufrufe_2")); Aufrufe_2->setGeometry(QRect(10, 60, 71, 21)); progressBar = new QProgressBar(page); progressBar->setObjectName(QString::fromUtf8("progressBar")); progressBar->setGeometry(QRect(10, 140, 331, 51)); progressBar->setMaximum(100); progressBar->setValue(0); progressBar->setOrientation(Qt::Horizontal); stackedWidget->addWidget(page); page_2 = new QWidget(); page_2->setObjectName(QString::fromUtf8("page_2")); Reconnectmethode = new QLabel(page_2); Reconnectmethode->setObjectName(QString::fromUtf8("Reconnectmethode")); Reconnectmethode->setGeometry(QRect(10, 20, 151, 21)); lineEdit_2 = new QLineEdit(page_2); lineEdit_2->setObjectName(QString::fromUtf8("lineEdit_2")); lineEdit_2->setGeometry(QRect(10, 40, 291, 20)); toolButton = new QToolButton(page_2); toolButton->setObjectName(QString::fromUtf8("toolButton")); toolButton->setGeometry(QRect(320, 40, 25, 20)); toolButton->setCheckable(true); toolButton->setChecked(true); Wartezeit = new QLabel(page_2); Wartezeit->setObjectName(QString::fromUtf8("Wartezeit")); Wartezeit->setGeometry(QRect(10, 90, 231, 21)); doubleSpinBox = new QDoubleSpinBox(page_2); doubleSpinBox->setObjectName(QString::fromUtf8("doubleSpinBox")); doubleSpinBox->setGeometry(QRect(10, 120, 62, 22)); doubleSpinBox->setDecimals(1); doubleSpinBox->setMinimum(0.5); doubleSpinBox->setMaximum(60); doubleSpinBox->setSingleStep(0.5); Sekunden = new QLabel(page_2); Sekunden->setObjectName(QString::fromUtf8("Sekunden")); Sekunden->setGeometry(QRect(80, 120, 71, 16)); Copyright = new QLabel(page_2); Copyright->setObjectName(QString::fromUtf8("Copyright")); Copyright->setGeometry(QRect(300, 180, 46, 14)); stackedWidget->addWidget(page_2); MainWindow->setCentralWidget(centralwidget); retranslateUi(MainWindow); stackedWidget->setCurrentIndex(0); QMetaObject::connectSlotsByName(MainWindow); } // setupUi void retranslateUi(QMainWindow *MainWindow) { MainWindow->setWindowTitle(QApplication::translate("MainWindow", "SpeedPenner 1.0 ", 0, QApplication::UnicodeUTF8)); label->setText(QApplication::translate("MainWindow", "Spendenlink:", 0, QApplication::UnicodeUTF8)); pushButton->setText(QApplication::translate("MainWindow", "Start", 0, QApplication::UnicodeUTF8)); Aufrufe_2->setText(QApplication::translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n" "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n" "p, li { white-space: pre-wrap; }\n" "</style></head><body style=\" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;\">Aufrufe:</p></body></html>", 0, QApplication::UnicodeUTF8)); Reconnectmethode->setText(QApplication::translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n" "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n" "p, li { white-space: pre-wrap; }\n" "</style></head><body style=\" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n" "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;\">Reconnectmethode:</p></body></html>", 0, QApplication::UnicodeUTF8)); toolButton->setText(QApplication::translate("MainWindow", "...", 0, QApplication::UnicodeUTF8)); Wartezeit->setText(QApplication::translate("MainWindow", "Wartezeit zwischen Reconnect und IP Check:", 0, QApplication::UnicodeUTF8)); Sekunden->setText(QApplication::translate("MainWindow", "Sekunden", 0, QApplication::UnicodeUTF8)); Copyright->setText(QApplication::translate("MainWindow", "\302\251 FloH", 0, QApplication::UnicodeUTF8)); Q_UNUSED(MainWindow); } // retranslateUi }; namespace Ui { class MainWindow: public Ui_MainWindow {}; } // namespace Ui QT_END_NAMESPACE #endif // MAINJLP188_H