2026年6月25日 暂存
This commit is contained in:
+10
-1
@@ -345,7 +345,7 @@ void BarcodeEditor::onBarcodeFormatConfirmed()
|
||||
void BarcodeEditor::onQrcodeFormatConfirmed()
|
||||
{
|
||||
m_vm.format.setValue(m_qrcodeFormatEditor.viewModel());
|
||||
m_vm.type = BARCODE_TYPE_QRCODE;
|
||||
// m_vm.type = BARCODE_TYPE_QRCODE;
|
||||
|
||||
auto b = ui->cbBoxType->blockSignals(true);
|
||||
ui->cbBoxType->setCurrentIndex(int(m_vm.type));
|
||||
@@ -586,3 +586,12 @@ QString BarcodeViewModel::toString(const BarcodeViewModel &vm)
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
void BarcodeEditor::on_cbBoxType_currentIndexChanged(int index)
|
||||
{
|
||||
//bar 0; qr 1; dm 2;
|
||||
m_vm.type = index;
|
||||
if (index == 0) return;
|
||||
m_qrcodeFormatEditor.setCodeType(ui->cbBoxType->currentText());
|
||||
onQrcodeFormatConfirmed();
|
||||
}
|
||||
|
||||
@@ -15,8 +15,9 @@ class DateReplaceEditor;
|
||||
class CounterEditor;
|
||||
|
||||
enum BarcodeType {
|
||||
BARCODE_TYPE_BARCODE,
|
||||
BARCODE_TYPE_QRCODE,
|
||||
BARCODE_TYPE_BARCODE = 0,
|
||||
BARCODE_TYPE_QRCODE = 1,
|
||||
BARCODE_TYPE_DMCODE = 2,
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -179,6 +180,8 @@ private slots:
|
||||
|
||||
void onTypeChanged(int i);
|
||||
|
||||
void on_cbBoxType_currentIndexChanged(int index);
|
||||
|
||||
protected:
|
||||
virtual bool eventFilter(QObject* obj, QEvent* event) override;
|
||||
|
||||
|
||||
@@ -277,7 +277,12 @@ QSpinBox::down-arrow {
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>二维码</string>
|
||||
<string>QRCode</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>DataMatrix</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
@@ -291,7 +296,7 @@ QSpinBox::down-arrow {
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>条形码格式</string>
|
||||
<string>码格式</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
|
||||
@@ -79,7 +79,7 @@ QComboBox::drop-down {
|
||||
|
||||
/* 下拉箭头图标 */
|
||||
QComboBox::down-arrow {
|
||||
image: url(image/down_white.png);
|
||||
image: url(:/image/down_white.png);
|
||||
width: 16px; /* 图标显示宽度 */
|
||||
height: 16px; /* 图标显示高度 */
|
||||
}
|
||||
@@ -107,7 +107,7 @@ QSpinBox::up-button {
|
||||
}
|
||||
|
||||
QSpinBox::up-arrow {
|
||||
image: url(image/up_white.png);
|
||||
image: url(:/image/up_white.png);
|
||||
}
|
||||
|
||||
QSpinBox::down-button {
|
||||
@@ -119,7 +119,7 @@ QSpinBox::down-button {
|
||||
}
|
||||
|
||||
QSpinBox::down-arrow {
|
||||
image: url(image/down_white.png);
|
||||
image: url(:/image/down_white.png);
|
||||
}
|
||||
</string>
|
||||
</property>
|
||||
|
||||
@@ -7,6 +7,7 @@ DlgQrcodeFormat::DlgQrcodeFormat(QWidget *parent) :
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setViewModel(m_vm);
|
||||
ui->comboBoxType->setEnabled(false);
|
||||
}
|
||||
|
||||
DlgQrcodeFormat::~DlgQrcodeFormat()
|
||||
@@ -31,3 +32,9 @@ DlgQrcodeFormatVM DlgQrcodeFormat::viewModel()
|
||||
m_vm.size = QRCodeSize(ui->comboBox_DMType->currentIndex());
|
||||
return m_vm;
|
||||
}
|
||||
|
||||
void DlgQrcodeFormat::setCodeType(QString type)
|
||||
{
|
||||
// type = "QRCode" "DataMatrix"
|
||||
ui->comboBoxType->setCurrentText(type);
|
||||
}
|
||||
|
||||
@@ -51,6 +51,7 @@ public:
|
||||
|
||||
DlgQrcodeFormatVM viewModel();
|
||||
|
||||
void setCodeType(QString type);
|
||||
private:
|
||||
Ui::DlgQrcodeFormat *ui;
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ QComboBox::drop-down {
|
||||
|
||||
/* 下拉箭头图标 */
|
||||
QComboBox::down-arrow {
|
||||
image: url(image/down_white.png);
|
||||
image: url(:/image/down_white.png);
|
||||
width: 16px; /* 图标显示宽度 */
|
||||
height: 16px; /* 图标显示高度 */
|
||||
}
|
||||
@@ -110,7 +110,7 @@ QSpinBox::up-button {
|
||||
}
|
||||
|
||||
QSpinBox::up-arrow {
|
||||
image: url(image/up_white.png);
|
||||
image: url(:/image/up_white.png);
|
||||
}
|
||||
|
||||
QSpinBox::down-button {
|
||||
@@ -122,7 +122,7 @@ QSpinBox::down-button {
|
||||
}
|
||||
|
||||
QSpinBox::down-arrow {
|
||||
image: url(image/down_white.png);
|
||||
image: url(:/image/down_white.png);
|
||||
}
|
||||
</string>
|
||||
</property>
|
||||
|
||||
@@ -460,7 +460,7 @@ QImage ItemUtils::generateBarcodeImage(const QString &content, BarcodeType type,
|
||||
return QImage();
|
||||
}
|
||||
|
||||
if (type == BARCODE_TYPE_QRCODE) {
|
||||
if (type == BARCODE_TYPE_QRCODE || type == BARCODE_TYPE_DMCODE) {
|
||||
// 优先级:完整VM配置 > 简化int配置 > 默认配置
|
||||
// 原因:支持从UI直接传递结构体,同时保留向后兼容的快速路径
|
||||
if (format.canConvert<DlgQrcodeFormatVM>()) {
|
||||
|
||||
@@ -440,11 +440,6 @@ QImage PicTextItem::strToImage(const QString &str)
|
||||
QPainter painter;
|
||||
QFontMetrics fm(font());
|
||||
QImage img(fm.horizontalAdvance(str), fm.height(), QImage::Format_ARGB32);
|
||||
qDebug() << "strToImage: letterSpace: " << letterSpace();
|
||||
|
||||
if(letterSpace() == 2) {
|
||||
qDebug() << "Break point";
|
||||
}
|
||||
|
||||
QRgb txtColor = colorReversal() ? 0xffffffff : 0xff000000;
|
||||
QRgb bgColor = colorReversal() ? 0xff000000 : 0x00000000;
|
||||
|
||||
Reference in New Issue
Block a user