mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-06-05 21:59:17 +02:00
Issue #99: Icons for dark mode
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
#include "pdfdocumentbuilder.h"
|
||||
#include "pdfdbgheap.h"
|
||||
#include "pdfcertificatemanagerdialog.h"
|
||||
#include "pdfwidgetutils.h"
|
||||
|
||||
#include "pdfviewersettings.h"
|
||||
#include "pdfundoredomanager.h"
|
||||
@@ -292,6 +293,20 @@ void PDFActionManager::initActions(QSize iconSize, bool initializeStampActions)
|
||||
createCreateStampAction(CreateStampSold, pdf::Stamp::Sold);
|
||||
createCreateStampAction(CreateStampTopSecret, pdf::Stamp::TopSecret);
|
||||
}
|
||||
|
||||
m_iconSize = iconSize;
|
||||
}
|
||||
|
||||
void PDFActionManager::styleActions()
|
||||
{
|
||||
if (pdf::PDFWidgetUtils::isDarkTheme())
|
||||
{
|
||||
qreal devicePixelRatio = qGuiApp->devicePixelRatio();
|
||||
|
||||
// Convert icons to dark theme icons
|
||||
pdf::PDFWidgetUtils::convertActionsForDarkTheme(m_actions, m_iconSize, devicePixelRatio);
|
||||
pdf::PDFWidgetUtils::convertActionsForDarkTheme(m_additionalActions, m_iconSize, devicePixelRatio);
|
||||
}
|
||||
}
|
||||
|
||||
bool PDFActionManager::hasActions(const std::initializer_list<Action>& actionTypes) const
|
||||
|
@@ -230,6 +230,7 @@ public:
|
||||
void addAdditionalAction(QAction* action);
|
||||
|
||||
void initActions(QSize iconSize, bool initializeStampActions);
|
||||
void styleActions();
|
||||
|
||||
private:
|
||||
bool hasActions(const std::initializer_list<Action>& actionTypes) const;
|
||||
@@ -238,6 +239,7 @@ private:
|
||||
std::array<QAction*, LastAction> m_actions;
|
||||
std::array<QActionGroup*, LastActionGroup> m_actionGroups;
|
||||
std::vector<QAction*> m_additionalActions;
|
||||
QSize m_iconSize;
|
||||
};
|
||||
|
||||
class PDF4QTVIEWERLIBSHARED_EXPORT PDFProgramController : public QObject, public pdf::IPluginDataExchange
|
||||
|
@@ -301,6 +301,8 @@ PDFViewerMainWindow::PDFViewerMainWindow(QWidget* parent) :
|
||||
{
|
||||
connect(toolManager, &pdf::PDFToolManager::messageDisplayRequest, statusBar(), &QStatusBar::showMessage);
|
||||
}
|
||||
|
||||
m_actionManager->styleActions();
|
||||
}
|
||||
|
||||
PDFViewerMainWindow::~PDFViewerMainWindow()
|
||||
|
@@ -218,6 +218,8 @@ PDFViewerMainWindowLite::PDFViewerMainWindowLite(QWidget* parent) :
|
||||
{
|
||||
connect(toolManager, &pdf::PDFToolManager::messageDisplayRequest, statusBar(), &QStatusBar::showMessage);
|
||||
}
|
||||
|
||||
m_actionManager->styleActions();
|
||||
}
|
||||
|
||||
PDFViewerMainWindowLite::~PDFViewerMainWindowLite()
|
||||
|
Reference in New Issue
Block a user