46 lines
777 B
C++
46 lines
777 B
C++
/**
|
|
* @file PaiSpinBox.h
|
|
* @brief PaiSpinBox是P.A.I系统定制发布的微调文本框控件
|
|
* @date 2011-10-23
|
|
*/
|
|
#include <QVariant>
|
|
|
|
#include "PaiSpinBox.h"
|
|
|
|
using namespace pai::gui;
|
|
|
|
PaiSpinBox::PaiSpinBox(QWidget *pParent) :
|
|
QSpinBox(pParent)
|
|
{
|
|
}
|
|
|
|
void PaiSpinBox::SetStyle(EControlStyle style, bool has)
|
|
{
|
|
if(style == ErrorFlag)
|
|
{
|
|
setProperty("IsError", QVariant(has));
|
|
update();
|
|
}
|
|
}
|
|
|
|
void PaiSpinBox::fixup(QString & input) const
|
|
{
|
|
if(!prefix().isEmpty())
|
|
{
|
|
input.remove(0, prefix().length());
|
|
}
|
|
if(!suffix().isEmpty())
|
|
{
|
|
input.chop(suffix().length());
|
|
}
|
|
|
|
if(input.isEmpty())
|
|
{
|
|
input = QString::number(minimum());
|
|
}
|
|
else
|
|
{
|
|
QSpinBox::fixup(input);
|
|
}
|
|
}
|