#ifndef KEYPAD_H_
#define KEYPAD_H_
#include <QWidget>
#include <QApplication>
#include <QFont>
#include <QPushButton>
#include <QMainWindow>
#include <QLabel>
#include <QScrollArea>
#include <QMouseEvent>
#include <iostream>
#include <X11/Xlib.h>
#include <QLineEdit>
#include <iostream>
#include <QObject>
{
Q_OBJECT
public slots:
void button_1_clicked();
public:
};
void Keypad::button_1_clicked()
{
std::cout << "Clicked";
}
{
//get the screen resolution
Display* dpy = XOpenDisplay(0);
int xscreenres = DisplayWidth(dpy, DefaultScreen(dpy));
int yscreenres = DisplayHeight(dpy, DefaultScreen(dpy));
//the text box
password->setGeometry(((xscreenres/2) - 190), ((yscreenres/2) - 270), 380, 80);
password->setAlignment(Qt::AlignHCenter);
password->setMaxLength(8);
password->setEnabled(false);
Button_1->setGeometry((xscreenres/2) - 190, (yscreenres/2) - 125, 120, 120);
Button_1
->setFont
(QFont("Times",
40,
QFont::Bold));
connect(Button_1, SIGNAL(clicked()), this, SLOT(button_1_clicked()));
Button_2->setGeometry((xscreenres/2) - 60, (yscreenres/2) - 125, 120, 120);
Button_2
->setFont
(QFont("Times",
40,
QFont::Bold));
Button_3->setGeometry((xscreenres/2) + 70, (yscreenres/2) - 125, 120, 120);
Button_3
->setFont
(QFont("Times",
40,
QFont::Bold));
Button_4->setGeometry((xscreenres/2) - 190, (yscreenres/2) + 5, 120, 120);
Button_4
->setFont
(QFont("Times",
40,
QFont::Bold));
Button_5->setGeometry((xscreenres/2) - 60, (yscreenres/2) + 5, 120, 120);
Button_5
->setFont
(QFont("Times",
40,
QFont::Bold));
Button_6->setGeometry((xscreenres/2) + 70, (yscreenres/2) + 5, 120, 120);
Button_6
->setFont
(QFont("Times",
40,
QFont::Bold));
Button_7->setGeometry((xscreenres/2) - 190, (yscreenres/2) + 135, 120, 120);
Button_7
->setFont
(QFont("Times",
40,
QFont::Bold));
Button_8->setGeometry((xscreenres/2) - 60, (yscreenres/2) + 135, 120, 120);
Button_8
->setFont
(QFont("Times",
40,
QFont::Bold));
Button_9->setGeometry((xscreenres/2) + 70, (yscreenres/2) + 135, 120, 120);
Button_9
->setFont
(QFont("Times",
40,
QFont::Bold));
Button_10->setGeometry((xscreenres/2) - 190, (yscreenres/2) + 265, 120, 120);
Button_10
->setFont
(QFont("Times",
30,
QFont::Bold));
Button_11->setGeometry((xscreenres/2) - 60, (yscreenres/2) + 265, 120, 120);
Button_11
->setFont
(QFont("Times",
40,
QFont::Bold));
Button_12->setGeometry((xscreenres/2) + 70, (yscreenres/2) + 265, 120, 120);
Button_12
->setFont
(QFont("Times",
30,
QFont::Bold));
//connect(Button_1, SIGNAL(clicked()), qApp, SLOT(quit()));
}
#endif /*KEYPAD_H_*/
#ifndef KEYPAD_H_
#define KEYPAD_H_
#include <QWidget>
#include <QApplication>
#include <QFont>
#include <QPushButton>
#include <QMainWindow>
#include <QLabel>
#include <QScrollArea>
#include <QMouseEvent>
#include <iostream>
#include <X11/Xlib.h>
#include <QLineEdit>
#include <iostream>
#include <QObject>
class Keypad : public QWidget
{
Q_OBJECT
public slots:
void button_1_clicked();
public:
Keypad(QWidget *parent = 0);
};
void Keypad::button_1_clicked()
{
std::cout << "Clicked";
}
Keypad::Keypad(QWidget *parent) : QWidget(parent)
{
//get the screen resolution
Display* dpy = XOpenDisplay(0);
int xscreenres = DisplayWidth(dpy, DefaultScreen(dpy));
int yscreenres = DisplayHeight(dpy, DefaultScreen(dpy));
//the text box
QLineEdit *password = new QLineEdit(this);
password->setGeometry(((xscreenres/2) - 190), ((yscreenres/2) - 270), 380, 80);
password->setAlignment(Qt::AlignHCenter);
password->setMaxLength(8);
password->setEnabled(false);
password->setEchoMode(QLineEdit::Password);
QPushButton *Button_1 = new QPushButton(tr("1"), this);
Button_1->setGeometry((xscreenres/2) - 190, (yscreenres/2) - 125, 120, 120);
Button_1->setFont(QFont("Times", 40, QFont::Bold));
connect(Button_1, SIGNAL(clicked()), this, SLOT(button_1_clicked()));
QPushButton *Button_2 = new QPushButton(tr("2"), this);
Button_2->setGeometry((xscreenres/2) - 60, (yscreenres/2) - 125, 120, 120);
Button_2->setFont(QFont("Times", 40, QFont::Bold));
QPushButton *Button_3 = new QPushButton(tr("3"), this);
Button_3->setGeometry((xscreenres/2) + 70, (yscreenres/2) - 125, 120, 120);
Button_3->setFont(QFont("Times", 40, QFont::Bold));
QPushButton *Button_4 = new QPushButton(tr("4"), this);
Button_4->setGeometry((xscreenres/2) - 190, (yscreenres/2) + 5, 120, 120);
Button_4->setFont(QFont("Times", 40, QFont::Bold));
QPushButton *Button_5 = new QPushButton(tr("5"), this);
Button_5->setGeometry((xscreenres/2) - 60, (yscreenres/2) + 5, 120, 120);
Button_5->setFont(QFont("Times", 40, QFont::Bold));
QPushButton *Button_6 = new QPushButton(tr("6"), this);
Button_6->setGeometry((xscreenres/2) + 70, (yscreenres/2) + 5, 120, 120);
Button_6->setFont(QFont("Times", 40, QFont::Bold));
QPushButton *Button_7 = new QPushButton(tr("7"), this);
Button_7->setGeometry((xscreenres/2) - 190, (yscreenres/2) + 135, 120, 120);
Button_7->setFont(QFont("Times", 40, QFont::Bold));
QPushButton *Button_8 = new QPushButton(tr("8"), this);
Button_8->setGeometry((xscreenres/2) - 60, (yscreenres/2) + 135, 120, 120);
Button_8->setFont(QFont("Times", 40, QFont::Bold));
QPushButton *Button_9 = new QPushButton(tr("9"), this);
Button_9->setGeometry((xscreenres/2) + 70, (yscreenres/2) + 135, 120, 120);
Button_9->setFont(QFont("Times", 40, QFont::Bold));
QPushButton *Button_10 = new QPushButton(tr("Clear"), this);
Button_10->setGeometry((xscreenres/2) - 190, (yscreenres/2) + 265, 120, 120);
Button_10->setFont(QFont("Times", 30, QFont::Bold));
QPushButton *Button_11 = new QPushButton(tr("0"), this);
Button_11->setGeometry((xscreenres/2) - 60, (yscreenres/2) + 265, 120, 120);
Button_11->setFont(QFont("Times", 40, QFont::Bold));
QPushButton *Button_12 = new QPushButton(tr("Enter"), this);
Button_12->setGeometry((xscreenres/2) + 70, (yscreenres/2) + 265, 120, 120);
Button_12->setFont(QFont("Times", 30, QFont::Bold));
//connect(Button_1, SIGNAL(clicked()), qApp, SLOT(quit()));
}
#endif /*KEYPAD_H_*/
To copy to clipboard, switch view to plain text mode
Bookmarks