File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1968,13 +1968,18 @@ void Window::popupPrintDialog()
19681968 m_pPreview = new DPrintPreviewDialog (this );
19691969 m_pPreview->setAttribute (Qt::WA_DeleteOnClose);
19701970
1971- // 设置 QPrinter 的文档名称,保留绝对路径和文件后缀(在cups的page_log中保留完整的job-name)
1972- // 注意和文件的输出文件路径进行区分
19731971 if (fileDir == m_blankFileDir) {
1974- m_pPreview->setDocName (filePath);
1972+ QString name = m_tabbar->currentName ();
1973+ QRegularExpression reg (" [^*](.+)" );
1974+ QRegularExpressionMatch match = reg.match (name);
1975+ QString docName = match.captured (0 );
1976+ qInfo () << __func__ << " print blank file, docName:" << docName;
1977+ m_pPreview->setDocName (docName);
19751978 } else {
19761979 QString path = currentWrapper ()->textEditor ()->getTruePath ();
1977- m_pPreview->setDocName (path);
1980+ QString docName = QFileInfo (path).baseName ();
1981+ qInfo () << __func__ << " print normal file, docName:" << docName;
1982+ m_pPreview->setDocName (docName);
19781983 }
19791984
19801985 // 后续布局计算后再更新打印页数
You can’t perform that action at this time.
0 commit comments