arbitrarytime.cpp
46 lines
| 1.3 KiB
| text/x-c
|
CppLexer
/ paulcommon / arbitrarytime.cpp
r50 | #include "arbitrarytime.h" | |||
ArbitraryTime::ArbitraryTime(char option, QWidget *parent) : | ||||
QWidget(parent) | ||||
{ | ||||
QRegExp timeToSendRegExp("[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]"); | ||||
validator = new QRegExpValidator(timeToSendRegExp); | ||||
r62 | paulCommonCRC = new PaulCommonCRC(); | |||
r50 | ||||
timeToSend = new QLineEdit(); | ||||
main_HLAYOUT = new QHBoxLayout; | ||||
main_VLAYOUT = new QVBoxLayout; | ||||
timeToSend_LABEL = new QLabel("Arbitrary Time: 0x"); | ||||
timeToSend_LABEL->setAlignment(Qt::AlignRight); | ||||
timeToSend->setMaxLength(8); | ||||
timeToSend->setValidator(validator); | ||||
timeToSend->setText("80000000"); | ||||
currentTimeToSend = 0x80000000; | ||||
if (option == 1) | ||||
{ | ||||
main_HLAYOUT->addWidget(timeToSend_LABEL); | ||||
main_HLAYOUT->addWidget(timeToSend); | ||||
main_HLAYOUT->addStretch(); | ||||
this->setLayout(main_HLAYOUT); | ||||
} | ||||
else | ||||
{ | ||||
main_VLAYOUT->addWidget(timeToSend_LABEL); | ||||
main_VLAYOUT->addWidget(timeToSend); | ||||
main_VLAYOUT->addStretch(); | ||||
this->setLayout(main_VLAYOUT); | ||||
} | ||||
connect(this->timeToSend, SIGNAL(editingFinished()), | ||||
this, SLOT(editingFinishedSLOT())); | ||||
} | ||||
void ArbitraryTime::editingFinishedSLOT() | ||||
{ | ||||
currentTimeToSend = timeToSend->text().toLong(0, 16); | ||||
r62 | emit timeToSendChanged( currentTimeToSend); | |||
r50 | } | |||