I have created a form in QT Designer: here is the file generated
ui_testemysql3.h
/********************************************************************************
** Form generated from reading ui file 'testemysql3.ui'
**
** Created: Tue 19. Aug 11:41:43 2008
** by: Qt User Interface Compiler version 4.4.0
**
** WARNING! All changes made in this file will be lost when recompiling ui file!
********************************************************************************/
#ifndef UI_TESTEMYSQL3_H
#define UI_TESTEMYSQL3_H
#include <QtCore/QVariant>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
#include <QtGui/QGridLayout>
#include <QtGui/QHBoxLayout>
#include <QtGui/QLabel>
#include <QtGui/QLineEdit>
#include <QtGui/QPushButton>
#include <QtGui/QVBoxLayout>
#include <QtGui/QWidget>
QT_BEGIN_NAMESPACE
class Ui_testemysql3Class
{
public:
void setupUi
(QWidget *testemysql3Class
) {
if (testemysql3Class->objectName().isEmpty())
testemysql3Class
->setObjectName
(QString::fromUtf8("testemysql3Class"));
testemysql3Class->resize(275, 98);
gridLayout->setSpacing(6);
gridLayout->setMargin(11);
gridLayout
->setObjectName
(QString::fromUtf8("gridLayout"));
verticalLayout->setSpacing(6);
verticalLayout
->setObjectName
(QString::fromUtf8("verticalLayout"));
horizontalLayout->setSpacing(6);
horizontalLayout
->setObjectName
(QString::fromUtf8("horizontalLayout"));
label
= new QLabel(testemysql3Class
);
label
->setObjectName
(QString::fromUtf8("label"));
horizontalLayout->addWidget(label);
lineEdit
->setObjectName
(QString::fromUtf8("lineEdit"));
horizontalLayout->addWidget(lineEdit);
pushButton
->setObjectName
(QString::fromUtf8("pushButton"));
horizontalLayout->addWidget(pushButton);
verticalLayout->addLayout(horizontalLayout);
pushButton_2
->setObjectName
(QString::fromUtf8("pushButton_2"));
verticalLayout->addWidget(pushButton_2);
gridLayout->addLayout(verticalLayout, 0, 0, 1, 1);
retranslateUi(testemysql3Class);
} // setupUi
void retranslateUi
(QWidget *testemysql3Class
) {
testemysql3Class
->setWindowTitle
(QApplication::translate("testemysql3Class",
"testemysql3",
0,
QApplication::UnicodeUTF8));
Q_UNUSED(testemysql3Class);
} // retranslateUi
};
namespace Ui {
class testemysql3Class: public Ui_testemysql3Class {};
} // namespace Ui
QT_END_NAMESPACE
#endif // UI_TESTEMYSQL3_H
/********************************************************************************
** Form generated from reading ui file 'testemysql3.ui'
**
** Created: Tue 19. Aug 11:41:43 2008
** by: Qt User Interface Compiler version 4.4.0
**
** WARNING! All changes made in this file will be lost when recompiling ui file!
********************************************************************************/
#ifndef UI_TESTEMYSQL3_H
#define UI_TESTEMYSQL3_H
#include <QtCore/QVariant>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
#include <QtGui/QGridLayout>
#include <QtGui/QHBoxLayout>
#include <QtGui/QLabel>
#include <QtGui/QLineEdit>
#include <QtGui/QPushButton>
#include <QtGui/QVBoxLayout>
#include <QtGui/QWidget>
QT_BEGIN_NAMESPACE
class Ui_testemysql3Class
{
public:
QGridLayout *gridLayout;
QVBoxLayout *verticalLayout;
QHBoxLayout *horizontalLayout;
QLabel *label;
QLineEdit *lineEdit;
QPushButton *pushButton;
QPushButton *pushButton_2;
void setupUi(QWidget *testemysql3Class)
{
if (testemysql3Class->objectName().isEmpty())
testemysql3Class->setObjectName(QString::fromUtf8("testemysql3Class"));
testemysql3Class->resize(275, 98);
gridLayout = new QGridLayout(testemysql3Class);
gridLayout->setSpacing(6);
gridLayout->setMargin(11);
gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
verticalLayout = new QVBoxLayout();
verticalLayout->setSpacing(6);
verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
horizontalLayout = new QHBoxLayout();
horizontalLayout->setSpacing(6);
horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout"));
label = new QLabel(testemysql3Class);
label->setObjectName(QString::fromUtf8("label"));
horizontalLayout->addWidget(label);
lineEdit = new QLineEdit(testemysql3Class);
lineEdit->setObjectName(QString::fromUtf8("lineEdit"));
horizontalLayout->addWidget(lineEdit);
pushButton = new QPushButton(testemysql3Class);
pushButton->setObjectName(QString::fromUtf8("pushButton"));
horizontalLayout->addWidget(pushButton);
verticalLayout->addLayout(horizontalLayout);
pushButton_2 = new QPushButton(testemysql3Class);
pushButton_2->setObjectName(QString::fromUtf8("pushButton_2"));
verticalLayout->addWidget(pushButton_2);
gridLayout->addLayout(verticalLayout, 0, 0, 1, 1);
retranslateUi(testemysql3Class);
QMetaObject::connectSlotsByName(testemysql3Class);
} // setupUi
void retranslateUi(QWidget *testemysql3Class)
{
testemysql3Class->setWindowTitle(QApplication::translate("testemysql3Class", "testemysql3", 0, QApplication::UnicodeUTF8));
label->setText(QApplication::translate("testemysql3Class", "Teste", 0, QApplication::UnicodeUTF8));
pushButton->setText(QApplication::translate("testemysql3Class", "PushButton", 0, QApplication::UnicodeUTF8));
pushButton_2->setText(QApplication::translate("testemysql3Class", "Close", 0, QApplication::UnicodeUTF8));
Q_UNUSED(testemysql3Class);
} // retranslateUi
};
namespace Ui {
class testemysql3Class: public Ui_testemysql3Class {};
} // namespace Ui
QT_END_NAMESPACE
#endif // UI_TESTEMYSQL3_H
To copy to clipboard, switch view to plain text mode
main.cpp
#include <QtGui/QApplication>
#include "testemysql3.h"
int main(int argc, char *argv[])
{
testemysql3 w;
w.show();
return a.exec();
}
#include <QtGui/QApplication>
#include "testemysql3.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
testemysql3 w;
w.show();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
testemysql3.h
#ifndef TESTEMYSQL3_H
#define TESTEMYSQL3_H
#include <QtGui/QWidget>
#include "ui_testemysql3.h"
{
Q_OBJECT
public:
testemysql3
(QWidget *parent
= 0, Qt
::WFlags flags
= 0);
~testemysql3();
private:
Ui::testemysql3Class ui;
private slots:
void on_pushButton_clicked();
void on_pushButton_2_clicked();
};
#endif // TESTEMYSQL3_H
#ifndef TESTEMYSQL3_H
#define TESTEMYSQL3_H
#include <QtGui/QWidget>
#include "ui_testemysql3.h"
class QLineEdit;
class testemysql3 : public QWidget
{
Q_OBJECT
public:
testemysql3(QWidget *parent = 0, Qt::WFlags flags = 0);
~testemysql3();
private:
Ui::testemysql3Class ui;
private slots:
void on_pushButton_clicked();
void on_pushButton_2_clicked();
};
#endif // TESTEMYSQL3_H
To copy to clipboard, switch view to plain text mode
testemysql3.cpp
#include "testemysql3.h"
#include <QApplication>
#include <QLineEdit>
testemysql3
::testemysql3(QWidget *parent, Qt
::WFlags flags
){
ui.setupUi(this);
}
testemysql3::~testemysql3()
{
}
void testemysql3::on_pushButton_2_clicked()
{
close();
}
void testemysql3::on_pushButton_clicked()
{
lineEdit->setText("Olha o Texto");
}
#include "testemysql3.h"
#include <QApplication>
#include <QLineEdit>
testemysql3::testemysql3(QWidget *parent, Qt::WFlags flags)
: QWidget(parent, flags)
{
ui.setupUi(this);
}
testemysql3::~testemysql3()
{
}
void testemysql3::on_pushButton_2_clicked()
{
close();
}
void testemysql3::on_pushButton_clicked()
{
lineEdit->setText("Olha o Texto");
}
To copy to clipboard, switch view to plain text mode
When I try to compile I got this error:
------ Build started: Project: testemysql3, Configuration: Debug Win32 ------
Moc'ing testemysql3.h...
Compiling...
moc_testemysql3.cpp
testemysql3.cpp
.\testemysql3.cpp(26) : error C2065: 'lineEdit' : undeclared identifier
.\testemysql3.cpp(26) : error C2227: left of '->setText' must point to class/struct/union/generic type
type is ''unknown-type''
main.cpp
Generating Code...
Build log was saved at "file://c:\Documents and Settings\Renan\Meus documentos\Visual Studio 2005\Projects\testemysql3\testemysql3\Debug\BuildL og.htm"
testemysql3 - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Whats wrong?
Renan
Bookmarks