- enhancement: Print current selection can be used in the print dialog.

This commit is contained in:
Roy Qu 2023-01-05 18:38:36 +08:00
parent 89ee9d8914
commit 17160b7c3d
3 changed files with 10 additions and 7 deletions

View File

@ -14,6 +14,7 @@ Red Panda C++ Version 2.8
- fix: Restore main window and cpu info window will set wrong font in the cpu info. - fix: Restore main window and cpu info window will set wrong font in the cpu info.
- enhancement: Let encoding options in the statusbar more explicit. - enhancement: Let encoding options in the statusbar more explicit.
- fix: Crash when find occurrences in a project that has missing files. - fix: Crash when find occurrences in a project that has missing files.
- enhancement: Print current selection can be used in the print dialog.
Red Panda C++ Version 2.7 Red Panda C++ Version 2.7

View File

@ -2954,16 +2954,19 @@ void Editor::print()
QPrintDialog dialog(&printer, this); QPrintDialog dialog(&printer, this);
dialog.setWindowTitle(tr("Print Document")); dialog.setWindowTitle(tr("Print Document"));
// if (editor->selAvail()) dialog.setOption(QAbstractPrintDialog::PrintCurrentPage,false);
// dialog.addEnabledOption(QAbstractPrintDialog::PrintSelection); dialog.setOption(QAbstractPrintDialog::PrintPageRange,false);
if (selAvail())
dialog.setOption(QAbstractPrintDialog::PrintSelection);
if (dialog.exec() != QDialog::Accepted) { if (dialog.exec() != QDialog::Accepted) {
return; return;
} }
QTextDocument doc; QTextDocument doc;
// if (editor->selAvail()) { QStringList lst;
// doc.setPlainText(editor->selText()); if (dialog.testOption(QAbstractPrintDialog::PrintSelection))
// } else { lst = textToLines(selText());
QStringList lst = contents(); else
lst = contents();
for (int i=0;i<lst.length();i++) { for (int i=0;i<lst.length();i++) {
int columns = 0; int columns = 0;
QString line = lst[i]; QString line = lst[i];

View File

@ -104,7 +104,6 @@ void ProjectGeneralWidget::doSave()
project->options().isCpp = ui->cbDefaultCpp->isChecked(); project->options().isCpp = ui->cbDefaultCpp->isChecked();
project->options().supportXPThemes = ui->cbSupportXPTheme->isChecked(); project->options().supportXPThemes = ui->cbSupportXPTheme->isChecked();
qDebug()<<mIconPath;
if (mIconPath.isEmpty() if (mIconPath.isEmpty()
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0) #if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
|| ui->lbIcon->pixmap(Qt::ReturnByValue).isNull()) { || ui->lbIcon->pixmap(Qt::ReturnByValue).isNull()) {