scale combobox: regenerate pdfs preview with choosen scale

这个提交包含在:
Albert S. 2018-09-02 20:30:52 +02:00
父节点 7a485c55bb
当前提交 caafb114ca
共有 5 个文件被更改,包括 18 次插入5 次删除

查看文件

@ -5,9 +5,11 @@
#include <QDesktopServices>
#include <QUrl>
#include <QClipboard>
#include <QtGlobal>
#include <QSettings>
#include <QDateTime>
#include <QProcess>
#include <QComboBox>
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "clicklabel.h"
@ -43,8 +45,14 @@ void MainWindow::connectSignals()
connect(this, &MainWindow::startPdfPreviewGeneration, pdfWorker, &PdfWorker::generatePreviews);
connect(pdfWorker, &PdfWorker::previewReady, this, &MainWindow::pdfPreviewReceived);
connect(pdfWorker, &PdfWorker::previewsFinished, [&] { this->pdfDirty = false; });
connect(ui->comboScale, qOverload<const QString &>(&QComboBox::currentIndexChanged), this,
&MainWindow::comboScaleChanged);
}
void MainWindow::comboScaleChanged(QString text)
{
makePdfPreview();
}
bool MainWindow::pdfTabActive()
{
return ui->tabWidget->currentIndex() == 1;
@ -155,7 +163,10 @@ void MainWindow::makePdfPreview()
ui->scrollAreaWidgetContents->setLayout(new QHBoxLayout());
ui->pdfProcessBar->setMaximum(this->pdfSearchResults.size());
processedPdfPreviews = 0;
emit startPdfPreviewGeneration(this->pdfSearchResults, 0.75);
QString scaleText = ui->comboScale->currentText();
scaleText.chop(1);
emit startPdfPreviewGeneration(this->pdfSearchResults, scaleText.toInt() / 100.);
}
void MainWindow::handleCancelledSearch()

查看文件

@ -47,6 +47,7 @@ class MainWindow : public QMainWindow
void showSearchResultsContextMenu(const QPoint &point);
void tabChanged();
void pdfPreviewReceived(PdfPreview preview);
void comboScaleChanged(QString text);
};
#endif // MAINWINDOW_H

查看文件

@ -27,7 +27,7 @@
<enum>QTabWidget::South</enum>
</property>
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="resultsTab">
<attribute name="title">
@ -99,9 +99,9 @@
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox">
<widget class="QComboBox" name="comboScale">
<property name="currentText">
<string>25%</string>
<string>75%</string>
</property>
<item>
<property name="text">

查看文件

@ -7,7 +7,7 @@
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++14
TARGET = qss
TEMPLATE = app

查看文件

@ -87,6 +87,7 @@ QString SearchWorker::createSql(const SearchWorker::Command &cmd)
{
QString key = cmd.key;
QString value = cmd.value;
value = value.replace("'", "\\'");
if(key == "AND" || key == "OR" || key == "(" || key == ")")
{
return " " + key + " ";