2026年5月25日15:57:50
This commit is contained in:
+10
-257
@@ -133,31 +133,14 @@ void DateVarSet::bindSysPara(SysPara *sysPara){
|
|||||||
this->sysPara = sysPara;
|
this->sysPara = sysPara;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DateVarSet::bindTxTEdit(QTextEdit* textEdit){
|
|
||||||
m_textEdit = textEdit;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DateVarSet::buttonClickedSlot()
|
void DateVarSet::buttonClickedSlot()
|
||||||
{
|
{
|
||||||
QPushButton* btn = qobject_cast<QPushButton*>(sender());
|
QPushButton* btn = qobject_cast<QPushButton*>(sender());
|
||||||
if (btn == ui->checkBtn) {
|
if (btn == ui->checkBtn) {
|
||||||
if(true)
|
|
||||||
useReplaceInsertVar();
|
|
||||||
else
|
|
||||||
on_buttonInsertVari_pressed();
|
|
||||||
|
|
||||||
auto item = dynamic_cast<PicDateItem*>(m_generalSettings->currentItem());
|
|
||||||
if(item)
|
|
||||||
item->setModel(dateModel());
|
|
||||||
|
|
||||||
emit sendButtonClickedSignal(1);
|
emit sendButtonClickedSignal(1);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}else if(btn == ui->closeBtn) {
|
}else if(btn == ui->closeBtn) {
|
||||||
auto item = m_generalSettings->currentItem();
|
|
||||||
if(item)
|
|
||||||
item->setAttrs(m_backup);
|
|
||||||
|
|
||||||
emit sendButtonClickedSignal(2);
|
emit sendButtonClickedSignal(2);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -211,246 +194,12 @@ DateVarSet::~DateVarSet()
|
|||||||
|
|
||||||
void DateVarSet::getValue(int *varType,int *digitalWidth,unsigned char *splitMode){
|
void DateVarSet::getValue(int *varType,int *digitalWidth,unsigned char *splitMode){
|
||||||
int type = 0,width = 0;
|
int type = 0,width = 0;
|
||||||
// if(ui->radioButtonYear->isChecked())
|
|
||||||
// type = 0;
|
|
||||||
// else if(ui->radioButtonMonth->isChecked())
|
|
||||||
// type = 1;
|
|
||||||
// else if(ui->radioButtonDay->isChecked())
|
|
||||||
// type = 2;
|
|
||||||
// else if(ui->radioButtonWeek->isChecked())
|
|
||||||
// type = 3;
|
|
||||||
// else if(ui->radioButtonHour->isChecked())
|
|
||||||
// type = 4;
|
|
||||||
// else if(ui->radioButtonMinute->isChecked())
|
|
||||||
// type = 5;
|
|
||||||
// else if(ui->radioButtonSecond->isChecked())
|
|
||||||
// type = 6;
|
|
||||||
|
|
||||||
// else if(ui->radioButtonXDay->isChecked())
|
|
||||||
// type = 14;
|
|
||||||
|
|
||||||
// else if(ui->radioButtonExpiry->isChecked())
|
|
||||||
// {
|
|
||||||
// type = 80;
|
|
||||||
// }
|
|
||||||
// else if(ui->radioButtonCurDate->isChecked())
|
|
||||||
// {
|
|
||||||
// type = 81;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// width = ui->cb_digits->currentText().toInt();
|
|
||||||
|
|
||||||
if(varType && digitalWidth){
|
if(varType && digitalWidth){
|
||||||
*varType = type;
|
*varType = type;
|
||||||
*digitalWidth = width;
|
*digitalWidth = width;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DateVarSet::on_buttonInsertVari_pressed()
|
|
||||||
{
|
|
||||||
QString s,fontname="";
|
|
||||||
if(sysPara)
|
|
||||||
{
|
|
||||||
s= sysPara->para.qrOption.text;
|
|
||||||
if(s.length()>120)s="string to long.";
|
|
||||||
}
|
|
||||||
int pixelSize = 9;
|
|
||||||
QFont font;
|
|
||||||
fontname = "Dinkie9";
|
|
||||||
if(m_generalSettings->currentItem()) {
|
|
||||||
fontname = m_generalSettings->font().family();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
|
|
||||||
font.setFamily(fontname);
|
|
||||||
|
|
||||||
font.setPixelSize(pixelSize);
|
|
||||||
font.setWeight(false && (pixelSize<=16) ?QFont::Bold:QFont::Normal);
|
|
||||||
font.setLetterSpacing(QFont::AbsoluteSpacing,sysPara->para.textEditCharSpace);
|
|
||||||
}
|
|
||||||
|
|
||||||
QFontMetrics fontMetrics(font);
|
|
||||||
|
|
||||||
int width = (fontMetrics.width("0123456789"))/10;
|
|
||||||
int height = fontMetrics.ascent()+ fontMetrics.descent();
|
|
||||||
int digitalNum;
|
|
||||||
int varType;
|
|
||||||
|
|
||||||
height = font.pixelSize();
|
|
||||||
|
|
||||||
unsigned char splitMode=sysPara->para.ExpirySplitMode;
|
|
||||||
getValue(&varType,&digitalNum,&splitMode);
|
|
||||||
|
|
||||||
fmt = m_textEdit->currentCharFormat ();
|
|
||||||
|
|
||||||
if((varType<9 || varType==14))
|
|
||||||
{
|
|
||||||
int varType1= varType;
|
|
||||||
|
|
||||||
if(fontname.contains("SerifL") ||fontname.contains("serifl") )
|
|
||||||
varType1= 20+varType;
|
|
||||||
else if(fontname.contains("SerifR") ||fontname.contains("serifr") )
|
|
||||||
varType1= 20+varType;
|
|
||||||
else if(fontname.contains("bangla") )
|
|
||||||
varType1= 30+varType;
|
|
||||||
else if(fontname.contains("biyangF") )
|
|
||||||
varType1= 50+varType;
|
|
||||||
else if(fontname.contains("Roman") )
|
|
||||||
varType1= 60+varType;
|
|
||||||
// varType1= 40+varType; // 变量右横时取 40,左横时取 20
|
|
||||||
|
|
||||||
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();
|
|
||||||
} // 普通变量 VarType<=8
|
|
||||||
else if(varType ==EXPIRYDATE){ //80 :/80/image/expiryDate8.bmp qrc:/80/image/expiryDate875.bmp
|
|
||||||
// QImage img;
|
|
||||||
// img.load("/home/student/mini2440/UP/QtUI/QRUI_SUNV54/80/image/digitalWidth8.bmp");
|
|
||||||
// img.setPixel(0,4,0xffff0Cfc);
|
|
||||||
// img.setPixel(0,5,0xffff0Cfc);
|
|
||||||
// img.save("/home/student/mini2440/UP/QtUI/QRUI_SUNV54/80/image/curDate8.bmp");
|
|
||||||
// 0xff00fc
|
|
||||||
int varType1 = varType;
|
|
||||||
if(fontname.contains("bangla") )
|
|
||||||
{
|
|
||||||
varType1= 10+varType;
|
|
||||||
}
|
|
||||||
else if(fontname.contains("biyangF") )
|
|
||||||
{
|
|
||||||
varType1= 20+varType;
|
|
||||||
}
|
|
||||||
else if(fontname.contains("Roman") )
|
|
||||||
{
|
|
||||||
varType1= 30+varType;
|
|
||||||
}
|
|
||||||
|
|
||||||
sysPara->print.ExpiryVar.splitMode=splitMode;
|
|
||||||
font.setLetterSpacing(QFont::AbsoluteSpacing,sysPara->para.textEditCharSpace);
|
|
||||||
QFontMetrics fontMetrics(font);
|
|
||||||
|
|
||||||
QHash<int, QString> dateFormat;
|
|
||||||
dateFormat.insert(0,"yyyy-MM-dd");
|
|
||||||
dateFormat.insert(1,"yyyy/MM/dd");
|
|
||||||
dateFormat.insert(2,"yyyyMMdd");
|
|
||||||
dateFormat.insert(3,"yyyy年MM月dd日");
|
|
||||||
dateFormat.insert(4,"yyyy-MM-dd hh:mm");
|
|
||||||
dateFormat.insert(5,"yyyy/MM/dd hh:mm");
|
|
||||||
dateFormat.insert(6,"yyyyMMddhhmm");
|
|
||||||
dateFormat.insert(7,"yyyy年MM月dd日 hh:mm");
|
|
||||||
dateFormat.insert(8,"hh:mm");
|
|
||||||
dateFormat.insert(9,"ddhhmm");
|
|
||||||
dateFormat.insert(10,"dd MM yy");
|
|
||||||
dateFormat.insert(11,"dd/MM/yy");
|
|
||||||
dateFormat.insert(12,"dd/MM/yyyy");
|
|
||||||
dateFormat.insert(13,"dd-MM-yy");
|
|
||||||
dateFormat.insert(14,"dd-MM-yyyy");
|
|
||||||
//dateFormat.insert(10,"x");
|
|
||||||
QString DateTime = QDateTime::currentDateTime().toString(dateFormat.value(splitMode));
|
|
||||||
|
|
||||||
int dateTimeWidth = fontMetrics.width(DateTime);
|
|
||||||
|
|
||||||
if(DateTime == "x")
|
|
||||||
{
|
|
||||||
qDebug()<<" x handle";
|
|
||||||
m_textEdit->insertHtml(QString("<img src=':/%1/image/digitalWidth%2.bmp' height='%3' width='%4'/>")
|
|
||||||
.arg(varType).arg(false && (pixelSize<=16)?(175):1)
|
|
||||||
.arg(height+1).arg(dateTimeWidth+4)); //插入索引后
|
|
||||||
sysPara->print.ExpiryVar.bold = false;
|
|
||||||
m_textEdit->mergeCurrentCharFormat(fmt);
|
|
||||||
}else
|
|
||||||
{
|
|
||||||
if(splitMode == 3 || splitMode ==7 )
|
|
||||||
{
|
|
||||||
height = fontMetrics.ascent();
|
|
||||||
}
|
|
||||||
m_textEdit->insertHtml(QString("<img src=':/%1/image/expiryDate%2.bmp' height='%3' width='%4' style=\"vertical-align: bottom;\" />")
|
|
||||||
.arg(varType1).arg(false && (pixelSize<=16)?(875):8)
|
|
||||||
.arg(height+1).arg(dateTimeWidth+4)); //插入索引后
|
|
||||||
sysPara->print.ExpiryVar.bold = false;
|
|
||||||
m_textEdit->mergeCurrentCharFormat(fmt);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(varType ==CURDATE ){ //81 :/80/image/expiryDate8.bmp qrc:/80/image/curDate8.bmp
|
|
||||||
int varType1 = varType;
|
|
||||||
if(fontname.contains("bangla") )
|
|
||||||
{
|
|
||||||
varType1= 10+varType;
|
|
||||||
}
|
|
||||||
else if(fontname.contains("biyangF") )
|
|
||||||
{
|
|
||||||
varType1= 20+varType;
|
|
||||||
}
|
|
||||||
else if(fontname.contains("biyangF") )
|
|
||||||
{
|
|
||||||
varType1= 30+varType;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 0xff00fc
|
|
||||||
//qDebug()<<"CurDateVar height"<<height;
|
|
||||||
sysPara->print.CurDateVar.splitMode = splitMode;
|
|
||||||
font.setLetterSpacing(QFont::AbsoluteSpacing, sysPara->para.textEditCharSpace);
|
|
||||||
QFontMetrics fontMetrics(font);
|
|
||||||
|
|
||||||
QHash<int, QString> dateFormat;
|
|
||||||
dateFormat.insert(0,"yyyy-MM-dd");
|
|
||||||
dateFormat.insert(1,"yyyy/MM/dd");
|
|
||||||
dateFormat.insert(2,"yyyyMMdd");
|
|
||||||
dateFormat.insert(3,"yyyy年MM月dd日");
|
|
||||||
dateFormat.insert(4,"yyyy-MM-dd hh:mm");
|
|
||||||
dateFormat.insert(5,"yyyy/MM/dd hh:mm");
|
|
||||||
dateFormat.insert(6,"yyyyMMddhhmm");
|
|
||||||
dateFormat.insert(7,"yyyy年MM月dd日 hh:mm");
|
|
||||||
dateFormat.insert(8,"hh:mm");
|
|
||||||
dateFormat.insert(9,"ddhhmm");
|
|
||||||
dateFormat.insert(10,"dd MM yy");
|
|
||||||
dateFormat.insert(11,"dd/MM/yy");
|
|
||||||
dateFormat.insert(12,"dd/MM/yyyy");
|
|
||||||
dateFormat.insert(13,"dd-MM-yy");
|
|
||||||
dateFormat.insert(14,"dd-MM-yyyy");
|
|
||||||
QString DateTime = QDateTime::currentDateTime().toString(dateFormat.value(splitMode));
|
|
||||||
int dateTimeWidth = fontMetrics.width(DateTime) ;
|
|
||||||
qDebug()<<"insert splitMode="<<splitMode;
|
|
||||||
|
|
||||||
if(DateTime == "x")
|
|
||||||
{
|
|
||||||
qDebug()<<" x handle";
|
|
||||||
m_textEdit->insertHtml(QString("<img src=':/%1/image/curDate%2.bmp' height='%3' width='%4'/>")
|
|
||||||
.arg(varType).arg(false && (pixelSize<=16)?(875):1)
|
|
||||||
.arg(height+1).arg(dateTimeWidth+4)); //插入索引后
|
|
||||||
m_textEdit->mergeCurrentCharFormat(fmt);
|
|
||||||
}else
|
|
||||||
{
|
|
||||||
if(splitMode == 3 || splitMode ==7 )
|
|
||||||
{
|
|
||||||
height = fontMetrics.ascent();//fontMetrics.ascent()+ fontMetrics.descent();
|
|
||||||
}
|
|
||||||
m_textEdit->insertHtml(QString("<img src=':/%1/image/curDate%2.bmp' height='%3' width='%4' style=\"vertical-align: bottom;\"/>")
|
|
||||||
.arg(varType1).arg(false && (pixelSize<=16)?(875):8)
|
|
||||||
.arg(height+1).arg(dateTimeWidth+4)); //插入索引后
|
|
||||||
m_textEdit->mergeCurrentCharFormat(fmt);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_textEdit->setFocus();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DateVarSet::edit(PicDateItem*item)
|
|
||||||
{
|
|
||||||
m_backup.clear();
|
|
||||||
|
|
||||||
if(!item) {
|
|
||||||
qWarning() << "Invalied arguement: " << item;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
item->saveAttrs(m_backup);
|
|
||||||
|
|
||||||
m_generalSettings->edit(item);
|
|
||||||
setDateModel(item->model());
|
|
||||||
}
|
|
||||||
|
|
||||||
DateItemModel DateVarSet::dateModel()
|
DateItemModel DateVarSet::dateModel()
|
||||||
{
|
{
|
||||||
DateItemModel model;
|
DateItemModel model;
|
||||||
@@ -512,16 +261,20 @@ void DateVarSet::setDateModel(const DateItemModel &model)
|
|||||||
ui->tabWidget->setCurrentIndex(1);
|
ui->tabWidget->setCurrentIndex(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DateVarSet::useReplaceInsertVar(){
|
|
||||||
QString dateFormat = ui->lineEdit_DateFormat->text();
|
|
||||||
m_textEdit->setText(dateFormat);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QString DateVarSet::getFamilyName(int fontsize){
|
QString DateVarSet::getFamilyName(int fontsize){
|
||||||
return "YaHei"+QString::number(fontsize);
|
return "YaHei"+QString::number(fontsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TextItemModel DateVarSet::textItemModeL()
|
||||||
|
{
|
||||||
|
return m_generalSettings->viewModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DateVarSet::setTextItemModel(const TextItemModel &model)
|
||||||
|
{
|
||||||
|
m_generalSettings->setViewModel(model);
|
||||||
|
}
|
||||||
|
|
||||||
void DateVarSet::applyStyleSheet()
|
void DateVarSet::applyStyleSheet()
|
||||||
{
|
{
|
||||||
QString styleSheet =
|
QString styleSheet =
|
||||||
|
|||||||
+4
-9
@@ -33,18 +33,16 @@ public:
|
|||||||
|
|
||||||
void bindSysPara(SysPara *sysPara);
|
void bindSysPara(SysPara *sysPara);
|
||||||
|
|
||||||
void bindTxTEdit(QTextEdit* textEdit);
|
|
||||||
|
|
||||||
void on_buttonInsertVari_pressed();
|
|
||||||
|
|
||||||
void edit(PicDateItem* item);
|
|
||||||
|
|
||||||
DateItemModel dateModel();
|
DateItemModel dateModel();
|
||||||
|
|
||||||
void setDateModel(const DateItemModel& model);
|
void setDateModel(const DateItemModel& model);
|
||||||
|
|
||||||
QString getFamilyName(int);
|
QString getFamilyName(int);
|
||||||
|
|
||||||
|
TextItemModel textItemModeL();
|
||||||
|
|
||||||
|
void setTextItemModel(const TextItemModel& model);
|
||||||
|
|
||||||
void loadMonthShow();
|
void loadMonthShow();
|
||||||
|
|
||||||
void loadDataShow();
|
void loadDataShow();
|
||||||
@@ -67,8 +65,6 @@ public:
|
|||||||
|
|
||||||
void getDayValue();
|
void getDayValue();
|
||||||
|
|
||||||
void useReplaceInsertVar();
|
|
||||||
|
|
||||||
void initShowLineEdit();
|
void initShowLineEdit();
|
||||||
|
|
||||||
void initReplaceValue();
|
void initReplaceValue();
|
||||||
@@ -113,7 +109,6 @@ private:
|
|||||||
ItemGeneralSettings* m_generalSettings = nullptr;
|
ItemGeneralSettings* m_generalSettings = nullptr;
|
||||||
|
|
||||||
int digitWidth;
|
int digitWidth;
|
||||||
QTextEdit* m_textEdit;
|
|
||||||
QTextCharFormat fmt;
|
QTextCharFormat fmt;
|
||||||
int varTypeSet;
|
int varTypeSet;
|
||||||
QString varHtmlStr;
|
QString varHtmlStr;
|
||||||
|
|||||||
+8
-40
@@ -106,7 +106,7 @@ void InkJetPrinter::init()
|
|||||||
connect(m_TestPrintWidget, &TestPrintWidget::sendButtonClickedSignal, this, &InkJetPrinter::getTestPrintWidgetButtonClickedSlot);
|
connect(m_TestPrintWidget, &TestPrintWidget::sendButtonClickedSignal, this, &InkJetPrinter::getTestPrintWidgetButtonClickedSlot);
|
||||||
|
|
||||||
// TestPrintWidget::sendButtonClickedSignal(16) 转由 openDatetimeEditor 处理
|
// TestPrintWidget::sendButtonClickedSignal(16) 转由 openDatetimeEditor 处理
|
||||||
connect(m_TestPrintWidget, &TestPrintWidget::sig_showEditDataTime, this, &InkJetPrinter::openDatetimeEditor);
|
connect(m_TestPrintWidget, &TestPrintWidget::sig_showEditDateTime, this, &InkJetPrinter::openDatetimeEditor);
|
||||||
|
|
||||||
// 班时元素与编辑 连接
|
// 班时元素与编辑 连接
|
||||||
connect(m_TestPrintWidget, &TestPrintWidget::sig_showScheduleShiftsEditor, this, &InkJetPrinter::showScheduleShiftsEditor);
|
connect(m_TestPrintWidget, &TestPrintWidget::sig_showScheduleShiftsEditor, this, &InkJetPrinter::showScheduleShiftsEditor);
|
||||||
@@ -184,7 +184,6 @@ void InkJetPrinter::init()
|
|||||||
m_MainWidget->bindTxTEdit(m_TestPrintWidget->getQTextEdit());
|
m_MainWidget->bindTxTEdit(m_TestPrintWidget->getQTextEdit());
|
||||||
m_MainWidget->bindPicScene(m_TestPrintWidget->getPicScene());
|
m_MainWidget->bindPicScene(m_TestPrintWidget->getPicScene());
|
||||||
m_FontSetWidget->bindTxTEdit(m_TestPrintWidget->getQTextEdit());
|
m_FontSetWidget->bindTxTEdit(m_TestPrintWidget->getQTextEdit());
|
||||||
m_DateVarSet->bindTxTEdit(m_TestPrintWidget->getQTextEdit());
|
|
||||||
m_CounterVarSet->bindTxTEdit(m_TestPrintWidget->getQTextEdit());
|
m_CounterVarSet->bindTxTEdit(m_TestPrintWidget->getQTextEdit());
|
||||||
m_BarCodeDlg->bindTxTEdit(m_TestPrintWidget->getQTextEdit());
|
m_BarCodeDlg->bindTxTEdit(m_TestPrintWidget->getQTextEdit());
|
||||||
m_QRCodeDlg->bindTxTEdit(m_TestPrintWidget->getQTextEdit());
|
m_QRCodeDlg->bindTxTEdit(m_TestPrintWidget->getQTextEdit());
|
||||||
@@ -1578,50 +1577,17 @@ void InkJetPrinter::getTestPrintWidgetButtonClickedSlot(int index)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void InkJetPrinter::openDatetimeEditor(PicDateItem* item)
|
void InkJetPrinter::openDatetimeEditor(DateItemModel dateModel, TextItemModel textItemModel)
|
||||||
{
|
{
|
||||||
m_DateVarSet->initUI();
|
m_DateVarSet->initUI();
|
||||||
m_DateVarSet->initReplaceValue();
|
m_DateVarSet->initReplaceValue();
|
||||||
|
|
||||||
if(item) {
|
m_DateVarSet->setTextItemModel(textItemModel);
|
||||||
m_DateVarSet->edit(item);
|
m_DateVarSet->setDateModel(dateModel);
|
||||||
}
|
|
||||||
else
|
|
||||||
m_DateVarSet->setDateModel(DateItemModel::createDefaultReplaceModel());
|
|
||||||
|
|
||||||
m_StackedWidget->setCurrentWidget(m_DateVarSet);
|
m_StackedWidget->setCurrentWidget(m_DateVarSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
void InkJetPrinter::getErCodeSettingsWidgetButtonClickedSlot(int index)
|
|
||||||
{
|
|
||||||
switch (index)
|
|
||||||
{
|
|
||||||
case 1:
|
|
||||||
case 2:
|
|
||||||
m_StackedWidget->setCurrentWidget(m_TestPrintWidget);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
void InkJetPrinter::getMainInterfaceWidgetButtonClickedSlot(int index)
|
|
||||||
{
|
|
||||||
switch (index)
|
|
||||||
{
|
|
||||||
case 1:
|
|
||||||
m_StackedWidget->setCurrentWidget(m_MainWidget);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
void InkJetPrinter::getFontSetWidgetButtonClickedSlot(int index)
|
void InkJetPrinter::getFontSetWidgetButtonClickedSlot(int index)
|
||||||
{
|
{
|
||||||
switch (index)
|
switch (index)
|
||||||
@@ -1788,8 +1754,10 @@ void InkJetPrinter::getDateSetWidgetButtonClickSlot(int index){
|
|||||||
m_StackedWidget->setCurrentWidget(m_TestPrintWidget);
|
m_StackedWidget->setCurrentWidget(m_TestPrintWidget);
|
||||||
// m_TestPrintWidget->onEditItemVarDone();
|
// m_TestPrintWidget->onEditItemVarDone();
|
||||||
DateItemModel model = m_DateVarSet->dateModel();
|
DateItemModel model = m_DateVarSet->dateModel();
|
||||||
qDebug() << "A new datetime pattern: " << model.datetimePattern;
|
const auto textModel = m_DateVarSet->textItemModeL();
|
||||||
m_TestPrintWidget->addDateTimeItem(model);
|
qInfo() << "A new datetime pattern: " << model.datetimePattern;
|
||||||
|
qInfo() << "Text model: " << TextItemModel::toString(textModel);
|
||||||
|
m_TestPrintWidget->addDateTimeItem(model, textModel);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 2:
|
case 2:
|
||||||
|
|||||||
+1
-1
@@ -116,7 +116,7 @@ private slots:
|
|||||||
void timerHandler();
|
void timerHandler();
|
||||||
void getMainWidgetButtonClickedSlot(int index);
|
void getMainWidgetButtonClickedSlot(int index);
|
||||||
void getTestPrintWidgetButtonClickedSlot(int index);
|
void getTestPrintWidgetButtonClickedSlot(int index);
|
||||||
void openDatetimeEditor(PicDateItem* item);
|
void openDatetimeEditor(DateItemModel dateModel, TextItemModel textItemModel);
|
||||||
// void getErCodeSettingsWidgetButtonClickedSlot(int index);
|
// void getErCodeSettingsWidgetButtonClickedSlot(int index);
|
||||||
// void getMainInterfaceWidgetButtonClickedSlot(int index);
|
// void getMainInterfaceWidgetButtonClickedSlot(int index);
|
||||||
void viscosity_timerHandler();
|
void viscosity_timerHandler();
|
||||||
|
|||||||
@@ -1106,6 +1106,17 @@ void InputMethod::onInputMethodClicked(){
|
|||||||
|
|
||||||
void InputMethod::onEnterClicked(){
|
void InputMethod::onEnterClicked(){
|
||||||
// userInputed("\n");
|
// userInputed("\n");
|
||||||
|
|
||||||
|
// 编辑界面的文本输入框,需要按下回车时触发回车事件,同时放弃焦点
|
||||||
|
// 嘿!什么叫特事特办啊 byons@2026年5月25日
|
||||||
|
if(m_edit && m_edit->property("Enter replace enter").toBool()) {
|
||||||
|
QKeyEvent pressEvent(QEvent::KeyPress, Qt::Key_Enter, Qt::NoModifier);
|
||||||
|
QKeyEvent releaseEvent(QEvent::KeyRelease, Qt::Key_Enter, Qt::NoModifier);
|
||||||
|
QApplication::sendEvent(m_edit, &pressEvent);
|
||||||
|
QApplication::sendEvent(m_edit, &releaseEvent);
|
||||||
|
m_edit->clearFocus();
|
||||||
|
}
|
||||||
|
|
||||||
emit onEnterClickedConfirm();
|
emit onEnterClickedConfirm();
|
||||||
this->hide();
|
this->hide();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ void ItemEditor::edit(PicTextItem *item)
|
|||||||
void ItemEditor::onOkBtnClicked()
|
void ItemEditor::onOkBtnClicked()
|
||||||
{
|
{
|
||||||
hide();
|
hide();
|
||||||
|
m_generalSettings->applyToItem(m_currItem);
|
||||||
emit accepted();
|
emit accepted();
|
||||||
m_currItem = nullptr;
|
m_currItem = nullptr;
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-1
@@ -36,7 +36,7 @@ MyInputMethod::MyInputMethod(QWidget *parent)
|
|||||||
inputMethod = input;
|
inputMethod = input;
|
||||||
digitalInput = new DigitalInput(this,parent);
|
digitalInput = new DigitalInput(this,parent);
|
||||||
|
|
||||||
connect(inputMethod,&InputMethod::onEnterClickedConfirm,this,&MyInputMethod::sendEnterClickedSignal);
|
connect(inputMethod,&InputMethod::onEnterClickedConfirm,this,&MyInputMethod::onInputMethodEnterClicked);
|
||||||
}
|
}
|
||||||
void MyInputMethod::SetInputFile(QString filename){
|
void MyInputMethod::SetInputFile(QString filename){
|
||||||
inputMethod->initInputMethod(filename);
|
inputMethod->initInputMethod(filename);
|
||||||
@@ -201,3 +201,8 @@ void MyInputMethod::getEnglishOrAarbic(bool flag){
|
|||||||
if(QApplication::focusWidget())
|
if(QApplication::focusWidget())
|
||||||
QCoreApplication::sendEvent(QApplication::focusWidget(), &releaseEvent);
|
QCoreApplication::sendEvent(QApplication::focusWidget(), &releaseEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MyInputMethod::MyInputMethod::onInputMethodEnterClicked()
|
||||||
|
{
|
||||||
|
emit sendEnterClickedSignal();
|
||||||
|
}
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ public:
|
|||||||
private slots:
|
private slots:
|
||||||
void switchBangalInput(bool);
|
void switchBangalInput(bool);
|
||||||
|
|
||||||
|
void onInputMethodEnterClicked();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void backSapceButtonDel();
|
void backSapceButtonDel();
|
||||||
|
|
||||||
|
|||||||
+32
-15
@@ -29,7 +29,7 @@ PrintSetting::PrintSetting(QWidget *parent) :
|
|||||||
init();
|
init();
|
||||||
|
|
||||||
ui->eleEyeEdgetTriggerInner->click();
|
ui->eleEyeEdgetTriggerInner->click();
|
||||||
ui->radioButtonSynTriggerExternal->click();
|
ui->radioButtonSynTriggerInner->click();
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintSetting::~PrintSetting()
|
PrintSetting::~PrintSetting()
|
||||||
@@ -125,9 +125,15 @@ void PrintSetting::TriggerupdateSysParaToUI(){
|
|||||||
if(sysPara)
|
if(sysPara)
|
||||||
{
|
{
|
||||||
/*----------------------------------------*/
|
/*----------------------------------------*/
|
||||||
|
|
||||||
setTriggerUI(sysPara->para.printTriggerMode);
|
setTriggerUI(sysPara->para.printTriggerMode);
|
||||||
|
|
||||||
|
if (sysPara->para.eleEyeTriggerSynPrintEn) //电眼触发的同步打印使能,电眼和同步器都选外部
|
||||||
|
{
|
||||||
|
sysPara->para.eleEyeEdgetTriggerInner = 0;
|
||||||
|
sysPara->para.synTriggerInner = 0;
|
||||||
|
sysPara->para.eleEyeEdgetTriggerExternal = 1;
|
||||||
|
sysPara->para.synTriggerExternal = 1;
|
||||||
|
}
|
||||||
ui->eleEyeEdgetTriggerInner->setChecked(sysPara->para.eleEyeEdgetTriggerInner);
|
ui->eleEyeEdgetTriggerInner->setChecked(sysPara->para.eleEyeEdgetTriggerInner);
|
||||||
ui->eleEyeEdgetTriggerExternal->setChecked(sysPara->para.eleEyeEdgetTriggerExternal);
|
ui->eleEyeEdgetTriggerExternal->setChecked(sysPara->para.eleEyeEdgetTriggerExternal);
|
||||||
ui->radioButtonSynTriggerInner->setChecked(sysPara->para.synTriggerInner);
|
ui->radioButtonSynTriggerInner->setChecked(sysPara->para.synTriggerInner);
|
||||||
@@ -177,12 +183,11 @@ void PrintSetting::TriggerupdateSysParaToUI(){
|
|||||||
|
|
||||||
if(sysPara->para.printTriggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE)
|
if(sysPara->para.printTriggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE)
|
||||||
ui->radioButtonEleEyeEdgetTrigger->setChecked(true);
|
ui->radioButtonEleEyeEdgetTrigger->setChecked(true);
|
||||||
if( sysPara->para.printTriggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL){
|
if( sysPara->para.printTriggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL)
|
||||||
ui->radioButtonEleEyeLevelTrigger->setChecked(true);
|
ui->radioButtonEleEyeLevelTrigger->setChecked(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void PrintSetting::updateSysStatusToUI(){
|
void PrintSetting::updateSysStatusToUI(){
|
||||||
|
|
||||||
@@ -223,6 +228,10 @@ void PrintSetting::applyUITriggerPara(){
|
|||||||
sysPara->para.eleEyeEdgetTriggerExternal = ui->eleEyeEdgetTriggerExternal->isChecked();
|
sysPara->para.eleEyeEdgetTriggerExternal = ui->eleEyeEdgetTriggerExternal->isChecked();
|
||||||
sysPara->para.synTriggerInner = ui->radioButtonSynTriggerInner->isChecked();
|
sysPara->para.synTriggerInner = ui->radioButtonSynTriggerInner->isChecked();
|
||||||
sysPara->para.synTriggerExternal = ui->radioButtonSynTriggerExternal->isChecked();
|
sysPara->para.synTriggerExternal = ui->radioButtonSynTriggerExternal->isChecked();
|
||||||
|
// 电眼和同步器都选外部时,就是同步
|
||||||
|
sysPara->para.eleEyeTriggerSynPrintEn =
|
||||||
|
sysPara->para.eleEyeEdgetTriggerExternal && sysPara->para.synTriggerExternal? 1 : 0;
|
||||||
|
|
||||||
|
|
||||||
sysPara->para.pulseOutputEnable = ui->checkBoxPulseOutputEnable->isChecked();
|
sysPara->para.pulseOutputEnable = ui->checkBoxPulseOutputEnable->isChecked();
|
||||||
sysPara->para.productCntPerOutputPulse = ui->spinBoxProductCntPerOutputPulse->value();
|
sysPara->para.productCntPerOutputPulse = ui->spinBoxProductCntPerOutputPulse->value();
|
||||||
@@ -252,7 +261,7 @@ void PrintSetting::GetTriggerUIPara(){
|
|||||||
sysPara->para.timeTriggerPrintMode = ui->comboBoxTimeTriggerMode->currentIndex();
|
sysPara->para.timeTriggerPrintMode = ui->comboBoxTimeTriggerMode->currentIndex();
|
||||||
sysPara->para.elecEyeTriggerInterval = ui->spinBoxEleEyeTriggerIntervalMs->value(); //电眼触发的重复间隔
|
sysPara->para.elecEyeTriggerInterval = ui->spinBoxEleEyeTriggerIntervalMs->value(); //电眼触发的重复间隔
|
||||||
int value = 0;
|
int value = 0;
|
||||||
if (ui->cb_unlimited) value = 65535;
|
if (ui->cb_unlimited->isChecked()) value = 65535;
|
||||||
else value = ui->spinBoxEleEyeTriggerRepeatCnt->value();
|
else value = ui->spinBoxEleEyeTriggerRepeatCnt->value();
|
||||||
sysPara->para.photoElectricityRepeateNum = value;
|
sysPara->para.photoElectricityRepeateNum = value;
|
||||||
|
|
||||||
@@ -354,6 +363,7 @@ void PrintSetting::on_radioButtonSynTrigger_pressed()
|
|||||||
|
|
||||||
void PrintSetting::on_checkEyeTriggerSynPrintEn_clicked(bool checked)
|
void PrintSetting::on_checkEyeTriggerSynPrintEn_clicked(bool checked)
|
||||||
{
|
{
|
||||||
|
ui->cb_unlimited->setEnabled(checked);
|
||||||
if(sysPara)
|
if(sysPara)
|
||||||
{
|
{
|
||||||
int triggerMode = sysPara->para.printTriggerMode;
|
int triggerMode = sysPara->para.printTriggerMode;
|
||||||
@@ -371,7 +381,6 @@ void PrintSetting::on_checkEyeTriggerSynPrintEn_clicked(bool checked)
|
|||||||
ui->pushButtonApplyPulseFix->setEnabled(1);
|
ui->pushButtonApplyPulseFix->setEnabled(1);
|
||||||
ui->comboBoxSynPrintMode->setEnabled(1);
|
ui->comboBoxSynPrintMode->setEnabled(1);
|
||||||
ui->labelSynPrintMode->setEnabled(1);
|
ui->labelSynPrintMode->setEnabled(1);
|
||||||
ui->cb_unlimited->setEnabled (1);
|
|
||||||
ui->spinBoxEleEyeTriggerIntervalMs->setEnabled(0);
|
ui->spinBoxEleEyeTriggerIntervalMs->setEnabled(0);
|
||||||
ui->labelEleEyeTriggerPrintDelay->setText(tr("触发延时(毫米)"));
|
ui->labelEleEyeTriggerPrintDelay->setText(tr("触发延时(毫米)"));
|
||||||
ui->labelEleEyeTriggerIntervalMs->setText(tr("重复间隔(毫米)"));
|
ui->labelEleEyeTriggerIntervalMs->setText(tr("重复间隔(毫米)"));
|
||||||
@@ -396,7 +405,6 @@ void PrintSetting::on_checkEyeTriggerSynPrintEn_clicked(bool checked)
|
|||||||
ui->pushButtonApplyPulseFix->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
|
ui->pushButtonApplyPulseFix->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
|
||||||
ui->comboBoxSynPrintMode->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
|
ui->comboBoxSynPrintMode->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
|
||||||
ui->labelSynPrintMode->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
|
ui->labelSynPrintMode->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
|
||||||
ui->cb_unlimited->setEnabled(triggerMode == PRINT_TRIGGER_SYNCHRONIZER);
|
|
||||||
ui->spinBoxEleEyeTriggerIntervalMs->setEnabled(1);
|
ui->spinBoxEleEyeTriggerIntervalMs->setEnabled(1);
|
||||||
ui->labelEleEyeTriggerPrintDelay->setText(tr("触发延时(毫秒)"));
|
ui->labelEleEyeTriggerPrintDelay->setText(tr("触发延时(毫秒)"));
|
||||||
ui->labelEleEyeTriggerIntervalMs->setText(tr("重复间隔(毫秒)"));
|
ui->labelEleEyeTriggerIntervalMs->setText(tr("重复间隔(毫秒)"));
|
||||||
@@ -406,7 +414,7 @@ void PrintSetting::on_checkEyeTriggerSynPrintEn_clicked(bool checked)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PrintSetting::setTriggerUI(int triggerMode){
|
void PrintSetting::setTriggerUI(int triggerMode){
|
||||||
// ui->sb_printingDelay->setEnabled(triggerMode == PRINT_TRIGGER_TIME);
|
ui->sb_printingDelay->setEnabled(triggerMode == PRINT_TRIGGER_TIME);
|
||||||
ui->lb_printingDelay->setEnabled(triggerMode == PRINT_TRIGGER_TIME);
|
ui->lb_printingDelay->setEnabled(triggerMode == PRINT_TRIGGER_TIME);
|
||||||
|
|
||||||
ui->radioButtonEleEyeEdgetTrigger->setChecked( triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE);
|
ui->radioButtonEleEyeEdgetTrigger->setChecked( triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE);
|
||||||
@@ -414,7 +422,6 @@ void PrintSetting::setTriggerUI(int triggerMode){
|
|||||||
ui->spinBoxEleEyeTriggerIntervalMs->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE || triggerMode == PRINT_TRIGGER_TIME);
|
ui->spinBoxEleEyeTriggerIntervalMs->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE || triggerMode == PRINT_TRIGGER_TIME);
|
||||||
ui->labelEleEyeTriggerIntervalMs->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE);
|
ui->labelEleEyeTriggerIntervalMs->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE);
|
||||||
ui->spinBoxEleEyeTriggerRepeatCnt->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE);
|
ui->spinBoxEleEyeTriggerRepeatCnt->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE);
|
||||||
ui->cb_unlimited->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE);
|
|
||||||
ui->labelEleEyeTriggerRepeatCnt->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE);
|
ui->labelEleEyeTriggerRepeatCnt->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE);
|
||||||
ui->spinBoxEleEyeTriggerPrintDelay->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE || PRINT_TRIGGER_SYNCHRONIZER);
|
ui->spinBoxEleEyeTriggerPrintDelay->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE || PRINT_TRIGGER_SYNCHRONIZER);
|
||||||
ui->labelEleEyeTriggerPrintDelay->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE || PRINT_TRIGGER_SYNCHRONIZER);
|
ui->labelEleEyeTriggerPrintDelay->setEnabled(triggerMode == PRINT_TRIGGER_ELEC_EYE_VOLTATE_LEVEL || triggerMode == PRINT_TRIGGER_ELEC_EYE_EDGE || PRINT_TRIGGER_SYNCHRONIZER);
|
||||||
@@ -638,6 +645,9 @@ void PrintSetting::on_eleEyeEdgetTriggerInner_clicked()
|
|||||||
}else
|
}else
|
||||||
sysPara->para.printTriggerMode = PRINT_TRIGGER_SYNCHRONIZER;
|
sysPara->para.printTriggerMode = PRINT_TRIGGER_SYNCHRONIZER;
|
||||||
setTriggerUI(sysPara->para.printTriggerMode);
|
setTriggerUI(sysPara->para.printTriggerMode);
|
||||||
|
|
||||||
|
sysPara->para.eleEyeTriggerSynPrintEn = false;
|
||||||
|
on_checkEyeTriggerSynPrintEn_clicked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintSetting::setEnableEleEyeSetting(bool flag){
|
void PrintSetting::setEnableEleEyeSetting(bool flag){
|
||||||
@@ -651,16 +661,19 @@ void PrintSetting::setEnableEleEyeSetting(bool flag){
|
|||||||
ui->spinBoxEleMaskTime->setEnabled(flag);
|
ui->spinBoxEleMaskTime->setEnabled(flag);
|
||||||
ui->labelEleEyeTriggerRepeatCnt->setEnabled(flag);
|
ui->labelEleEyeTriggerRepeatCnt->setEnabled(flag);
|
||||||
ui->spinBoxEleEyeTriggerRepeatCnt->setEnabled(flag);
|
ui->spinBoxEleEyeTriggerRepeatCnt->setEnabled(flag);
|
||||||
ui->cb_unlimited->setEnabled(flag);
|
|
||||||
ui->radioButtonEleEyeEdgetTrigger->setEnabled(flag);
|
ui->radioButtonEleEyeEdgetTrigger->setEnabled(flag);
|
||||||
ui->radioButtonEleEyeLevelTrigger->setEnabled(flag);
|
ui->radioButtonEleEyeLevelTrigger->setEnabled(flag);
|
||||||
|
ui->cb_unlimited->setEnabled(flag);
|
||||||
|
if (!flag) ui->cb_unlimited->setChecked(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintSetting::on_eleEyeEdgetTriggerExternal_clicked()
|
void PrintSetting::on_eleEyeEdgetTriggerExternal_clicked()
|
||||||
{
|
{
|
||||||
if (sysPara)
|
sysPara->para.eleEyeTriggerSynPrintEn = ui->radioButtonSynTriggerExternal->isChecked();
|
||||||
|
//电眼和同步器都选外部时,就是同步
|
||||||
on_checkEyeTriggerSynPrintEn_clicked(sysPara->para.eleEyeTriggerSynPrintEn);
|
on_checkEyeTriggerSynPrintEn_clicked(sysPara->para.eleEyeTriggerSynPrintEn);
|
||||||
|
|
||||||
setEnableEleEyeSetting(true);
|
setEnableEleEyeSetting(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -674,7 +687,6 @@ void PrintSetting::setEnableSynTriggerSetting(bool flag){
|
|||||||
ui->comboBoxSyncActType->setEnabled(flag);
|
ui->comboBoxSyncActType->setEnabled(flag);
|
||||||
ui->labelSynPrintMode->setEnabled(flag);
|
ui->labelSynPrintMode->setEnabled(flag);
|
||||||
ui->comboBoxSynPrintMode->setEnabled(flag);
|
ui->comboBoxSynPrintMode->setEnabled(flag);
|
||||||
ui->cb_unlimited->setEnabled(flag);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintSetting::on_radioButtonSynTriggerInner_clicked()
|
void PrintSetting::on_radioButtonSynTriggerInner_clicked()
|
||||||
@@ -685,8 +697,11 @@ void PrintSetting::on_radioButtonSynTriggerInner_clicked()
|
|||||||
sysPara->para.printTriggerMode = PRINT_TRIGGER_TIME;
|
sysPara->para.printTriggerMode = PRINT_TRIGGER_TIME;
|
||||||
setTriggerUI(sysPara->para.printTriggerMode);
|
setTriggerUI(sysPara->para.printTriggerMode);
|
||||||
}
|
}
|
||||||
if (sysPara)
|
if (sysPara) {
|
||||||
on_checkEyeTriggerSynPrintEn_clicked(sysPara->para.eleEyeTriggerSynPrintEn);
|
sysPara->para.eleEyeTriggerSynPrintEn = false;
|
||||||
|
on_checkEyeTriggerSynPrintEn_clicked(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -696,8 +711,10 @@ void PrintSetting::on_radioButtonSynTriggerExternal_clicked()
|
|||||||
if (sysPara)
|
if (sysPara)
|
||||||
sysPara->para.printTriggerMode = PRINT_TRIGGER_SYNCHRONIZER;
|
sysPara->para.printTriggerMode = PRINT_TRIGGER_SYNCHRONIZER;
|
||||||
}
|
}
|
||||||
if (sysPara)
|
if (sysPara) {
|
||||||
|
sysPara->para.eleEyeTriggerSynPrintEn = ui->eleEyeEdgetTriggerExternal->isChecked();
|
||||||
on_checkEyeTriggerSynPrintEn_clicked(sysPara->para.eleEyeTriggerSynPrintEn);
|
on_checkEyeTriggerSynPrintEn_clicked(sysPara->para.eleEyeTriggerSynPrintEn);
|
||||||
|
}
|
||||||
setEnableSynTriggerSetting(true);
|
setEnableSynTriggerSetting(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -26,7 +26,7 @@
|
|||||||
<enum>Qt::StrongFocus</enum>
|
<enum>Qt::StrongFocus</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>3</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tab">
|
<widget class="QWidget" name="tab">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
@@ -211,7 +211,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="">
|
<widget class="QWidget" name="layoutWidget">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>30</x>
|
<x>30</x>
|
||||||
@@ -285,7 +285,7 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="">
|
<widget class="QWidget" name="layoutWidget">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>240</x>
|
<x>240</x>
|
||||||
|
|||||||
+1
-1
@@ -61,7 +61,7 @@
|
|||||||
<string notr="true"/>
|
<string notr="true"/>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>2</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="generalTab">
|
<widget class="QWidget" name="generalTab">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
|
|||||||
@@ -17,7 +17,29 @@
|
|||||||
<string>设置保养间隔</string>
|
<string>设置保养间隔</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
<string notr="true"/>
|
<string notr="true">QWidget{
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
QPushButton {
|
||||||
|
background-color: #5396C1;
|
||||||
|
color: #ffffff;
|
||||||
|
border: 1px solid #000000;
|
||||||
|
border-radius: 3px;
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight:500;
|
||||||
|
height: 30px;
|
||||||
|
width: 100px;
|
||||||
|
}
|
||||||
|
|
||||||
|
QPushButton:hover {
|
||||||
|
background-color: #5396C1;
|
||||||
|
}
|
||||||
|
|
||||||
|
QPushButton:disabled {
|
||||||
|
background-color: #7C828E;
|
||||||
|
color: #606060;
|
||||||
|
border-color: #808080;
|
||||||
|
}</string>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
|
|||||||
@@ -25,6 +25,13 @@ FileManageWidget::FileManageWidget(QWidget *parent) :
|
|||||||
ui->systemFileListView->setProperty("searchPath", DOC_ROOT_DIR);
|
ui->systemFileListView->setProperty("searchPath", DOC_ROOT_DIR);
|
||||||
ui->udiskFileListView->setProperty("searchPath", UDISK_DOC_ROOT_DIR);
|
ui->udiskFileListView->setProperty("searchPath", UDISK_DOC_ROOT_DIR);
|
||||||
|
|
||||||
|
// 清理ui文件中,用于调试的item
|
||||||
|
ui->systemFileListView->clear();
|
||||||
|
ui->udiskFileListView->clear();
|
||||||
|
|
||||||
|
ui->systemFileListView->setMouseTracking(true);
|
||||||
|
ui->udiskFileListView->setMouseTracking(true);
|
||||||
|
|
||||||
updateUDiskDevList();
|
updateUDiskDevList();
|
||||||
|
|
||||||
m_focusedListView = ui->systemFileListView;
|
m_focusedListView = ui->systemFileListView;
|
||||||
@@ -47,7 +54,7 @@ bool FileManageWidget::eventFilter(QObject *watched, QEvent *event)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(event->type() != QEvent::FocusIn) {
|
if(event->type() != QEvent::FocusIn && event->type() != QEvent::MouseMove && event->type() != QEvent::MouseButtonPress) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,7 +72,7 @@ bool FileManageWidget::eventFilter(QObject *watched, QEvent *event)
|
|||||||
m_focusedListView = dynamic_cast<QListWidget *>(watched);
|
m_focusedListView = dynamic_cast<QListWidget *>(watched);
|
||||||
backgroundPanel = dynamic_cast<QWidget *>(watched->parent());
|
backgroundPanel = dynamic_cast<QWidget *>(watched->parent());
|
||||||
palette = backgroundPanel->palette();
|
palette = backgroundPanel->palette();
|
||||||
palette.setColor(backgroundPanel->backgroundRole(), QColor(175, 218, 223));
|
palette.setColor(backgroundPanel->backgroundRole(), "#5396C1");
|
||||||
backgroundPanel->setPalette(palette);
|
backgroundPanel->setPalette(palette);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
+144
-10
@@ -77,6 +77,65 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QWidget" name="widget" native="true">
|
<widget class="QWidget" name="widget" native="true">
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">QScrollBar:vertical {
|
||||||
|
width: 30px; /* 滚动条宽度 */
|
||||||
|
background: #c0c0c0; /* 轨道背景色 */
|
||||||
|
margin: 0px; /* 为上下箭头预留空间 */
|
||||||
|
border-radius: 4px; /* 整体圆角 */
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
QListWidget QScrollBar::handle:vertical {
|
||||||
|
background-color: #5396C1;
|
||||||
|
min-height: 30px;
|
||||||
|
border-radius: 5px;
|
||||||
|
border:1px solid rgb(51, 51, 51);
|
||||||
|
}
|
||||||
|
/* 如果需要隐藏上下箭头按钮,添加以下代码 */
|
||||||
|
QListWidget QScrollBar::sub-line:vertical,
|
||||||
|
QListWidget QScrollBar::add-line:vertical {
|
||||||
|
border: none;
|
||||||
|
background: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
QComboBox {
|
||||||
|
border: 1px solid #000000;
|
||||||
|
border-radius: 3px;
|
||||||
|
font-size: 14px;
|
||||||
|
height: 31px;
|
||||||
|
padding-left: 10px; /* 文字左边距,避免紧贴边缘 */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 下拉箭头区域 */
|
||||||
|
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:hover {
|
||||||
|
background-color: #efefef;
|
||||||
|
}
|
||||||
|
|
||||||
|
QComboBox QAbstractItemView {
|
||||||
|
border: 1px solid #000000;
|
||||||
|
border-radius: 3px;
|
||||||
|
font-size: 16px;
|
||||||
|
selection-background-color: #5396C1; /* 选中项背景色(稍深) */
|
||||||
|
selection-color: #ffffff;
|
||||||
|
}
|
||||||
|
</string>
|
||||||
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
@@ -280,16 +339,16 @@
|
|||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>2</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>2</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>2</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>2</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
@@ -299,7 +358,7 @@
|
|||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
<string notr="true">QListWidget {
|
<string notr="true">QListWidget {
|
||||||
border: 1px;
|
border: 1px;
|
||||||
padding: 5px;
|
padding: 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
QListWidget::item {
|
QListWidget::item {
|
||||||
@@ -309,6 +368,81 @@ QListWidget::item {
|
|||||||
<property name="selectionMode">
|
<property name="selectionMode">
|
||||||
<enum>QAbstractItemView::MultiSelection</enum>
|
<enum>QAbstractItemView::MultiSelection</enum>
|
||||||
</property>
|
</property>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>1</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>2</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>3</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>4</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>5</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>6</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>7</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>8</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>9</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>0</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>-</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>新建项目</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>324</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>45fds</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>2313</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
@@ -324,23 +458,23 @@ QListWidget::item {
|
|||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>2</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>2</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>2</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>2</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QListWidget" name="udiskFileListView">
|
<widget class="QListWidget" name="udiskFileListView">
|
||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
<string notr="true">QListWidget {
|
<string notr="true">QListWidget {
|
||||||
border: 1px;
|
border: 1px;
|
||||||
padding: 5px;
|
padding: 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
QListWidget::item {
|
QListWidget::item {
|
||||||
|
|||||||
@@ -58,6 +58,8 @@ void ScheduleShiftsEditor::setItemModel(QVector<ScheduleModel> schedulesModel, T
|
|||||||
m_dataModel = schedulesModel;
|
m_dataModel = schedulesModel;
|
||||||
|
|
||||||
applyDataModel();
|
applyDataModel();
|
||||||
|
|
||||||
|
ui->timeEdit->setTime(QTime(0, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
TextItemModel ScheduleShiftsEditor::textItemModel()
|
TextItemModel ScheduleShiftsEditor::textItemModel()
|
||||||
@@ -70,11 +72,6 @@ const QVector<ScheduleModel>& ScheduleShiftsEditor::scheduleModel() const
|
|||||||
return m_dataModel;
|
return m_dataModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
PicScheduleShiftItem *ScheduleShiftsEditor::currEditItem()
|
|
||||||
{
|
|
||||||
return dynamic_cast<PicScheduleShiftItem*>(m_generalSettings->currentItem());
|
|
||||||
}
|
|
||||||
|
|
||||||
void ScheduleShiftsEditor::onBtnCloseClicked()
|
void ScheduleShiftsEditor::onBtnCloseClicked()
|
||||||
{
|
{
|
||||||
emit rejected();
|
emit rejected();
|
||||||
|
|||||||
@@ -33,16 +33,12 @@ public:
|
|||||||
explicit ScheduleShiftsEditor(QWidget *parent = nullptr);
|
explicit ScheduleShiftsEditor(QWidget *parent = nullptr);
|
||||||
~ScheduleShiftsEditor();
|
~ScheduleShiftsEditor();
|
||||||
|
|
||||||
void edit(PicScheduleShiftItem* item);
|
|
||||||
|
|
||||||
void setItemModel(QVector<ScheduleModel> schedulesModel, TextItemModel txtModel);
|
void setItemModel(QVector<ScheduleModel> schedulesModel, TextItemModel txtModel);
|
||||||
|
|
||||||
TextItemModel textItemModel();
|
TextItemModel textItemModel();
|
||||||
|
|
||||||
const QVector<ScheduleModel>& scheduleModel() const;
|
const QVector<ScheduleModel>& scheduleModel() const;
|
||||||
|
|
||||||
PicScheduleShiftItem* currEditItem();
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void accepted();
|
void accepted();
|
||||||
void rejected();
|
void rejected();
|
||||||
|
|||||||
@@ -467,3 +467,9 @@ TextItemModel TextItemModel::fromItem(PicTextItem *item)
|
|||||||
}
|
}
|
||||||
return vm;
|
return vm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString TextItemModel::toString(const TextItemModel &model)
|
||||||
|
{
|
||||||
|
return QString("type: %1, letterSpace: %2, dir: %3, bold: %4, coloReversal: %5")
|
||||||
|
.arg(model.sourceType).arg(model.letterSpace).arg(model.direction).arg(model.boldMultiple).arg(model.colorReversal);
|
||||||
|
}
|
||||||
+4
-1
@@ -58,6 +58,8 @@ struct TextItemModel {
|
|||||||
int boldMultiple = 1;
|
int boldMultiple = 1;
|
||||||
int letterSpace = 0;
|
int letterSpace = 0;
|
||||||
bool colorReversal = false;
|
bool colorReversal = false;
|
||||||
|
QString fontFamily = "Dinkie9";
|
||||||
|
int fontSize = 9;
|
||||||
|
|
||||||
std::function<QImage()> imageGenerator; // 图片生成函数
|
std::function<QImage()> imageGenerator; // 图片生成函数
|
||||||
|
|
||||||
@@ -72,8 +74,9 @@ struct TextItemModel {
|
|||||||
letterSpace != other.letterSpace ||
|
letterSpace != other.letterSpace ||
|
||||||
colorReversal != other.colorReversal;
|
colorReversal != other.colorReversal;
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
|
static QString toString(const TextItemModel& model);
|
||||||
|
};
|
||||||
|
|
||||||
class PicTextItem : public QGraphicsTextItem
|
class PicTextItem : public QGraphicsTextItem
|
||||||
{
|
{
|
||||||
|
|||||||
+125
-130
@@ -137,12 +137,8 @@ TestPrintWidget::TestPrintWidget(QWidget* parent)
|
|||||||
});
|
});
|
||||||
|
|
||||||
// 控制区第一行按钮
|
// 控制区第一行按钮
|
||||||
connect(ui.m_btnLeft_Control1, &QPushButton::clicked, [this]() {
|
connect(ui.m_btnLeft_Control1, &QPushButton::clicked, this, &TestPrintWidget::selectPreviousItem);
|
||||||
emit sendButtonClickedSignal(14);
|
connect(ui.m_btnRight_Control1, &QPushButton::clicked, this, &TestPrintWidget::selectNextItem);
|
||||||
});
|
|
||||||
connect(ui.m_btnRight_Control1, &QPushButton::clicked, [this]() {
|
|
||||||
emit sendButtonClickedSignal(15);
|
|
||||||
});
|
|
||||||
|
|
||||||
// 方向箭头按钮
|
// 方向箭头按钮
|
||||||
connect(ui.m_btnUp, &QPushButton::clicked, [this]() {
|
connect(ui.m_btnUp, &QPushButton::clicked, [this]() {
|
||||||
@@ -221,6 +217,9 @@ TestPrintWidget::TestPrintWidget(QWidget* parent)
|
|||||||
|
|
||||||
connect(&m_barcodeEditor, &BarcodeEditor::accepted, this, &TestPrintWidget::slt_BarCodeItemDone);
|
connect(&m_barcodeEditor, &BarcodeEditor::accepted, this, &TestPrintWidget::slt_BarCodeItemDone);
|
||||||
|
|
||||||
|
m_LineEdit->setProperty("Enter replace enter", true);
|
||||||
|
connect(m_LineEdit, &QLineEdit::returnPressed, this, &TestPrintWidget::onLineEditReturnPressed);
|
||||||
|
|
||||||
initSelecteCodeDlg();
|
initSelecteCodeDlg();
|
||||||
|
|
||||||
// 网络通信,暂时屏蔽
|
// 网络通信,暂时屏蔽
|
||||||
@@ -264,106 +263,12 @@ void TestPrintWidget::on_openfileButton_pressed()
|
|||||||
dialogFileOperation->exec();
|
dialogFileOperation->exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestPrintWidget::on_buttonSelectFont_pressed(){
|
|
||||||
|
|
||||||
if(dialogFontSize->exec() == QDialog::Accepted){
|
|
||||||
int fontSize;
|
|
||||||
QString fontFamily;
|
|
||||||
dialogFontSize->getValue(&fontSize);
|
|
||||||
fontFamily = dialogFontSize->getFontFamily();
|
|
||||||
// if(ui->checkBoxBold->isChecked())
|
|
||||||
// fontFamily = getFamilyName(fontSize);
|
|
||||||
// ui->labFontFamily->setText(fontFamily);
|
|
||||||
#ifdef EnableArabic
|
|
||||||
bool switchArabicFlag=false;
|
|
||||||
bool arabicSelect=fontFamily.contains("arabic");
|
|
||||||
if((fontFamily=="biyang" || fontFamily=="wenquanyi")&&(fontSize==7 || fontSize==9)){
|
|
||||||
switchArabicFlag=true;
|
|
||||||
emit EnableSwitchArabicFlag(switchArabicFlag);
|
|
||||||
}else {
|
|
||||||
emit EnableSwitchArabicFlag(switchArabicFlag);
|
|
||||||
}
|
|
||||||
dialogSaveFile->setFileNameEnglishOrArabic(false);
|
|
||||||
emit fontSizeArabicSelect(arabicSelect);
|
|
||||||
#endif
|
|
||||||
// if(sysPara){
|
|
||||||
// sysPara->para.fontPixelSize = fontSize;
|
|
||||||
// }
|
|
||||||
// ui->labelFontSize->setText(QString::number(fontSize));
|
|
||||||
setFontFormat(fontSize,fontFamily);
|
|
||||||
m_TextEdit->setFocus();
|
|
||||||
// emit fontSizeChange(fontSize);
|
|
||||||
// bool flagBangal=false;
|
|
||||||
// if(dialogFontSize->getFontFamily() == "bangla")
|
|
||||||
// flagBangal = true;
|
|
||||||
// emit switchBengalLanguage(flagBangal);
|
|
||||||
|
|
||||||
// toggleVirtualKeyboard();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void TestPrintWidget::setFontFormat(int fontsize,QString fontfamily){
|
|
||||||
//if(sysPara){
|
|
||||||
|
|
||||||
//qreal pixelSize = ui->labelFontSize->text().toFloat();
|
|
||||||
qreal pixelSize = fontsize;
|
|
||||||
// if(pixelSize < Public::getMinFontPixelSize())
|
|
||||||
// pixelSize = sysPara->para.fontPixelSize;
|
|
||||||
|
|
||||||
// if(pixelSize < Public::getMinFontPixelSize()){
|
|
||||||
// pixelSize = Public::getMinFontPixelSize();
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (pixelSize >= 0) {
|
|
||||||
QTextCharFormat fmt;
|
|
||||||
int DPI = m_TextEdit->logicalDpiX();
|
|
||||||
DPI = DPI?DPI:1;
|
|
||||||
qreal pointSize = pixelSize*72/DPI; //Pixel = DPI * Point / 72
|
|
||||||
fmt.setFontPointSize(pointSize);
|
|
||||||
|
|
||||||
#ifdef VNLGXX
|
|
||||||
QString fontFamily = dialogFontSize->getFontFamily();
|
|
||||||
|
|
||||||
#else
|
|
||||||
// QString fontFamily = ui->labFontFamily->text();
|
|
||||||
QString fontFamily = fontfamily;
|
|
||||||
fontFamily = dialogFontSize->getFontFamily();
|
|
||||||
// if(ui->checkBoxBold->isChecked())
|
|
||||||
// fontFamily = getFamilyName(pixelSize);
|
|
||||||
// ui->labFontFamily->setText(fontFamily);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
fmt.setFontFamily(fontFamily);
|
|
||||||
fmt.setFontWeight(0 && (pixelSize<=16)? QFont::Bold:QFont::Normal);
|
|
||||||
mergeFormatOnWordOrSelection(fmt);
|
|
||||||
|
|
||||||
}
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
void TestPrintWidget::mergeFormatOnWordOrSelection(const QTextCharFormat &format)
|
|
||||||
{
|
|
||||||
|
|
||||||
QTextCursor cursor = m_TextEdit->textCursor();
|
|
||||||
//if (!cursor.hasSelection())
|
|
||||||
// cursor.select(QTextCursor::WordUnderCursor);
|
|
||||||
//cursor.mergeCharFormat(format);
|
|
||||||
//textEdit->setTextCursor(cursor);
|
|
||||||
//qDebug()<<"mergeFormatOnWordOrSelection"<<format;
|
|
||||||
//qDebug()<<cursor;
|
|
||||||
m_TextEdit->mergeCurrentCharFormat(format);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void TestPrintWidget::addDateItem()
|
void TestPrintWidget::addDateItem()
|
||||||
{
|
{
|
||||||
// 将sendButtonClickedSignal(16) 转由专门处理
|
|
||||||
pPicScene->clearSelection();
|
pPicScene->clearSelection();
|
||||||
emit sig_showEditDataTime(nullptr);
|
emit sig_showEditDateTime(DateItemModel::createDefaultReplaceModel(), TextItemModel{});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QTextEdit* TestPrintWidget::getQTextEdit(){
|
QTextEdit* TestPrintWidget::getQTextEdit(){
|
||||||
return m_TextEdit;
|
return m_TextEdit;
|
||||||
}
|
}
|
||||||
@@ -583,6 +488,11 @@ void TestPrintWidget::getShowSelectItemText(){
|
|||||||
|
|
||||||
if(lastSelectedTxtItem) {
|
if(lastSelectedTxtItem) {
|
||||||
|
|
||||||
|
// 对于文本item,将它的文本显示到编辑框
|
||||||
|
if(lastSelectedTxtItem->sourceType() == SourceType::TEXT) {
|
||||||
|
m_LineEdit->setText(lastSelectedTxtItem->source().toString());
|
||||||
|
}
|
||||||
|
|
||||||
QString currItemFontFamily = lastSelectedTxtItem->font().family();
|
QString currItemFontFamily = lastSelectedTxtItem->font().family();
|
||||||
|
|
||||||
QHash<QString, int> fontNameToIndex;
|
QHash<QString, int> fontNameToIndex;
|
||||||
@@ -980,29 +890,6 @@ void TestPrintWidget::parseVbfile(QXmlStreamReader &reader) {
|
|||||||
}
|
}
|
||||||
pPictText->setHtml(strCDATA);
|
pPictText->setHtml(strCDATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if(Condition)
|
|
||||||
// {
|
|
||||||
// SpecialVarPrint specialVarPrint;
|
|
||||||
// specialVarPrint.SpecialVarEnable = Condition;
|
|
||||||
// specialVarPrint.SpecialVarCountStart = CatchStartValue;
|
|
||||||
// specialVarPrint.SpecialVarCountEnd = CatchValue;
|
|
||||||
// specialVarPrint.SpecialVarColStart = 3 + pos_x- pPicScene->itemsBoundingRect().x();
|
|
||||||
// specialVarPrint.SpecialVarColEnd = 3 + pos_x - pPicScene->itemsBoundingRect().x()+ pPictText->boundingRect().width();
|
|
||||||
// specialVarPrint.SpecialVarRowStart = pos_y - pPicScene->itemsBoundingRect().y();
|
|
||||||
// specialVarPrint.SpecialVarRowEnd = pos_y - pPicScene->itemsBoundingRect().y()+ pPictText->boundingRect().height();
|
|
||||||
// sysPara->devOp->fpgaWr(0xa4b0,(unsigned char *)&specialVarPrint,sizeof(SpecialVarPrint)); // Send specialVarPrint 2022-8-6
|
|
||||||
// LogInfo::setRunStatusText(tr("发送特殊变量内容:"));
|
|
||||||
// LogInfo::setRunStatusText(tr("SpecialVarEnable:%1").arg(QString().sprintf("%02X",specialVarPrint.SpecialVarEnable)));
|
|
||||||
// LogInfo::setRunStatusText(tr("SpecialVarCountStart:%1").arg(QString().sprintf("%02X",specialVarPrint.SpecialVarCountStart)));
|
|
||||||
// LogInfo::setRunStatusText(tr("SpecialVarCountEnd:%1").arg(QString().sprintf("%02X",specialVarPrint.SpecialVarCountEnd)));
|
|
||||||
// LogInfo::setRunStatusText(tr("SpecialVarColStart:%1").arg(QString().sprintf("%02X",specialVarPrint.SpecialVarColStart)));
|
|
||||||
// LogInfo::setRunStatusText(tr("SpecialVarColEnd:%1").arg(QString().sprintf("%02X",specialVarPrint.SpecialVarColEnd)));
|
|
||||||
// LogInfo::setRunStatusText(tr("SpecialVarRowStart:%1").arg(QString().sprintf("%02X",specialVarPrint.SpecialVarRowStart)));
|
|
||||||
// LogInfo::setRunStatusText(tr("SpecialVarRowEnd:%1").arg(QString().sprintf("%02X",specialVarPrint.SpecialVarRowEnd)));
|
|
||||||
// LogInfo::setRunStatusText(tr("itemsBoundingRect().y():%1").arg(QString().sprintf("%02X",pPicScene->itemsBoundingRect().y())));
|
|
||||||
// LogInfo::setRunStatusText(tr("itemsBoundingRect().x():%1").arg(QString().sprintf("%02X",pPicScene->itemsBoundingRect().x())));
|
|
||||||
// }
|
|
||||||
Condition= false ;
|
Condition= false ;
|
||||||
CatchValue = -1;
|
CatchValue = -1;
|
||||||
CatchStartValue = -1;
|
CatchStartValue = -1;
|
||||||
@@ -1370,7 +1257,7 @@ void TestPrintWidget::onBtnItemConfigClicked()
|
|||||||
if(item->sourceType() == SourceType::DATETIME) {
|
if(item->sourceType() == SourceType::DATETIME) {
|
||||||
// @see TestPrintWidget::addDateTimeItem
|
// @see TestPrintWidget::addDateTimeItem
|
||||||
auto dateTimeItem = dynamic_cast<PicDateItem*>(item);
|
auto dateTimeItem = dynamic_cast<PicDateItem*>(item);
|
||||||
emit sig_showEditDataTime(dateTimeItem);
|
emit sig_showEditDateTime(dateTimeItem->model(), dateTimeItem->textItemModel());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1403,7 +1290,8 @@ void TestPrintWidget::onItemEditorAccepted()
|
|||||||
if(itemEditor->currentItem()->source() == SourceType::UNKNOWN)
|
if(itemEditor->currentItem()->source() == SourceType::UNKNOWN)
|
||||||
onEditItemCounterDone();
|
onEditItemCounterDone();
|
||||||
else {
|
else {
|
||||||
itemEditor->currentItem()->applyModify();
|
PicTextItem* textItem = itemEditor->currentItem();
|
||||||
|
textItem->applyModify();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1477,6 +1365,106 @@ void TestPrintWidget::slt_QRCodeItemDone(QString str)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QGraphicsItem* findClosestItemToViewCenter(QGraphicsView* view)
|
||||||
|
{
|
||||||
|
if (!view || !view->scene())
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
// 1. 获取视口中心点(视口坐标)并映射到场景坐标
|
||||||
|
QPoint viewCenter = view->viewport()->rect().center();
|
||||||
|
QPointF sceneCenter = view->mapToScene(viewCenter);
|
||||||
|
|
||||||
|
// 2. 获取场景中所有项
|
||||||
|
QList<QGraphicsItem*> items = view->scene()->items();
|
||||||
|
|
||||||
|
// 3. 寻找最近项
|
||||||
|
QGraphicsItem* closestItem = nullptr;
|
||||||
|
qreal minDistSq = std::numeric_limits<qreal>::max();
|
||||||
|
|
||||||
|
for (QGraphicsItem* item : items) {
|
||||||
|
// 可选项:跳过不可见项(根据需求决定)
|
||||||
|
if (!item->isVisible()) continue;
|
||||||
|
|
||||||
|
// 计算项的场景位置到中心点的平方距离(避免开方,性能更好)
|
||||||
|
QPointF itemPos = item->scenePos();
|
||||||
|
qreal dx = itemPos.x() - sceneCenter.x();
|
||||||
|
qreal dy = itemPos.y() - sceneCenter.y();
|
||||||
|
qreal distSq = dx * dx + dy * dy;
|
||||||
|
|
||||||
|
if (distSq < minDistSq) {
|
||||||
|
minDistSq = distSq;
|
||||||
|
closestItem = item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return closestItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestPrintWidget::selectItemByDirection(bool forward)
|
||||||
|
{
|
||||||
|
auto selectedItems = pPicScene->selectedItems();
|
||||||
|
|
||||||
|
// 如果当前没有选中项,且场景中存在项,则选择距离当前视图中心的项
|
||||||
|
if(selectedItems.isEmpty() && !pPicScene->items().isEmpty()) {
|
||||||
|
auto closestItem = findClosestItemToViewCenter(pViewer);
|
||||||
|
if(closestItem) {
|
||||||
|
closestItem->setSelected(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(selectedItems.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
auto currItem = selectedItems.last();
|
||||||
|
if(!currItem)
|
||||||
|
return;
|
||||||
|
|
||||||
|
auto items = pPicScene->items();
|
||||||
|
if(items.size() <= 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
std::sort(items.begin(), items.end(), [](QGraphicsItem* a, QGraphicsItem* b) {
|
||||||
|
return a->pos().x() < b->pos().x();
|
||||||
|
});
|
||||||
|
|
||||||
|
auto it = std::find(items.begin(), items.end(), currItem);
|
||||||
|
if(it == items.end())
|
||||||
|
it = items.begin();
|
||||||
|
|
||||||
|
QGraphicsItem* nextItem = nullptr;
|
||||||
|
if(forward) {
|
||||||
|
nextItem = (it + 1 == items.end()) ? items.first() : *(it + 1);
|
||||||
|
} else {
|
||||||
|
nextItem = (it == items.begin()) ? items.last() : *(it - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(nextItem) {
|
||||||
|
pPicScene->clearSelection();
|
||||||
|
nextItem->setSelected(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestPrintWidget::selectNextItem()
|
||||||
|
{
|
||||||
|
selectItemByDirection(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestPrintWidget::selectPreviousItem()
|
||||||
|
{
|
||||||
|
selectItemByDirection(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestPrintWidget::onLineEditReturnPressed()
|
||||||
|
{
|
||||||
|
if(pPicScene->selectedItems().size() != 0) {
|
||||||
|
qDebug() << "Change current item text";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
qDebug() << "Add new item text";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void TestPrintWidget::on_cbResolution_currentIndexChanged(int index)
|
void TestPrintWidget::on_cbResolution_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
constexpr char* IdxToFontFamily[] = {"WenQuanYi5",
|
constexpr char* IdxToFontFamily[] = {"WenQuanYi5",
|
||||||
@@ -1537,7 +1525,7 @@ void TestPrintWidget::setFontNameIndex(float fontsize)
|
|||||||
ui.cbResolution->setCurrentIndex(currIndex);
|
ui.cbResolution->setCurrentIndex(currIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestPrintWidget::addDateTimeItem(const DateItemModel &model)
|
void TestPrintWidget::addDateTimeItem(const DateItemModel &model, const TextItemModel& textModel)
|
||||||
{
|
{
|
||||||
// 如果当前选中了一个日期时间item,则直接设置模型
|
// 如果当前选中了一个日期时间item,则直接设置模型
|
||||||
auto selectItems = pPicScene->selectedItems();
|
auto selectItems = pPicScene->selectedItems();
|
||||||
@@ -1545,6 +1533,7 @@ void TestPrintWidget::addDateTimeItem(const DateItemModel &model)
|
|||||||
auto item = dynamic_cast<PicTextItem*>(selectItems[0]);
|
auto item = dynamic_cast<PicTextItem*>(selectItems[0]);
|
||||||
if(item->sourceType() == SourceType::DATETIME) {
|
if(item->sourceType() == SourceType::DATETIME) {
|
||||||
auto dateTimeItem = dynamic_cast<PicDateItem*>(item);
|
auto dateTimeItem = dynamic_cast<PicDateItem*>(item);
|
||||||
|
dateTimeItem->setTextItemModel(textModel);
|
||||||
dateTimeItem->setModel(model);
|
dateTimeItem->setModel(model);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1662,12 +1651,18 @@ void TestPrintWidget::onBtnArrowClicked()
|
|||||||
void TestPrintWidget::on_btn_copy_clicked()
|
void TestPrintWidget::on_btn_copy_clicked()
|
||||||
{
|
{
|
||||||
int index = checkSelectScene();
|
int index = checkSelectScene();
|
||||||
if (index < 0) return;
|
if (index < 0) {
|
||||||
|
qInfo() << "Not selected any item.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
PicTextItem* srcItem = dynamic_cast<PicTextItem*>(pPicScene->items().at(index));
|
PicTextItem* srcItem = dynamic_cast<PicTextItem*>(pPicScene->items().at(index));
|
||||||
if (!srcItem) return;
|
if (!srcItem) {
|
||||||
cacheSelectedLayerForPaste(srcItem);
|
qWarning() << "Cannot cast item type to correct type";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
cacheSelectedLayerForPaste(srcItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestPrintWidget::on_btn_paste_clicked()
|
void TestPrintWidget::on_btn_paste_clicked()
|
||||||
|
|||||||
+14
-5
@@ -72,7 +72,7 @@ public:
|
|||||||
|
|
||||||
void setFontNameIndex(float);
|
void setFontNameIndex(float);
|
||||||
|
|
||||||
void addDateTimeItem(const DateItemModel& model);
|
void addDateTimeItem(const DateItemModel& model, const TextItemModel& textModel);
|
||||||
|
|
||||||
void addScheduleShiftsItem(QVector<ScheduleModel> schedules, TextItemModel txtModel);
|
void addScheduleShiftsItem(QVector<ScheduleModel> schedules, TextItemModel txtModel);
|
||||||
|
|
||||||
@@ -102,6 +102,13 @@ public slots:
|
|||||||
void slt_BarCodeItemDone();
|
void slt_BarCodeItemDone();
|
||||||
|
|
||||||
void slt_QRCodeItemDone(QString str);
|
void slt_QRCodeItemDone(QString str);
|
||||||
|
|
||||||
|
void selectNextItem();
|
||||||
|
|
||||||
|
void selectPreviousItem();
|
||||||
|
|
||||||
|
void onLineEditReturnPressed();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// 重写事件过滤器
|
// 重写事件过滤器
|
||||||
bool eventFilter(QObject *watched, QEvent *event) override;
|
bool eventFilter(QObject *watched, QEvent *event) override;
|
||||||
@@ -184,7 +191,6 @@ private:
|
|||||||
//寻找当前选中的图层,没有选中的就不继续处理
|
//寻找当前选中的图层,没有选中的就不继续处理
|
||||||
int checkSelectScene();
|
int checkSelectScene();
|
||||||
|
|
||||||
|
|
||||||
// 复制
|
// 复制
|
||||||
int pasteTime = 1;
|
int pasteTime = 1;
|
||||||
SourceType m_copiedSourceType = SourceType::UNKNOWN;
|
SourceType m_copiedSourceType = SourceType::UNKNOWN;
|
||||||
@@ -201,20 +207,23 @@ private:
|
|||||||
QPointF m_copiedPos;
|
QPointF m_copiedPos;
|
||||||
//判断要复制什么图层,添加该图层
|
//判断要复制什么图层,添加该图层
|
||||||
PicTextItem* checkSelectItem(PicTextItem* srcItem);
|
PicTextItem* checkSelectItem(PicTextItem* srcItem);
|
||||||
|
|
||||||
//保存复制内容
|
//保存复制内容
|
||||||
bool cacheSelectedLayerForPaste(PicTextItem* srcItem);
|
bool cacheSelectedLayerForPaste(PicTextItem* srcItem);
|
||||||
|
|
||||||
//粘贴
|
//粘贴
|
||||||
void pasteCopiedLayer();
|
void pasteCopiedLayer();
|
||||||
|
|
||||||
|
void selectItemByDirection(bool forward);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void sendButtonClickedSignal(int index);
|
void sendButtonClickedSignal(int index);
|
||||||
void sendUpdateFontSignl(int);
|
void sendUpdateFontSignl(int);
|
||||||
|
|
||||||
void sig_showEditCounter(CounterViewModel viewModel);
|
void sig_showEditCounter(CounterViewModel viewModel);
|
||||||
|
|
||||||
// 用户请求打开日期类型图元编辑窗口时发送此信号,
|
// 用户请求打开日期类型图元编辑窗口时发送此信号
|
||||||
// 如果item为null,表明是从新建按钮发出的,如果item不为null,表明用户正在尝试编辑一个日期item
|
void sig_showEditDateTime(DateItemModel dateModel, TextItemModel textModel);
|
||||||
void sig_showEditDataTime(PicDateItem* item);
|
|
||||||
|
|
||||||
void sig_showScheduleShiftsEditor(QVector<ScheduleModel> schedules, TextItemModel txtModel);
|
void sig_showScheduleShiftsEditor(QVector<ScheduleModel> schedules, TextItemModel txtModel);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user