form.h:
C++ (Qt)
#ifndef testh
#define testh
//#include "myQueue.h"
#include <QDialog>
class QLineEdit;
class QPushButton;
class QSpinBox;
class QLabel;
class QTextEdit;
class Queue;
class Window : public QDialog
{
Q_OBJECT
public:
explicit Window(QWidget *parent=0);
signals:
private slots:
void addPress();
//void popPress();
//void EpopPress();
//void output();
private:
QPushButton* add;
QPushButton* pop;
QPushButton* Epop;
QLabel* idL;
QLineEdit* id;
QLabel* timeL;
QSpinBox* time;
QTextEdit* rezult;
Queue* queue;
};
#endif
form.cpp:
C++ (Qt)
#include <QtGui>
#include "form.h"
#include "myQueue.h"
//#include "staticQueue.h"
Window::Window(QWidget *parent) : QDialog(parent)
{
//Объявление
setWindowTitle(trUtf8("очередь"));
add = new QPushButton(trUtf8("Добавить"));
pop = new QPushButton(trUtf8("Извлеч"));
Epop = new QPushButton(trUtf8("Эк.И"));
idL = new QLabel(trUtf8("Код"));
id = new QLineEdit;
timeL = new QLabel(trUtf8("Время"));;
time = new QSpinBox;
rezult = new QTextEdit;
rezult->setReadOnly(true);
queue = new Queue;
//Signals
connect(add, SIGNAL(clicked()), this, SLOT(addPress));
// connect(pop, SIGNAL(clicked()), this, SLOT(popPress));
// connect(Epop, SIGNAL(clicked()), this, SLOT(EpopPress));
//Компоновка
QVBoxLayout* rl = new QVBoxLayout;
rl->addWidget(add);
rl->addWidget(pop);
rl->addWidget(Epop);
rl->addStretch();
QVBoxLayout* ll = new QVBoxLayout;
ll->addWidget(idL);
ll->addWidget(id);
ll->addWidget(timeL);
ll->addWidget(time);
ll->addStretch();
QHBoxLayout* ml = new QHBoxLayout;
ml->addWidget(rezult);
ml->addLayout(ll);
ml->addLayout(rl);
setLayout(ml);
setGeometry(50,50,sizeHint().width(),sizeHint().height());
}
void Window::addPress()
{
rezult->setText(id->displayText());
}
Нужно, что бы по нажатию кнопки add в rezult записывался текст.