mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-06-05 21:59:17 +02:00
Styling widgets
This commit is contained in:
@ -53,6 +53,7 @@ PDFAboutDialog::PDFAboutDialog(QWidget* parent) :
|
||||
}
|
||||
|
||||
pdf::PDFWidgetUtils::scaleWidget(this, QSize(750, 600));
|
||||
pdf::PDFWidgetUtils::style(this);
|
||||
}
|
||||
|
||||
PDFAboutDialog::~PDFAboutDialog()
|
||||
|
@ -38,6 +38,7 @@ AssembleOutputSettingsDialog::AssembleOutputSettingsDialog(QString directory, QW
|
||||
ui->outlineModeComboBox->setCurrentIndex(ui->outlineModeComboBox->findData(int(pdf::PDFDocumentManipulator::OutlineMode::DocumentParts)));
|
||||
|
||||
pdf::PDFWidgetUtils::scaleWidget(this, QSize(450, 150));
|
||||
pdf::PDFWidgetUtils::style(this);
|
||||
}
|
||||
|
||||
AssembleOutputSettingsDialog::~AssembleOutputSettingsDialog()
|
||||
|
@ -547,7 +547,7 @@ void MainWindow::performOperation(Operation operation)
|
||||
break;
|
||||
|
||||
case Operation::GetSource:
|
||||
QDesktopServices::openUrl(QUrl("https://github.com/JakubMelka/PdfForQt"));
|
||||
QDesktopServices::openUrl(QUrl("https://github.com/JakubMelka/PDF4QT"));
|
||||
break;
|
||||
|
||||
case Operation::InsertEmptyPage:
|
||||
|
@ -46,6 +46,7 @@ SelectBookmarksToRegroupDialog::SelectBookmarksToRegroupDialog(const pdf::PDFDoc
|
||||
|
||||
QSize size = pdf::PDFWidgetUtils::scaleDPI(this, QSize(400, 600));
|
||||
setMinimumSize(size);
|
||||
pdf::PDFWidgetUtils::style(this);
|
||||
}
|
||||
|
||||
SelectBookmarksToRegroupDialog::~SelectBookmarksToRegroupDialog()
|
||||
|
@ -998,6 +998,7 @@ PDFEditObjectDialog::PDFEditObjectDialog(EditObjectType type, QWidget* parent) :
|
||||
connect(m_buttonBox, &QDialogButtonBox::rejected, this, &PDFEditObjectDialog::reject);
|
||||
|
||||
setMinimumSize(PDFWidgetUtils::scaleDPI(this, QSize(480, 320)));
|
||||
pdf::PDFWidgetUtils::style(this);
|
||||
}
|
||||
|
||||
void PDFEditObjectDialog::setObject(PDFObject object)
|
||||
|
@ -19,6 +19,8 @@
|
||||
#include "pdfdrawwidget.h"
|
||||
#include "ui_pdfrenderingerrorswidget.h"
|
||||
|
||||
#include "pdfwidgetutils.h"
|
||||
|
||||
namespace pdf
|
||||
{
|
||||
|
||||
@ -96,6 +98,8 @@ PDFRenderingErrorsWidget::PDFRenderingErrorsWidget(QWidget* parent, PDFWidget* p
|
||||
{
|
||||
ui->renderErrorsTreeWidget->scrollToItem(scrollToItem, QAbstractItemView::EnsureVisible);
|
||||
}
|
||||
|
||||
pdf::PDFWidgetUtils::style(this);
|
||||
}
|
||||
|
||||
PDFRenderingErrorsWidget::~PDFRenderingErrorsWidget()
|
||||
|
@ -64,6 +64,7 @@ PDFSelectPagesDialog::PDFSelectPagesDialog(QString windowTitle,
|
||||
|
||||
setMinimumWidth(pdf::PDFWidgetUtils::scaleDPI_x(this, 400));
|
||||
updateUi();
|
||||
pdf::PDFWidgetUtils::style(this);
|
||||
}
|
||||
|
||||
PDFSelectPagesDialog::~PDFSelectPagesDialog()
|
||||
|
@ -17,6 +17,10 @@
|
||||
|
||||
#include "pdfwidgetutils.h"
|
||||
|
||||
#include <QDialog>
|
||||
#include <QLayout>
|
||||
#include <QGroupBox>
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
int qt_default_dpi_x() { return 72; }
|
||||
int qt_default_dpi_y() { return 72; }
|
||||
@ -90,4 +94,32 @@ QSize PDFWidgetUtils::scaleDPI(const QPaintDevice* widget, QSize unscaledSize)
|
||||
return QSize(width, height);
|
||||
}
|
||||
|
||||
void PDFWidgetUtils::style(QWidget* widget)
|
||||
{
|
||||
const int dialogMarginX = scaleDPI_x(widget, 12);
|
||||
const int dialogMarginY = scaleDPI_y(widget, 12);
|
||||
const int dialogSpacing = scaleDPI_y(widget, 12);
|
||||
|
||||
const int groupBoxMarginX = scaleDPI_x(widget, 20);
|
||||
const int groupBoxMarginY = scaleDPI_y(widget, 20);
|
||||
const int groupBoxSpacing = scaleDPI_y(widget, 12);
|
||||
|
||||
QList<QWidget*> childWidgets = widget->findChildren<QWidget*>();
|
||||
childWidgets.append(widget);
|
||||
|
||||
for (QWidget* childWidget : childWidgets)
|
||||
{
|
||||
if (qobject_cast<QGroupBox*>(childWidget))
|
||||
{
|
||||
childWidget->layout()->setContentsMargins(groupBoxMarginX, groupBoxMarginY, groupBoxMarginX, groupBoxMarginY);
|
||||
childWidget->layout()->setSpacing(groupBoxSpacing);
|
||||
}
|
||||
else if (qobject_cast<QDialog*>(childWidget))
|
||||
{
|
||||
childWidget->layout()->setContentsMargins(dialogMarginX, dialogMarginY, dialogMarginX, dialogMarginY);
|
||||
childWidget->layout()->setSpacing(dialogSpacing);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace pdf
|
||||
|
@ -54,6 +54,9 @@ public:
|
||||
/// \param device Paint device to obtain logical DPI for scaling
|
||||
/// \param unscaledSize Unscaled size
|
||||
static QSize scaleDPI(const QPaintDevice* widget, QSize unscaledSize);
|
||||
|
||||
/// Apply style to the widget
|
||||
static void style(QWidget* widget);
|
||||
};
|
||||
|
||||
} // namespace pdf
|
||||
|
@ -53,6 +53,7 @@ PDFAboutDialog::PDFAboutDialog(QWidget* parent) :
|
||||
}
|
||||
|
||||
pdf::PDFWidgetUtils::scaleWidget(this, QSize(750, 600));
|
||||
pdf::PDFWidgetUtils::style(this);
|
||||
}
|
||||
|
||||
PDFAboutDialog::~PDFAboutDialog()
|
||||
|
@ -55,6 +55,7 @@ PDFDocumentPropertiesDialog::PDFDocumentPropertiesDialog(const pdf::PDFDocument*
|
||||
}
|
||||
|
||||
pdf::PDFWidgetUtils::scaleWidget(this, QSize(750, 600));
|
||||
pdf::PDFWidgetUtils::style(this);
|
||||
}
|
||||
|
||||
PDFDocumentPropertiesDialog::~PDFDocumentPropertiesDialog()
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "ui_pdfencryptionsettingsdialog.h"
|
||||
|
||||
#include "pdfutils.h"
|
||||
#include "pdfwidgetutils.h"
|
||||
#include "pdfsecurityhandler.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
@ -73,6 +74,8 @@ PDFEncryptionSettingsDialog::PDFEncryptionSettingsDialog(QByteArray documentId,
|
||||
|
||||
updateUi();
|
||||
updatePasswordScore();
|
||||
|
||||
pdf::PDFWidgetUtils::style(this);
|
||||
}
|
||||
|
||||
PDFEncryptionSettingsDialog::~PDFEncryptionSettingsDialog()
|
||||
|
@ -65,6 +65,7 @@ PDFOptimizeDocumentDialog::PDFOptimizeDocumentDialog(const pdf::PDFDocument* doc
|
||||
|
||||
pdf::PDFWidgetUtils::scaleWidget(this, QSize(640, 380));
|
||||
updateUi();
|
||||
pdf::PDFWidgetUtils::style(this);
|
||||
}
|
||||
|
||||
PDFOptimizeDocumentDialog::~PDFOptimizeDocumentDialog()
|
||||
|
@ -2149,7 +2149,7 @@ void PDFProgramController::onActionDeveloperCreateInstaller()
|
||||
|
||||
void PDFProgramController::onActionGetSource()
|
||||
{
|
||||
QDesktopServices::openUrl(QUrl("https://github.com/JakubMelka/PdfForQt"));
|
||||
QDesktopServices::openUrl(QUrl("https://github.com/JakubMelka/PDF4QT"));
|
||||
}
|
||||
|
||||
void PDFProgramController::onPageRenderingErrorsChanged(pdf::PDFInteger pageIndex, int errorsCount)
|
||||
|
@ -82,6 +82,7 @@ PDFRenderToImagesDialog::PDFRenderToImagesDialog(const pdf::PDFDocument* documen
|
||||
loadImageExportSettings();
|
||||
|
||||
pdf::PDFWidgetUtils::scaleWidget(this, QSize(1000, 600));
|
||||
pdf::PDFWidgetUtils::style(this);
|
||||
}
|
||||
|
||||
PDFRenderToImagesDialog::~PDFRenderToImagesDialog()
|
||||
|
@ -193,6 +193,7 @@ PDFViewerSettingsDialog::PDFViewerSettingsDialog(const PDFViewerSettings::Settin
|
||||
connect(ui->pluginsTableWidget, &QTableWidget::itemSelectionChanged, this, &PDFViewerSettingsDialog::updatePluginInformation);
|
||||
|
||||
setMinimumSize(pdf::PDFWidgetUtils::scaleDPI(this, QSize(1000, 700)));
|
||||
pdf::PDFWidgetUtils::style(this);
|
||||
|
||||
ui->optionsPagesWidget->setCurrentRow(0);
|
||||
adjustSize();
|
||||
|
@ -38,6 +38,7 @@ SettingsDialog::SettingsDialog(QWidget* parent, DimensionUnit& lengthUnit, Dimen
|
||||
initComboBox(m_angleUnits, m_angleUnit, ui->anglesComboBox);
|
||||
|
||||
setMinimumSize(pdf::PDFWidgetUtils::scaleDPI(this, QSize(320, 160)));
|
||||
pdf::PDFWidgetUtils::style(this);
|
||||
}
|
||||
|
||||
SettingsDialog::~SettingsDialog()
|
||||
|
@ -108,6 +108,7 @@ ObjectInspectorDialog::ObjectInspectorDialog(const pdf::PDFCMS* cms, const pdf::
|
||||
|
||||
ui->objectTreeView->setMinimumWidth(pdf::PDFWidgetUtils::scaleDPI_x(this, 200));
|
||||
setMinimumSize(pdf::PDFWidgetUtils::scaleDPI(this, QSize(800, 600)));
|
||||
pdf::PDFWidgetUtils::style(this);
|
||||
}
|
||||
|
||||
ObjectInspectorDialog::~ObjectInspectorDialog()
|
||||
|
@ -18,6 +18,8 @@
|
||||
#include "objectstatisticsdialog.h"
|
||||
#include "ui_objectstatisticsdialog.h"
|
||||
|
||||
#include "pdfwidgetutils.h"
|
||||
|
||||
namespace pdfplugin
|
||||
{
|
||||
|
||||
@ -38,6 +40,7 @@ ObjectStatisticsDialog::ObjectStatisticsDialog(const pdf::PDFDocument* document,
|
||||
m_statistics = classifier.calculateStatistics(document);
|
||||
|
||||
updateStatisticsWidget();
|
||||
pdf::PDFWidgetUtils::style(this);
|
||||
}
|
||||
|
||||
ObjectStatisticsDialog::~ObjectStatisticsDialog()
|
||||
|
@ -46,6 +46,7 @@ InkCoverageDialog::InkCoverageDialog(const pdf::PDFDocument* document, pdf::PDFW
|
||||
|
||||
setMinimumSize(pdf::PDFWidgetUtils::scaleDPI(this, QSize(800, 600)));
|
||||
updateInkCoverage();
|
||||
pdf::PDFWidgetUtils::style(this);
|
||||
}
|
||||
|
||||
InkCoverageDialog::~InkCoverageDialog()
|
||||
|
@ -82,6 +82,7 @@ OutputPreviewDialog::OutputPreviewDialog(const pdf::PDFDocument* document, pdf::
|
||||
onDisplayModeChanged();
|
||||
onInkCoverageLimitChanged(ui->inkCoverageLimitEdit->value());
|
||||
onRichBlackLimtiChanged(ui->richBlackLimitEdit->value());
|
||||
pdf::PDFWidgetUtils::style(this);
|
||||
}
|
||||
|
||||
OutputPreviewDialog::~OutputPreviewDialog()
|
||||
|
@ -38,6 +38,7 @@ CreateRedactedDocumentDialog::CreateRedactedDocumentDialog(QString fileName, QCo
|
||||
|
||||
updateUi();
|
||||
setMinimumWidth(pdf::PDFWidgetUtils::scaleDPI_x(this, 300));
|
||||
pdf::PDFWidgetUtils::style(this);
|
||||
}
|
||||
|
||||
CreateRedactedDocumentDialog::~CreateRedactedDocumentDialog()
|
||||
|
@ -43,6 +43,7 @@ SettingsDialog::SettingsDialog(QWidget* parent, const pdf::PDFCMSSettings& setti
|
||||
ui->outOfGamutColorEdit->setText(m_settings.outOfGamutColor.name(QColor::HexRgb));
|
||||
|
||||
setMinimumSize(pdf::PDFWidgetUtils::scaleDPI(this, QSize(320, 160)));
|
||||
pdf::PDFWidgetUtils::style(this);
|
||||
}
|
||||
|
||||
SettingsDialog::~SettingsDialog()
|
||||
|
Reference in New Issue
Block a user