Skip to content

Commit ece08fc

Browse files
committed
fix: remove dead DPrinter construction in popupPrintDialog
1. Root cause: popupPrintDialog() constructs a DPrinter local variable (QPrinter::HighResolution) that is never used; its constructor synchronously loads the cups plugin and enumerates printers, adding avoidable latency to print preview 2. Fix: remove the unused DPrinter printer(QPrinter::HighResolution) line introduced by commit 9fcf3e4; the actual print dialog uses DPrintPreviewDialog with no arguments and builds its own printer 3. Impact: print preview opens faster by eliminating one redundant synchronous printer enumeration; no behavior change for valid print paths; no -Wunused-variable warning after removal Log: Remove dead DPrinter construction to speed up print preview Influence: 1. Test print preview with a syntax-highlighted file 2. Test print preview with a plain text file 3. Verify no unused-variable warnings in build output fix: 删除 popupPrintDialog 中无用的 DPrinter 构造 1. 根因:popupPrintDialog() 构造了一个从未使用的 DPrinter 局部 变量(QPrinter::HighResolution),其构造函数同步加载 cups 插件并枚举打印机,为打印预览增加不必要的延迟 2. 方案:删除由 commit 9fcf3e4 引入的无用 DPrinter printer( QPrinter::HighResolution) 行;实际打印对话框使用无参 DPrintPreviewDialog 并在内部自建 printer 3. 影响:消除一次冗余的同步打印机枚举,打印预览打开更快; 对有效打印路径无行为变化;删除后无 -Wunused-variable 告警 Log: 删除无用 DPrinter 构造以加速打印预览 Influence: 1. 测试语法高亮文件的打印预览 2. 测试纯文本文件的打印预览 3. 验证编译输出无 unused-variable 告警 PMS: BUG-375053
1 parent 3273183 commit ece08fc

1 file changed

Lines changed: 0 additions & 1 deletion

File tree

‎src/widgets/window.cpp‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2441,7 +2441,6 @@ void Window::popupPrintDialog()
24412441
return;
24422442
}
24432443

2444-
DPrinter printer(QPrinter::HighResolution);
24452444
m_isNewPrint = true;
24462445
m_pPreview = new DPrintPreviewDialog(this);
24472446
m_pPreview->setAttribute(Qt::WA_DeleteOnClose);

0 commit comments

Comments
 (0)