Debian Codegraph @

byteconverterchar.cpp

raw symbols SCIP
1 // File: byteconverterchar.cpp
2 /*
3 Pep8-1 is a virtual machine for writing machine language and assembly
4 language programs.
5
6 Copyright (C) 2009 J. Stanley Warford, Pepperdine University
7
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21 #include "byteconverterchar.h"
22 #include "ui_byteconverterchar.h"
23
24 ByteConverterChar::ByteConverterChar(QWidget *parent) :
25 QWidget(parent),
26 ui(new Ui::ByteConverterChar)
27 {
28 ui->setupUi(this);
29 // Regular expression to validate a single character
30 QRegExp charRx("(.){0,1}");
31 charValidator = new QRegExpValidator(charRx, this);
32 ui->lineEdit->setValidator(charValidator);
33 // Forward the textEdited() signal from ui->lineEdit up to the main window
34 QObject::connect(ui->lineEdit, SIGNAL(textEdited(const QString &)), this,
35 SIGNAL(textEdited(const QString &)));
36 }
37
38 ByteConverterChar::~ByteConverterChar()
39 {
40 delete ui;
41 }
42
43 void ByteConverterChar::setValue(int value)
44 {
45 ui->lineEdit->setText(QString(QChar(value)));
46 }