forked from ccsens_hardware/qt_qcp_show
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.2 KiB
44 lines
1.2 KiB
#include "cqwidgetspinbox.h"
|
|
|
|
CQWidgetSpinBox::CQWidgetSpinBox(QWidget *parent) : QWidget(parent)
|
|
{
|
|
// this->setFocusPolicy(Qt::StrongFocus);
|
|
// this->setStyleSheet(QString::fromUtf8("border:1px solid"));
|
|
this->init();
|
|
}
|
|
|
|
void CQWidgetSpinBox::focusInEvent(QFocusEvent *event)
|
|
{
|
|
QWidget::focusInEvent(event);
|
|
emit GetFocus();
|
|
}
|
|
|
|
void CQWidgetSpinBox::focusOutEvent(QFocusEvent *event)
|
|
{
|
|
QWidget::focusOutEvent(event);
|
|
emit LostFocus();
|
|
}
|
|
|
|
void CQWidgetSpinBox::init()
|
|
{
|
|
m_lineEdit = new QLineEdit;
|
|
m_toolButtonUp = new QToolButton;
|
|
m_toolButtonDown = new QToolButton;
|
|
m_hLayout = new QHBoxLayout;
|
|
m_vLayout = new QVBoxLayout;
|
|
|
|
// m_lineEdit->setStyleSheet("color: rgb(255, 255, 255);font: 10pt 'Adobe 黑体 Std R'';");
|
|
// m_lineEdit->setFixedSize(60,20);;
|
|
m_toolButtonUp->setFixedSize(15,11);
|
|
m_toolButtonDown->setFixedSize(15,11);
|
|
m_vLayout->addWidget(m_toolButtonUp);
|
|
m_vLayout->addWidget(m_toolButtonDown);
|
|
m_hLayout->addWidget(m_lineEdit);
|
|
m_hLayout->addLayout(m_vLayout);
|
|
setContentsMargins(0,0,0,0);
|
|
m_vLayout->setSpacing(0);
|
|
m_vLayout->setMargin(0);
|
|
m_hLayout->setSpacing(0);
|
|
m_hLayout->setMargin(0);
|
|
setLayout(m_hLayout);
|
|
}
|
|
|