Hi all:
I am reading QT Assistan examples, and i am trying to create my for based on designer/Calculator Form example. I have found 2 problems, first i read that if you use in the SOURCES a declaration like this
|
Source code
|
1
|
#include "ui_frmspin.h"
|
qmake generates automaticaly this file. I use this nomenclature, but i can't generate it automaticaly, instead i do a
|
Source code
|
1
|
uic frmspin.ui -o ui_frmspin.h
|
This solved the first problem, but when i tried to complie all the sources i reveived this error.
src\frmspin.cpp: In constructor 'frmspin::frmspin(QWidget*':
src\frmspin.cpp:8 error: no matching function for call to 'Ui::frmspin::setupUi(frmspin* const)'
inlcude/ui_fr,spin.h:38: note: candidates are: void Ui_frmspin::setupUi(QMainWindow*)
You guys can help me with this, i'm stucked!!!
Here are my code
frmspin.h
|
Source code
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#ifndef FRMSPIN_H
#define FRMSPIN_H
#include "ui_frmspin.h"
class frmspin : public QWidget
{
Q_OBJECT
public:
frmspin(QWidget *parent = 0);
private slots:
void on_sb_input_a_valueChanged(int value);
void on_sb_input_b_valueChanged(int value);
private:
Ui::frmspin gui;
};
#endif
|
frmspin.cpp
|
Source code
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
include <QtGui>
#include "include/frmspin.h"
frmspin::frmspin(QWidget *parent)
: QWidget(parent)
{
gui.setupUi(this);
}
void frmspin::on_sb_input_a_valueChanged(int value)
{
gui.lblResult->setText(QString::number(value + gui.sb_input_b->value()));
}
void frmspin::on_sb_input_b_valueChanged(int value)
{
gui.lblResult->setText(QString::number(value + gui.sb_input_a->value()));
}
|
main.cpp
|
Source code
|
1
2
3
4
5
6
7
8
9
10
|
#include <QApplication>
#include "include\frmspin.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
frmspin *spin = new frmspin;
spin->show();
return app.exec();
}
|
des3.pro
|
Source code
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
######################################################################
# Automatically generated by qmake (2.00a) Thu Dec 8 14:27:37 2005
######################################################################
TEMPLATE = app
TARGET +=
DEPENDPATH += . include src
INCLUDEPATH += .
# Input
HEADERS += include/frmspin.h
FORMS += src/frmspin.ui
SOURCES += src/main.cpp src/frmspin.cpp
|