Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 2

Qt-interest Archive, January 2008
newbie question "compiling the designer forms"


Message 1 in thread

Hi,

When I tried to compile the designer form, I have received the following
error:

mingw32-make -f Makefile.Release
mingw32-make[1]: Entering directory
`E:/projects/Cadence/GridMatrix/Qt/Jobscount
er'
g++ -c -O2 -frtti -fexceptions -mthreads -Wall -DUNICODE
-DQT_LARGEFILE_SUPPORT
-DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT
-DQT_NEEDS
_QMAIN -I"c:\Qt\4.3.2\include\QtCore" -I"c:\Qt\4.3.2\include\QtCore"
-I"c:\Qt\4.
3.2\include\QtGui" -I"c:\Qt\4.3.2\include\QtGui" -I"c:\Qt\4.3.2\include"
-I"." -
I"c:\Qt\4.3.2\include\ActiveQt" -I"release" -I"."
-I"c:\Qt\4.3.2\mkspecs\win32-g
++" -o release\main.o main.cpp
main.cpp: In function `int qMain(int, char**)':
main.cpp:12: error: no matching function for call to
`Ui_MainWindow::setupUi(QDi
alog*&)'
ui_Jobscounter.h:40: note: candidates are: void
Ui_MainWindow::setupUi(QMainWind
ow*)
mingw32-make[1]: *** [release\main.o] Error 1
mingw32-make[1]: Leaving directory
`E:/projects/Cadence/GridMatrix/Qt/Jobscounte
r'
mingw32-make: *** [release] Error 2

-----------------------------------------------------------------------------------------------------------------------------------------


main.cpp

----------------------

#include <QApplication>
#include <QDialog>

#include "ui_Jobscounter.h"
//using namesapace Ui;

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    Ui_MainWindow ui;
    QDialog *dialog = new QDialog;
    ui.setupUi(dialog);
    dialog->show();
    return app.exec();
}

------------------------------------------------------------------------------------------------------------------------------------------------

ui_Jobscounter.h

-----------------------------

/********************************************************************************
** Form generated from reading ui file 'Jobscounter.ui'
**
** Created: Thu Jan 10 10:29:37 2008
**      by: Qt User Interface Compiler version 4.3.2
**
** WARNING! All changes made in this file will be lost when recompiling ui
file!
********************************************************************************/


#ifndef UI_JOBSCOUNTER_H
#define UI_JOBSCOUNTER_H

#include <QtCore/QVariant>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
#include <QtGui/QLCDNumber>
#include <QtGui/QLabel>
#include <QtGui/QMainWindow>
#include <QtGui/QMenuBar>
#include <QtGui/QStatusBar>
#include <QtGui/QWidget>

class Ui_MainWindow
{
public:
    QWidget *centralwidget;
    QLCDNumber *lcdJSubmitted;
    QLabel *label;
    QLabel *label_2;
    QLCDNumber *lcdJRunning;
    QLabel *label_3;
    QLCDNumber *lcdJKilled;
    QLabel *label_4;
    QLCDNumber *lcdJCompletted;
    QMenuBar *menubar;
    QStatusBar *statusbar;

