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