ui_spinForm.h
#ifndef UI_SPINFORM_H
#define UI_SPINFORM_H
#include <QtCore/QVariant>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
#include <QtGui/QHBoxLayout>
#include <QtGui/QPushButton>
#include <QtGui/QSpinBox>
#include <QtGui/QTextBrowser>
#include <QtGui/QWidget>
class Ui_spinForm
{
public:
{
if (spinForm->objectName().isEmpty())
spinForm
->setObjectName
(QString::fromUtf8("spinForm"));
spinForm->resize(359, 370);
layoutWidget
= new QWidget(spinForm
);
layoutWidget
->setObjectName
(QString::fromUtf8("layoutWidget"));
layoutWidget
->setGeometry
(QRect(60,
10,
133,
29));
hboxLayout
->setObjectName
(QString::fromUtf8("hboxLayout"));
hboxLayout->setContentsMargins(0, 0, 0, 0);
spinBox
->setObjectName
(QString::fromUtf8("spinBox"));
spinBox->setValue(5);
hboxLayout->addWidget(spinBox);
addPushButton
->setObjectName
(QString::fromUtf8("addPushButton"));
hboxLayout->addWidget(addPushButton);
textBrowser
->setObjectName
(QString::fromUtf8("textBrowser"));
textBrowser
->setGeometry
(QRect(40,
70,
256,
192));
retranslateUi(spinForm);
} // setupUi
void retranslateUi
(QWidget *spinForm
) {
Q_UNUSED(spinForm);
} // retranslateUi
};
namespace Ui {
class spinForm: public Ui_spinForm {};
} // namespace Ui
#endif // UI_SPINFORM_H
#ifndef UI_SPINFORM_H
#define UI_SPINFORM_H
#include <QtCore/QVariant>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
#include <QtGui/QHBoxLayout>
#include <QtGui/QPushButton>
#include <QtGui/QSpinBox>
#include <QtGui/QTextBrowser>
#include <QtGui/QWidget>
class Ui_spinForm
{
public:
QWidget *layoutWidget;
QHBoxLayout *hboxLayout;
QSpinBox *spinBox;
QPushButton *addPushButton;
QTextBrowser *textBrowser;
void setupUi(QWidget *spinForm)
{
if (spinForm->objectName().isEmpty())
spinForm->setObjectName(QString::fromUtf8("spinForm"));
spinForm->resize(359, 370);
layoutWidget = new QWidget(spinForm);
layoutWidget->setObjectName(QString::fromUtf8("layoutWidget"));
layoutWidget->setGeometry(QRect(60, 10, 133, 29));
hboxLayout = new QHBoxLayout(layoutWidget);
hboxLayout->setObjectName(QString::fromUtf8("hboxLayout"));
hboxLayout->setContentsMargins(0, 0, 0, 0);
spinBox = new QSpinBox(layoutWidget);
spinBox->setObjectName(QString::fromUtf8("spinBox"));
spinBox->setValue(5);
hboxLayout->addWidget(spinBox);
addPushButton = new QPushButton(layoutWidget);
addPushButton->setObjectName(QString::fromUtf8("addPushButton"));
hboxLayout->addWidget(addPushButton);
textBrowser = new QTextBrowser(spinForm);
textBrowser->setObjectName(QString::fromUtf8("textBrowser"));
textBrowser->setGeometry(QRect(40, 70, 256, 192));
retranslateUi(spinForm);
QMetaObject::connectSlotsByName(spinForm);
} // setupUi
void retranslateUi(QWidget *spinForm)
{
spinForm->setWindowTitle(QApplication::translate("spinForm", "Try a spinbox", 0, QApplication::UnicodeUTF8));
addPushButton->setText(QApplication::translate("spinForm", "Add", 0, QApplication::UnicodeUTF8));
Q_UNUSED(spinForm);
} // retranslateUi
};
namespace Ui {
class spinForm: public Ui_spinForm {};
} // namespace Ui
#endif // UI_SPINFORM_H
To copy to clipboard, switch view to plain text mode
spinForm.h
#include "ui_spinForm.h"
{
Q_OBJECT
public:
public slots:
void setSpinBoxValue();
private:
Ui::spinForm ui;
};
#include "ui_spinForm.h"
class spinForm : public QWidget
{
Q_OBJECT
public:
spinForm(QWidget *parent = 0);
public slots:
void setSpinBoxValue();
private:
Ui::spinForm ui;
};
To copy to clipboard, switch view to plain text mode
spinForm.cpp
#include <QtGui>
#include "spinForm.h"
{
ui.setupUi(this);
connect(ui.addPushButton, SIGNAL(clicked()), this, SLOT(setSpinBoxValue()));
ui.spinBox->setValue(3);
}
void spinForm::setSpinBoxValue()
{
ui.spinBox->setValue(45);
}
#include <QtGui>
#include "spinForm.h"
spinForm::spinForm(QWidget *parent):QWidget(parent)
{
ui.setupUi(this);
connect(ui.addPushButton, SIGNAL(clicked()), this, SLOT(setSpinBoxValue()));
ui.spinBox->setValue(3);
}
void spinForm::setSpinBoxValue()
{
ui.spinBox->setValue(45);
}
To copy to clipboard, switch view to plain text mode
main.cpp
#include <QApplication>
#include "ui_spinForm.h"
int main(int argc, char *argv[])
{
Ui::spinForm ui;
ui.setupUi(widget);
widget->show();
return app.exec();
}
#include <QApplication>
#include "ui_spinForm.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QWidget *widget = new QWidget;
Ui::spinForm ui;
ui.setupUi(widget);
widget->show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
what can i do to run it in a consolle? is it helpful to see the run-time error?
cos now i'm using QT Designer and a simple text editor.
Thanks
Bookmarks