#indef Randoms_H
#define Randoms_H
#include <QWidget>
#include <QLabel>
#include <QPushButton>
#include <QLineEdit>
#include <QTimer>
using namespace std;
{
Q_Object
public:
//constructor
Randoms();
private slots:
//set timer
void set_Timer();
//display numbers
void displayMessage();
void changeTimerValue();
private:
//widget data members
QpushButton* cancelButton;
//timer
//sets the GUI
void setUpGUI();
};
#endif
#indef Randoms_H
#define Randoms_H
#include <QWidget>
#include <QLabel>
#include <QPushButton>
#include <QLineEdit>
#include <QTimer>
using namespace std;
class Randoms:public QWidget
{
Q_Object
public:
//constructor
Randoms();
private slots:
//set timer
void set_Timer();
//display numbers
void displayMessage();
void changeTimerValue();
private:
//widget data members
QLabel* timerLabel;
QLineEdit* m_timer_entry;
QPushButton* okButton;
QpushButton* cancelButton;
//timer
QTimer* m_timer;
//sets the GUI
void setUpGUI();
};
#endif
To copy to clipboard, switch view to plain text mode
#include <stdlib.h>
#include <time.h>
#include <QWidget>
#include <QGridLayout>
#include <QLabel>
#include <QPushButton>
#include <QTimer>
#include <QMessageBox>
#include <"randoms.h">
Randoms::Randoms()
{
setWindowTitle("Numbers");
m_timer_entry->setText("10");
layout->addWidget(timer_value, 0, 0);
layout->addWidget(m_timer_entry, 0, 1);
layout->addWidget(set_timer, 1, 1)
m_timer->setInterval(10),
m_timer->start();
m_started = true,
QObject::connect(set_timer,
SIGNAL(clicked
()),
this,
SLOT(changeTimerValue
()),
QObject::connect(m_timer,
SIGNAL(timeout
(),
this,
SLOT(displayMessage
()));
}
#include <stdlib.h>
#include <time.h>
#include <QWidget>
#include <QGridLayout>
#include <QLabel>
#include <QPushButton>
#include <QTimer>
#include <QMessageBox>
#include <"randoms.h">
Randoms::Randoms()
{
setWindowTitle("Numbers");
QGridLayout* layout = new QGridLayout (this),
QLabel* timer_value = new QLabel("Timer Interval")
m_timer_entry = new QLineEdit(),
QPushButton* set_timer = new QPushButton("Set Timer");
m_timer_entry->setText("10");
layout->addWidget(timer_value, 0, 0);
layout->addWidget(m_timer_entry, 0, 1);
layout->addWidget(set_timer, 1, 1)
m_timer = new QTimer(this),
m_timer->setInterval(10),
m_timer->start();
m_started = true,
QObject::connect(set_timer, SIGNAL(clicked()), this, SLOT(changeTimerValue()),
QObject::connect(m_timer, SIGNAL(timeout(), this, SLOT(displayMessage()));
}
To copy to clipboard, switch view to plain text mode
Bookmarks