#include "knop.h"
#include "bc.h"
#include <QVariant>
#include <QLineEdit>
#include <QPushButton>
#include <QString>
#include <QApplication>
#include <QMessageBox>
#include <QTimer>
{
setMaximumSize
( QSize( 50,
50 ) );
label
= new QLabel("label",
this);
label
->setGeometry
( QRect( 0,
0,
50,
50 ) );
label->setText("");
but
->setGeometry
( QRect( 0,
0,
50,
50 ) );
but->setCheckable(true);
but
->setFont
(QFont("Bitstream Vera Sans",
22,
QFont::Bold));
but->setFlat(true);
e
->setGeometry
( QRect( 5,
5,
40,
10 ) );
QFont e_font
( e
->font
() );
e_font.setPointSize( 10 );
e->setFont( e_font );
e->setFrame( FALSE );
resize
( QSize(50,
50).
expandedTo(minimumSizeHint
()) );
connect( but, SIGNAL(clicked()), SLOT(butClick()) );
init();
}
knop::~knop(){}
void knop::init()
{
pWit.load(progPath + "include/knopWit.png");
pRood.load(progPath + "include/knopRood.png");
pGroen.load(progPath + "include/knopGroen.png");
label->setPixmap(pWit);
but->setPalette(palWit);
e->setPalette(palWit);
}
{
but->setText(num);
current = num;
e->setText("");
}
void knop::butClick()
{
bC* bC1 = new bC(knopRij,knopCol);
}
void knop::unClick()
{
but->setChecked(false);
but->setPalette(palWit);
e->setPalette(palWit);
}
{
QTimer::singleShot(2000,
this,
SLOT(terug
()));
but->setText(hoort);
but->setPalette(palGroen);
e->setPalette(palGroen);
}
void knop::terug()
{
but->setText(current);
but->setPalette(palWit);
e->setPalette(palWit);
}
void knop::setRood()
{
but->setPalette(palRood);
e->setPalette(palRood);
QTimer::singleShot(5000,
this,
SLOT(terug
()));
}
void knop::setGroen()
{
but->setPalette(palGroen);
e->setPalette(palGroen);
QTimer::singleShot(5000,
this,
SLOT(terug
()));
}
void knop::clearEdit()
{
e->setText("");
}
#include "knop.h"
#include "bc.h"
#include <QVariant>
#include <QLineEdit>
#include <QPushButton>
#include <QString>
#include <QApplication>
#include <QMessageBox>
#include <QTimer>
knop::knop(QWidget* parent)
: QWidget(parent)
{
setMaximumSize( QSize( 50, 50 ) );
label = new QLabel("label", this);
label->setGeometry( QRect( 0, 0, 50, 50 ) );
label->setText("");
but = new QPushButton("but", this);
but->setGeometry( QRect( 0, 0, 50, 50 ) );
but->setCheckable(true);
but->setFont(QFont("Bitstream Vera Sans",22,QFont::Bold));
but->setFlat(true);
e = new QLineEdit("e", this);
e->setGeometry( QRect( 5, 5, 40, 10 ) );
QFont e_font( e->font() );
e_font.setPointSize( 10 );
e->setFont( e_font );
e->setFrame( FALSE );
resize( QSize(50, 50).expandedTo(minimumSizeHint()) );
connect( but, SIGNAL(clicked()), SLOT(butClick()) );
init();
}
knop::~knop(){}
void knop::init()
{
progPath = QCoreApplication::applicationDirPath() + "/";
pWit.load(progPath + "include/knopWit.png");
pRood.load(progPath + "include/knopRood.png");
pGroen.load(progPath + "include/knopGroen.png");
palWit.setColor(QPalette::Base,QColor(255,255,255));
palWit.setColor(QPalette::Button,QColor(255,255,255,0));
palWit.setColor(QPalette::Text,QColor(0,0,0,255));
palWit.setColor(QPalette::ButtonText,QColor(0,0,0,255));
palRood.setColor(QPalette::Base,QColor(255,0,0));
palRood.setColor(QPalette::Text,QColor(0,0,0,255));
palRood.setColor(QPalette::ButtonText,QColor(0,0,0,255));
palGroen.setColor(QPalette::Base,QColor(0,255,0));
palGroen.setColor(QPalette::Text,QColor(0,0,0,255));
palGroen.setColor(QPalette::ButtonText,QColor(0,0,0,255));
palClick.setColor(QPalette::Base,QColor(200,200,200));
palClick.setColor(QPalette::Button,QColor(200,200,200,255));
palClick.setColor(QPalette::Text,QColor(0,0,0,255));
palClick.setColor(QPalette::ButtonText,QColor(0,0,0,255));
label->setPixmap(pWit);
but->setPalette(palWit);
e->setPalette(palWit);
}
void knop::setNum(QString num)
{
but->setText(num);
current = num;
e->setText("");
}
void knop::butClick()
{
bC* bC1 = new bC(knopRij,knopCol);
QApplication::postEvent(this->parent()->parent(), bC1);
}
void knop::unClick()
{
but->setChecked(false);
but->setPalette(palWit);
e->setPalette(palWit);
}
void knop::hint(QString hoort)
{
QTimer::singleShot(2000, this, SLOT(terug()));
but->setText(hoort);
but->setPalette(palGroen);
e->setPalette(palGroen);
}
void knop::terug()
{
but->setText(current);
but->setPalette(palWit);
e->setPalette(palWit);
}
void knop::setRood()
{
but->setPalette(palRood);
e->setPalette(palRood);
QTimer::singleShot(5000, this, SLOT(terug()));
}
void knop::setGroen()
{
but->setPalette(palGroen);
e->setPalette(palGroen);
QTimer::singleShot(5000, this, SLOT(terug()));
}
void knop::clearEdit()
{
e->setText("");
}
To copy to clipboard, switch view to plain text mode
Bookmarks