完善RFID卡
This commit is contained in:
+51
-15
@@ -96,9 +96,8 @@ TestPrintWidget::TestPrintWidget(QWidget* parent)
|
||||
connect(ui.btn3D, &QPushButton::clicked, this, &TestPrintWidget::onBtn3DClicked);
|
||||
|
||||
// 顶部工具栏按钮
|
||||
connect(ui.btnSave, &QPushButton::clicked, [this]() {
|
||||
emit sendButtonClickedSignal(8);
|
||||
});
|
||||
connect(ui.btnSave, &QPushButton::clicked, this, &TestPrintWidget::on_saveButton_pressed);
|
||||
|
||||
connect(ui.btnListConfig, &QPushButton::clicked, [this]() {
|
||||
emit sendButtonClickedSignal(9);
|
||||
});
|
||||
@@ -173,15 +172,20 @@ TestPrintWidget::TestPrintWidget(QWidget* parent)
|
||||
// 勾选按钮
|
||||
connect(ui.m_btnCheck, &QPushButton::clicked, [this]() {
|
||||
QMessageBox::StandardButton ret = QMessageBox::Ok;
|
||||
ret = QMessageBox::warning(this, tr("提示"),
|
||||
tr("是否保存文件?"),
|
||||
QMessageBox::Ok | QMessageBox::Cancel);
|
||||
ret = QMessageBox::warning(this, tr("提示"),
|
||||
tr("是否保存文件?"),
|
||||
QMessageBox::Ok | QMessageBox::Cancel);
|
||||
|
||||
if (ret == QMessageBox::Ok){
|
||||
on_saveButton_pressed();
|
||||
}
|
||||
emit sendButtonClickedSignal(20);
|
||||
});
|
||||
if (ret == QMessageBox::Ok){
|
||||
disconnect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),0,0);
|
||||
connect(dialogSaveFile,SIGNAL(saveFile(QString,bool)),this,SLOT(onSaveASFile(QString,bool)));
|
||||
dialogSaveFile->saveLastWork();
|
||||
emit sig_updatePrintContent();
|
||||
} else {
|
||||
dialogFileOperation->openLastWork();
|
||||
}
|
||||
emit sendButtonClickedSignal(20);
|
||||
});
|
||||
|
||||
|
||||
imageLoader = new ImageLoader();
|
||||
@@ -195,6 +199,8 @@ TestPrintWidget::TestPrintWidget(QWidget* parent)
|
||||
m_LineEdit->setProperty("Enter replace enter", true);
|
||||
connect(m_LineEdit, &QLineEdit::returnPressed, this, &TestPrintWidget::onLineEditReturnPressed);
|
||||
|
||||
m_LineEdit->installEventFilter(this);
|
||||
|
||||
// 网络通信,暂时屏蔽
|
||||
// ui.btnList->hide();
|
||||
}
|
||||
@@ -209,6 +215,8 @@ void TestPrintWidget::bindSysPara(SysPara *sysPara)
|
||||
|
||||
TestPrintWidget::~TestPrintWidget()
|
||||
{
|
||||
m_LineEdit->removeEventFilter(this);
|
||||
|
||||
if(m_pSavePicScene)
|
||||
{
|
||||
delete m_pSavePicScene;
|
||||
@@ -226,6 +234,13 @@ TestPrintWidget::~TestPrintWidget()
|
||||
|
||||
}
|
||||
|
||||
void TestPrintWidget::loadLastWork()
|
||||
{
|
||||
if (dialogFileOperation) {
|
||||
dialogFileOperation->openLastWork();
|
||||
}
|
||||
}
|
||||
|
||||
QPixmap TestPrintWidget::loadIcon(const QString& iconName, const QSize& size)
|
||||
{
|
||||
QString iconPath = QString(":/icons/res/icons/%1.png").arg(iconName);
|
||||
@@ -300,13 +315,26 @@ void TestPrintWidget::on_addButton_pressed(const SourceType type)
|
||||
void TestPrintWidget::onEditItemDone()
|
||||
{
|
||||
const QString content = m_LineEdit->text();
|
||||
foreach (QGraphicsItem *item, pPicScene->selectedItems())
|
||||
auto selectedItems = pPicScene->selectedItems();
|
||||
foreach (QGraphicsItem *item, selectedItems)
|
||||
{
|
||||
PicTextItem* pTextItem = dynamic_cast<PicTextItem*>(item);
|
||||
if (pTextItem == nullptr) continue;
|
||||
|
||||
if(pTextItem->sourceType() == SourceType::TEXT)
|
||||
if(pTextItem->sourceType() == SourceType::TEXT) {
|
||||
if(content.isEmpty()) {
|
||||
pPicScene->removeItem(pTextItem);
|
||||
delete pTextItem;
|
||||
continue;
|
||||
}
|
||||
|
||||
pTextItem->setSource(content);
|
||||
|
||||
if(pPicScene->items().count() == 1) {
|
||||
pTextItem->setPos(pTextItem->clampItemPos(pTextItem->scenePos()));
|
||||
qDebug() << "Text item pos: " << pTextItem->pos();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -367,7 +395,7 @@ void TestPrintWidget::getShowSelectItemText()
|
||||
void TestPrintWidget::on_saveButton_pressed()
|
||||
{
|
||||
pPicScene->clearSelection();
|
||||
if(xmlfileName.isEmpty())
|
||||
if(xmlfileName.isEmpty() || xmlfileName.contains("LastWork.xml"))
|
||||
{
|
||||
qDebug()<<"xml file null";
|
||||
#ifdef MYSAVEFILEDLG
|
||||
@@ -982,7 +1010,8 @@ void TestPrintWidget::on_delButton_pressed()
|
||||
int index = checkSelectScene();
|
||||
if (index < 0) return;
|
||||
|
||||
foreach (QGraphicsItem *item, pPicScene->selectedItems()) {
|
||||
auto selectedItems = pPicScene->selectedItems();
|
||||
foreach (QGraphicsItem *item, selectedItems) {
|
||||
pPicScene->removeItem(item);
|
||||
delete item;
|
||||
break;
|
||||
@@ -1023,6 +1052,12 @@ bool TestPrintWidget::eventFilter(QObject *watched, QEvent *event) {
|
||||
}
|
||||
}
|
||||
|
||||
if(watched == m_LineEdit) {
|
||||
if(event->type() == QEvent::FocusOut) {
|
||||
onEditItemDone();
|
||||
}
|
||||
}
|
||||
|
||||
// 其他事件交给父类处理
|
||||
return QWidget::eventFilter(watched, event);
|
||||
}
|
||||
@@ -1116,6 +1151,7 @@ void TestPrintWidget::onBtnItemConfigClicked()
|
||||
#if defined(ARCH_AARCH64)
|
||||
itemEditor->showFullScreen();
|
||||
#else
|
||||
itemEditor->setWindowModality(Qt::WindowModal);
|
||||
itemEditor->show();
|
||||
#endif;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user