    void setupUi(QMainWindow *MainWindow)
    {
    if (MainWindow->objectName().isEmpty())
        MainWindow->setObjectName(QString::fromUtf8("MainWindow"));
    MainWindow->resize(498, 203);
    centralwidget = new QWidget(MainWindow);
    centralwidget->setObjectName(QString::fromUtf8("centralwidget"));
    lcdJSubmitted = new QLCDNumber(centralwidget);
    lcdJSubmitted->setObjectName(QString::fromUtf8("lcdJSubmitted"));
    lcdJSubmitted->setGeometry(QRect(40, 40, 81, 61));
    lcdJSubmitted->setAutoFillBackground(false);
    lcdJSubmitted->setFrameShape(QFrame::NoFrame);
    lcdJSubmitted->setLineWidth(0);
    lcdJSubmitted->setMidLineWidth(0);
    lcdJSubmitted->setNumDigits(7);
    lcdJSubmitted->setSegmentStyle(QLCDNumber::Flat);
    label = new QLabel(centralwidget);
    label->setObjectName(QString::fromUtf8("label"));
    label->setGeometry(QRect(30, 10, 101, 21));
    label->setAlignment(Qt::AlignCenter);
    label->setIndent(0);
    label_2 = new QLabel(centralwidget);
    label_2->setObjectName(QString::fromUtf8("label_2"));
    label_2->setGeometry(QRect(150, 10, 101, 21));
    label_2->setAlignment(Qt::AlignCenter);
    label_2->setIndent(0);
    lcdJRunning = new QLCDNumber(centralwidget);
    lcdJRunning->setObjectName(QString::fromUtf8("lcdJRunning"));
    lcdJRunning->setGeometry(QRect(160, 40, 81, 61));
    lcdJRunning->setFrameShape(QFrame::NoFrame);
    lcdJRunning->setNumDigits(7);
    lcdJRunning->setSegmentStyle(QLCDNumber::Flat);
    label_3 = new QLabel(centralwidget);
    label_3->setObjectName(QString::fromUtf8("label_3"));
    label_3->setGeometry(QRect(280, 10, 91, 21));
    lcdJKilled = new QLCDNumber(centralwidget);
    lcdJKilled->setObjectName(QString::fromUtf8("lcdJKilled"));
    lcdJKilled->setGeometry(QRect(260, 40, 81, 61));
    lcdJKilled->setFrameShape(QFrame::NoFrame);
    lcdJKilled->setNumDigits(7);
    lcdJKilled->setSegmentStyle(QLCDNumber::Flat);
    label_4 = new QLabel(centralwidget);
    label_4->setObjectName(QString::fromUtf8("label_4"));
    label_4->setGeometry(QRect(370, 10, 101, 18));
    lcdJCompletted = new QLCDNumber(centralwidget);
    lcdJCompletted->setObjectName(QString::fromUtf8("lcdJCompletted"));
    lcdJCompletted->setGeometry(QRect(380, 40, 81, 61));
    lcdJCompletted->setFrameShape(QFrame::NoFrame);
    lcdJCompletted->setNumDigits(7);
    lcdJCompletted->setSegmentStyle(QLCDNumber::Flat);
    MainWindow->setCentralWidget(centralwidget);
    menubar = new QMenuBar(MainWindow);
    menubar->setObjectName(QString::fromUtf8("menubar"));
    menubar->setGeometry(QRect(0, 0, 498, 19));
    MainWindow->setMenuBar(menubar);
    statusbar = new QStatusBar(MainWindow);
    statusbar->setObjectName(QString::fromUtf8("statusbar"));
    MainWindow->setStatusBar(statusbar);

    retranslateUi(MainWindow);

    QMetaObject::connectSlotsByName(MainWindow);
    } // setupUi

    void retranslateUi(QMainWindow *MainWindow)
    {
    MainWindow->setWindowTitle(QApplication::translate("MainWindow",
"MainWindow", 0, QApplication::UnicodeUTF8));
    lcdJSubmitted->setToolTip(QApplication::translate("MainWindow", "display
number of jobs submitted", 0, QApplication::UnicodeUTF8));
    label->setText(QApplication::translate("MainWindow", "Jobs Submitted",
0, QApplication::UnicodeUTF8));
    label_2->setText(QApplication::translate("MainWindow", "Jobs Running",
0, QApplication::UnicodeUTF8));
    lcdJRunning->setToolTip(QApplication::translate("MainWindow", "Jobs
Currently Running", 0, QApplication::UnicodeUTF8));
    label_3->setText(QApplication::translate("MainWindow", "Jobs Killed", 0,
QApplication::UnicodeUTF8));
    label_4->setText(QApplication::translate("MainWindow", "Jobs Completed",
0, QApplication::UnicodeUTF8));
    Q_UNUSED(MainWindow);
    } // retranslateUi

};

/*namespace Ui {
    class MainWindow: public Ui_MainWindow {};
} // namespace Ui
*/
#endif // UI_JOBSCOUNTER_H


----------------------------------------------------------------------------


Thanks & Regards
Arun Ragini



-- 
 [ signature omitted ] 

Message 2 in thread

Hi,

The problem is exactly what the error message proposed. You designed a
QMainWindow, but you're trying to pass a QDialog to setupUi(). QDialog
is not QMainWindow. Hope this helps.

-- 
 [ signature omitted ]