新二维码/条形码编辑逻辑
This commit is contained in:
+112
-87
@@ -16,23 +16,6 @@ DateVarSet::DateVarSet(QWidget *parent) :
|
||||
|
||||
digitWidth = 4;
|
||||
|
||||
//connect(ui->radioButtonCurDate,SIGNAL(toggled(bool)),this,SLOT( slt_handleDigits()));
|
||||
//connect(ui->radioButtonExpiry,SIGNAL(toggled(bool)),this,SLOT( slt_handleDigits()));
|
||||
// connect(ui->radioButtonVarRandom,SIGNAL(toggled(bool)),this,SLOT(onRanDomPressed(bool)));
|
||||
//connect(ui->radioButtonHour,SIGNAL(toggled(bool)),this,SLOT( slt_handleDigits()));
|
||||
// connect(ui->radioButtonMinute,SIGNAL(toggled(bool)),this,SLOT( slt_handleDigits()));
|
||||
// connect(ui->radioButtonWeek,SIGNAL(toggled(bool)),this,SLOT( slt_handleDigits()));
|
||||
// connect(ui->radioButtonMonth,SIGNAL(toggled(bool)),this,SLOT( slt_handleDigits()));
|
||||
// connect(ui->radioButtonSecond,SIGNAL(toggled(bool)),this,SLOT( slt_handleDigits()));
|
||||
// connect(ui->radioButtonDay,SIGNAL(toggled(bool)),this,SLOT( slt_handleDigits()));
|
||||
// // connect(ui->radioButtonXDay,SIGNAL(toggled(bool)),this,SLOT( slt_handleDigits()));
|
||||
// connect(ui->radioButtonYear,SIGNAL(toggled(bool)),this,SLOT( slt_handleDigits()));
|
||||
// connect(ui->radioButtonVar1,SIGNAL(toggled(bool)),this,SLOT( onDigitFourBit(bool)));
|
||||
// connect(ui->radioButtonVar2,SIGNAL(toggled(bool)),this,SLOT( onDigitFourBit(bool)));
|
||||
// connect(ui->radioButtonCNT3,SIGNAL(toggled(bool)),this,SLOT( onDigitFourBit(bool)));
|
||||
|
||||
//ui->radioButtonXDay->hide();
|
||||
|
||||
varTypeSet = 0;
|
||||
varHtmlStr = "";
|
||||
|
||||
@@ -45,6 +28,8 @@ DateVarSet::DateVarSet(QWidget *parent) :
|
||||
layout->addWidget(m_generalSettings);
|
||||
ui->generalTab->setLayout(layout);
|
||||
|
||||
applyStyleSheet();
|
||||
|
||||
init();
|
||||
|
||||
initReplaceValue();
|
||||
@@ -52,7 +37,6 @@ DateVarSet::DateVarSet(QWidget *parent) :
|
||||
|
||||
void DateVarSet::init()
|
||||
{
|
||||
applyStyleSheet();
|
||||
// 连接信号槽
|
||||
connect(ui->checkBtn, &QPushButton::clicked, this, &DateVarSet::buttonClickedSlot);
|
||||
connect(ui->closeBtn,&QPushButton::clicked, this, &DateVarSet::buttonClickedSlot);
|
||||
@@ -82,6 +66,17 @@ void DateVarSet::init()
|
||||
connect(ui->lineEdit_Replace4, &QLineEdit::textChanged, std::bind(&DateVarSet::onLineEditReplaceChanged, this, 3, std::placeholders::_1));
|
||||
}
|
||||
|
||||
void DateVarSet::initUI()
|
||||
{
|
||||
if (m_generalSettings)
|
||||
m_generalSettings->initUI();
|
||||
|
||||
ui->lineEdit_DateFormat->setText("");
|
||||
ui->expirationCBox->setCurrentIndex(0);
|
||||
ui->expirationNumCBox->setValue(0);
|
||||
ui->cb_replaceType->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
void DateVarSet::initReplaceValue(){
|
||||
monthList.clear();
|
||||
for (int i = 1; i <= 12; ++i) {
|
||||
@@ -265,7 +260,7 @@ void DateVarSet::on_buttonInsertVari_pressed()
|
||||
fontname = "Dinkie9";
|
||||
if(m_generalSettings->currentItem()) {
|
||||
fontname = m_generalSettings->font().family();
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
font.setFamily(fontname);
|
||||
@@ -308,7 +303,7 @@ void DateVarSet::on_buttonInsertVari_pressed()
|
||||
m_textEdit->insertHtml(QString("<img src=':/%1/%5/../image/digitalWidth%2.bmp' height='%3' width='%4' style=\"vertical-align: bottom;\" />")
|
||||
.arg(varType).arg(false && (pixelSize<=16)?(digitalNum*100 + 75):digitalNum)
|
||||
.arg(height+1).arg(width*digitalNum).arg(varType1)); //插入索引后
|
||||
qDebug() << m_textEdit->toHtml();
|
||||
qDebug() << m_textEdit->toHtml();
|
||||
} // 普通变量 VarType<=8
|
||||
else if(varType ==EXPIRYDATE){ //80 :/80/image/expiryDate8.bmp qrc:/80/image/expiryDate875.bmp
|
||||
// QImage img;
|
||||
@@ -513,6 +508,8 @@ void DateVarSet::setDateModel(const DateItemModel &model)
|
||||
}
|
||||
|
||||
loadMonthShow();
|
||||
|
||||
ui->tabWidget->setCurrentIndex(1);
|
||||
}
|
||||
|
||||
void DateVarSet::useReplaceInsertVar(){
|
||||
@@ -527,83 +524,111 @@ QString DateVarSet::getFamilyName(int fontsize){
|
||||
|
||||
void DateVarSet::applyStyleSheet()
|
||||
{
|
||||
QString styleSheet =
|
||||
R"(
|
||||
QString styleSheet =
|
||||
R"(
|
||||
QPushButton#closeBtn, QPushButton#checkBtn{
|
||||
background-color: #E6F7FF;
|
||||
border: 1px solid #87CEEB;
|
||||
border-radius: 4px;
|
||||
font-size: 24px;
|
||||
color: #228B22;
|
||||
}
|
||||
QPushButton#closeBtn:hover,QPushButton#checkBtn:hover{
|
||||
background-color: #D1E9FF;
|
||||
}
|
||||
|
||||
QPushButton#closeBtn, QPushButton#checkBtn{
|
||||
background-color: #E6F7FF;
|
||||
border: 1px solid #87CEEB;
|
||||
border-radius: 4px;
|
||||
font-size: 24px;
|
||||
color: #228B22;
|
||||
}
|
||||
QPushButton#closeBtn:hover,QPushButton#checkBtn:hover{
|
||||
background-color: #D1E9FF;
|
||||
}
|
||||
QPushButton#closeBtn:pressed,QPushButton#checkBtn:pressed{
|
||||
background-color: #BAE7FF;
|
||||
}
|
||||
|
||||
QPushButton#closeBtn:pressed,QPushButton#checkBtn:pressed{
|
||||
background-color: #BAE7FF;
|
||||
}
|
||||
QPushButton {
|
||||
background-color: #5396C1;
|
||||
color: #ffffff;
|
||||
border: 1px solid #000000;
|
||||
border-radius: 3px;
|
||||
font-size: 18px;
|
||||
font-weight:500;
|
||||
width: 180px;
|
||||
height: 90px;
|
||||
}
|
||||
|
||||
QPushButton {
|
||||
background-color: #5396C1;
|
||||
color: #ffffff;
|
||||
border: 1px solid #000000;
|
||||
border-radius: 3px;
|
||||
font-size: 18px;
|
||||
font-weight:500;
|
||||
width: 180px;
|
||||
height: 90px;
|
||||
}
|
||||
QPushButton:hover {
|
||||
background-color: #5396C1;
|
||||
}
|
||||
|
||||
QPushButton:hover {
|
||||
background-color: #5396C1;
|
||||
}
|
||||
QPushButton:disabled {
|
||||
background-color: #7C828E;
|
||||
color: #606060;
|
||||
border-color: #808080;
|
||||
}
|
||||
|
||||
QPushButton:disabled {
|
||||
background-color: #7C828E;
|
||||
color: #606060;
|
||||
border-color: #808080;
|
||||
}
|
||||
QComboBox {
|
||||
border: 1px solid #000000;
|
||||
border-radius: 3px;
|
||||
font-size: 14px;
|
||||
width: 180px;
|
||||
height: 90px;
|
||||
padding-left: 10px; /* 文字左边距,避免紧贴边缘 */
|
||||
}
|
||||
|
||||
QComboBox {
|
||||
border: 1px solid #000000;
|
||||
border-radius: 3px;
|
||||
font-size: 14px;
|
||||
width: 180px;
|
||||
height: 90px;
|
||||
padding-left: 10px; /* 文字左边距,避免紧贴边缘 */
|
||||
}
|
||||
/* 下拉箭头区域 */
|
||||
QComboBox::drop-down {
|
||||
border: 1px solid #333333;
|
||||
border-radius: 3px;
|
||||
width: 30px; /* 箭头区域宽度 */
|
||||
background-color: #5396C1;
|
||||
}
|
||||
|
||||
/* 下拉箭头区域 */
|
||||
QComboBox::drop-down {
|
||||
border: 1px solid #333333;
|
||||
border-radius: 3px;
|
||||
width: 30px; /* 箭头区域宽度 */
|
||||
background-color: #5396C1;
|
||||
}
|
||||
/* 下拉箭头图标 */
|
||||
QComboBox::down-arrow {
|
||||
image: url(image/down_white.png);
|
||||
width: 16px; /* 图标显示宽度 */
|
||||
height: 16px; /* 图标显示高度 */
|
||||
}
|
||||
|
||||
/* 下拉箭头图标 */
|
||||
QComboBox::down-arrow {
|
||||
image: url(image/down_white.png);
|
||||
width: 16px; /* 图标显示宽度 */
|
||||
height: 16px; /* 图标显示高度 */
|
||||
}
|
||||
/* 悬停状态 */
|
||||
QComboBox:hover {
|
||||
background-color: #efefef;
|
||||
}
|
||||
|
||||
/* 悬停状态 */
|
||||
QComboBox:hover {
|
||||
background-color: #efefef;
|
||||
}
|
||||
QComboBox QAbstractItemView {
|
||||
border: 1px solid #000000;
|
||||
border-radius: 3px;
|
||||
font-size: 14px;
|
||||
selection-background-color: #5396C1; /* 选中项背景色(稍深) */
|
||||
selection-color: #ffffff;
|
||||
}
|
||||
|
||||
// 下拉框
|
||||
QComboBox QAbstractItemView {
|
||||
border: 1px solid #000000;
|
||||
border-radius: 3px;
|
||||
font-size: 14px;
|
||||
selection-background-color: #5396C1; /* 选中项背景色(稍深) */
|
||||
selection-color: #ffffff;
|
||||
}
|
||||
)";
|
||||
QTabWidget {
|
||||
border: none;
|
||||
background-color: #7B838E;
|
||||
}
|
||||
|
||||
QTabBar::tab {
|
||||
min-width: 90px;
|
||||
min-height: 45px;
|
||||
padding: 4px 10px;
|
||||
margin-right: 4px;
|
||||
border: 1px solid #dddddd;
|
||||
border-bottom: none;
|
||||
border-top-left-radius: 4px;
|
||||
border-top-right-radius: 4px;
|
||||
background-color: #5396C1;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
QTabWidget::tab-bar {
|
||||
top: -3px;
|
||||
left: 10px;
|
||||
}
|
||||
|
||||
QTabBar::tab:selected {
|
||||
background-color: #6bb1e0;
|
||||
color: #ffffff;
|
||||
box-shadow: 0 -3px 8px rgba(44, 125, 232, 0.25);
|
||||
}
|
||||
|
||||
)";
|
||||
|
||||
this->setStyleSheet(styleSheet);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user