scale combobox: regenerate pdfs preview with choosen scale

This commit is contained in:
Albert S. 2018-09-02 20:30:52 +02:00
orang tua 5d8de075be
melakukan cd3a160aa6
5 mengubah file dengan 17 tambahan dan 5 penghapusan

Melihat File

@ -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"
@ -44,8 +46,13 @@ 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 +162,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.);
}

Melihat File

@ -45,6 +45,7 @@ private slots:
void showSearchResultsContextMenu(const QPoint &point);
void tabChanged();
void pdfPreviewReceived(PdfPreview preview);
void comboScaleChanged(QString text);
};
#endif // MAINWINDOW_H

Melihat File

@ -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">

Melihat File

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

Melihat File

@ -90,6 +90,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 + " ";