File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2233,15 +2233,20 @@ void Window::popupPrintDialog()
22332233 m_pPreview = new DPrintPreviewDialog (this );
22342234 m_pPreview->setAttribute (Qt::WA_DeleteOnClose);
22352235
2236- // 设置 QPrinter 的文档名称,保留绝对路径和文件后缀(在cups的page_log中保留完整的job-name)
2237- // 注意和文件的输出文件路径进行区分
22382236 if (fileDir == m_blankFileDir) {
2237+ QString name = m_tabbar->currentName ();
2238+ QRegularExpression reg (" [^*](.+)" );
2239+ QRegularExpressionMatch match = reg.match (name);
2240+ QString docName = match.captured (0 );
2241+ qInfo () << __func__ << " print blank file, docName:" << docName;
22392242 qInfo () << qPrintable (" Print blank file" );
2240- m_pPreview->setDocName (filePath );
2243+ m_pPreview->setDocName (docName );
22412244 } else {
22422245 qInfo () << qPrintable (" Print file: " ) << filePath;
22432246 QString path = currentWrapper ()->textEditor ()->getTruePath ();
2244- m_pPreview->setDocName (path);
2247+ QString docName = QFileInfo (path).baseName ();
2248+ qInfo () << __func__ << " print normal file, docName:" << docName;
2249+ m_pPreview->setDocName (docName);
22452250 }
22462251
22472252 // 后续布局计算后再更新打印页数
You can’t perform that action at this time.
0 commit comments