mirror of
https://github.com/LongSoft/UEFITool.git
synced 2025-05-23 19:47:06 -04:00
NE Alpha 38
This commit is contained in:
parent
f410b0f969
commit
0e09dfe1b2
24 changed files with 8383 additions and 45 deletions
37
UEFITool/hexspinbox.cpp
Normal file
37
UEFITool/hexspinbox.cpp
Normal file
|
@ -0,0 +1,37 @@
|
|||
/* hexspinbox.cpp
|
||||
|
||||
Copyright (c) 2016, Nikolaj Schlej. All rights reserved.
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
*/
|
||||
|
||||
#include "hexspinbox.h"
|
||||
#include <QDebug>
|
||||
|
||||
HexSpinBox::HexSpinBox(QWidget *parent) :
|
||||
QSpinBox(parent), validator(QRegExp("0x([0-9a-fA-F]){1,8}"))
|
||||
{
|
||||
this->setRange(0, INT_MAX);
|
||||
this->setPrefix("0x");
|
||||
}
|
||||
|
||||
QValidator::State HexSpinBox::validate(QString &text, int &pos) const
|
||||
{
|
||||
return validator.validate(text, pos);
|
||||
}
|
||||
|
||||
QString HexSpinBox::textFromValue(int val) const
|
||||
{
|
||||
return QString::number(val, 16).toUpper();
|
||||
}
|
||||
|
||||
int HexSpinBox::valueFromText(const QString &text) const
|
||||
{
|
||||
return text.toInt(NULL, 16);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue