fix examples for Core API 2.0
This commit is contained in:
parent
af797125f8
commit
d680ad87b1
|
@ -7,7 +7,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>518</width>
|
<width>518</width>
|
||||||
<height>368</height>
|
<height>383</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -20,9 +20,16 @@
|
||||||
<widget class="QWidget" name="centralwidget">
|
<widget class="QWidget" name="centralwidget">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pushButton_3">
|
<widget class="QPushButton" name="uninstallBtn">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>PushButton</string>
|
<string>Uninstall Frameless Window</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="installBtn">
|
||||||
|
<property name="text">
|
||||||
|
<string>Install Frameless Window</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -122,6 +129,15 @@
|
||||||
<height>25</height>
|
<height>25</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="mouseTracking">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::NoFocus</enum>
|
||||||
|
</property>
|
||||||
|
<property name="nativeMenuBar">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
<widget class="QMenu" name="menuItem_1">
|
<widget class="QMenu" name="menuItem_1">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Menu 1</string>
|
<string>Menu 1</string>
|
||||||
|
|
|
@ -38,14 +38,14 @@ MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags flags) : QMainWindow(par
|
||||||
appMainWindow = new Ui::MainWindow;
|
appMainWindow = new Ui::MainWindow;
|
||||||
appMainWindow->setupUi(this);
|
appMainWindow->setupUi(this);
|
||||||
|
|
||||||
const auto widget = new QWidget(this);
|
m_titleBar = new QWidget(this);
|
||||||
titleBarWidget = new Ui::TitleBar;
|
titleBarWidget = new Ui::TitleBar;
|
||||||
titleBarWidget->setupUi(widget);
|
titleBarWidget->setupUi(m_titleBar);
|
||||||
|
|
||||||
QMenuBar *mb = menuBar();
|
QMenuBar *mb = menuBar();
|
||||||
titleBarWidget->horizontalLayout->insertWidget(1, mb);
|
titleBarWidget->horizontalLayout->insertWidget(1, mb);
|
||||||
|
|
||||||
setMenuWidget(widget);
|
setMenuWidget(m_titleBar);
|
||||||
|
|
||||||
connect(this, &MainWindow::windowIconChanged, titleBarWidget->iconButton, &QPushButton::setIcon);
|
connect(this, &MainWindow::windowIconChanged, titleBarWidget->iconButton, &QPushButton::setIcon);
|
||||||
connect(this, &MainWindow::windowTitleChanged, titleBarWidget->titleLabel, &QLabel::setText);
|
connect(this, &MainWindow::windowTitleChanged, titleBarWidget->titleLabel, &QLabel::setText);
|
||||||
|
@ -63,6 +63,13 @@ MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags flags) : QMainWindow(par
|
||||||
titleBarWidget->maximizeButton->setToolTip(isMaximized() ? tr("Restore") : tr("Maximize"));
|
titleBarWidget->maximizeButton->setToolTip(isMaximized() ? tr("Restore") : tr("Maximize"));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
connect(appMainWindow->uninstallBtn, &QPushButton::clicked, [this]() {
|
||||||
|
this->m_helper->uninstall();
|
||||||
|
});
|
||||||
|
connect(appMainWindow->installBtn, &QPushButton::clicked, [this]() {
|
||||||
|
this->m_helper->install();
|
||||||
|
});
|
||||||
|
|
||||||
setWindowTitle(tr("Hello, World!"));
|
setWindowTitle(tr("Hello, World!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,12 +92,15 @@ void MainWindow::showEvent(QShowEvent *event)
|
||||||
if (!inited) {
|
if (!inited) {
|
||||||
const auto win = windowHandle();
|
const auto win = windowHandle();
|
||||||
if (win) {
|
if (win) {
|
||||||
FramelessWindowsManager::addWindow(win);
|
m_helper = new FramelessHelper(win);
|
||||||
FramelessWindowsManager::setHitTestVisibleInChrome(win, titleBarWidget->iconButton, true);
|
m_helper->setHitTestVisible(titleBarWidget->iconButton);
|
||||||
FramelessWindowsManager::setHitTestVisibleInChrome(win, titleBarWidget->minimizeButton, true);
|
m_helper->setHitTestVisible(titleBarWidget->minimizeButton);
|
||||||
FramelessWindowsManager::setHitTestVisibleInChrome(win, titleBarWidget->maximizeButton, true);
|
m_helper->setHitTestVisible(titleBarWidget->maximizeButton);
|
||||||
FramelessWindowsManager::setHitTestVisibleInChrome(win, titleBarWidget->closeButton, true);
|
m_helper->setHitTestVisible(titleBarWidget->closeButton);
|
||||||
FramelessWindowsManager::setHitTestVisibleInChrome(win, appMainWindow->menubar, true);
|
m_helper->setHitTestVisible(appMainWindow->menubar);
|
||||||
|
m_helper->setTitleBarHeight(m_titleBar->height());
|
||||||
|
m_helper->setResizeBorderThickness(4);
|
||||||
|
m_helper->install();
|
||||||
setContentsMargins(1, 1, 1, 1);
|
setContentsMargins(1, 1, 1, 1);
|
||||||
inited = true;
|
inited = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include <QtWidgets/qmainwindow.h>
|
#include <QtWidgets/qmainwindow.h>
|
||||||
#include "ui_MainWindow.h"
|
#include "ui_MainWindow.h"
|
||||||
#include "ui_TitleBar.h"
|
#include "ui_TitleBar.h"
|
||||||
|
#include "../../framelesshelper.h"
|
||||||
|
|
||||||
class MainWindow : public QMainWindow
|
class MainWindow : public QMainWindow
|
||||||
{
|
{
|
||||||
|
@ -45,6 +46,8 @@ Q_SIGNALS:
|
||||||
void windowStateChanged();
|
void windowStateChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
__flh_ns::FramelessHelper *m_helper = nullptr;
|
||||||
|
QWidget *m_titleBar = nullptr;
|
||||||
Ui::TitleBar *titleBarWidget = nullptr;
|
Ui::TitleBar *titleBarWidget = nullptr;
|
||||||
Ui::MainWindow *appMainWindow = nullptr;
|
Ui::MainWindow *appMainWindow = nullptr;
|
||||||
};
|
};
|
||||||
|
|
|
@ -23,14 +23,14 @@ FLWindow::~FLWindow()
|
||||||
|
|
||||||
void FLWindow::initFramelessWindow()
|
void FLWindow::initFramelessWindow()
|
||||||
{
|
{
|
||||||
m_flsHelper = new FramelessHelper(windowHandle());
|
m_helper = new FramelessHelper(windowHandle());
|
||||||
m_flsHelper->setResizeBorderThickness(4);
|
m_helper->setResizeBorderThickness(4);
|
||||||
m_flsHelper->setTitleBarHeight(m_titleBarWidget->height());
|
m_helper->setTitleBarHeight(m_titleBarWidget->height());
|
||||||
m_flsHelper->setResizable(true);
|
m_helper->setResizable(true);
|
||||||
m_flsHelper->setHitTestVisible(m_minimizeButton);
|
m_helper->setHitTestVisible(m_minimizeButton);
|
||||||
m_flsHelper->setHitTestVisible(m_maximizeButton);
|
m_helper->setHitTestVisible(m_maximizeButton);
|
||||||
m_flsHelper->setHitTestVisible(m_closeButton);
|
m_helper->setHitTestVisible(m_closeButton);
|
||||||
m_flsHelper->install();
|
m_helper->install();
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
m_minimizeButton->hide();
|
m_minimizeButton->hide();
|
||||||
|
@ -54,10 +54,10 @@ void FLWindow::showEvent(QShowEvent *event)
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
bool FLWindow::nativeEvent(const QByteArray &eventType, void *message, long *result)
|
bool FLWindow::nativeEvent(const QByteArray &eventType, void *message, long *result)
|
||||||
{
|
{
|
||||||
if (!m_flsHelper)
|
if (!m_helper)
|
||||||
return QWidget::nativeEvent(eventType, message, result);
|
return QWidget::nativeEvent(eventType, message, result);
|
||||||
|
|
||||||
if (m_flsHelper->handleNativeEvent(this->windowHandle(), eventType, message, result))
|
if (m_helper->handleNativeEvent(this->windowHandle(), eventType, message, result))
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
return QWidget::nativeEvent(eventType, message, result);
|
return QWidget::nativeEvent(eventType, message, result);
|
||||||
|
|
|
@ -23,7 +23,7 @@ private:
|
||||||
void setupUi();
|
void setupUi();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
__flh_ns::FramelessHelper *m_flsHelper = nullptr;
|
__flh_ns::FramelessHelper *m_helper = nullptr;
|
||||||
QWidget *m_titleBarWidget = nullptr;
|
QWidget *m_titleBarWidget = nullptr;
|
||||||
QPushButton *m_minimizeButton = nullptr;
|
QPushButton *m_minimizeButton = nullptr;
|
||||||
QPushButton *m_maximizeButton = nullptr;
|
QPushButton *m_maximizeButton = nullptr;
|
||||||
|
|
|
@ -99,10 +99,15 @@ void Widget::showEvent(QShowEvent *event)
|
||||||
qFatal("Failed to retrieve the window handle.");
|
qFatal("Failed to retrieve the window handle.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FramelessWindowsManager::addWindow(win);
|
|
||||||
FramelessWindowsManager::setHitTestVisibleInChrome(win, m_minimizeButton, true);
|
m_helper = new FramelessHelper(win);
|
||||||
FramelessWindowsManager::setHitTestVisibleInChrome(win, m_maximizeButton, true);
|
m_helper->setHitTestVisible(m_minimizeButton);
|
||||||
FramelessWindowsManager::setHitTestVisibleInChrome(win, m_closeButton, true);
|
m_helper->setHitTestVisible(m_maximizeButton);
|
||||||
|
m_helper->setHitTestVisible(m_closeButton);
|
||||||
|
m_helper->setResizeBorderThickness(4);
|
||||||
|
m_helper->setTitleBarHeight(m_titleBarWidget->height());
|
||||||
|
m_helper->install();
|
||||||
|
|
||||||
const int margin = Utilities::getWindowVisibleFrameBorderThickness(winId());
|
const int margin = Utilities::getWindowVisibleFrameBorderThickness(winId());
|
||||||
setContentsMargins(margin, margin, margin, margin);
|
setContentsMargins(margin, margin, margin, margin);
|
||||||
}
|
}
|
||||||
|
@ -124,7 +129,6 @@ void Widget::changeEvent(QEvent *event)
|
||||||
const int margin = ((isMaximized() || isFullScreen()) ? 0 : Utilities::getWindowVisibleFrameBorderThickness(winId()));
|
const int margin = ((isMaximized() || isFullScreen()) ? 0 : Utilities::getWindowVisibleFrameBorderThickness(winId()));
|
||||||
setContentsMargins(margin, margin, margin, margin);
|
setContentsMargins(margin, margin, margin, margin);
|
||||||
updateSystemButtonIcons();
|
updateSystemButtonIcons();
|
||||||
updateTitleBarSize();
|
|
||||||
shouldUpdate = true;
|
shouldUpdate = true;
|
||||||
} else if (event->type() == QEvent::ActivationChange) {
|
} else if (event->type() == QEvent::ActivationChange) {
|
||||||
shouldUpdate = true;
|
shouldUpdate = true;
|
||||||
|
@ -156,7 +160,7 @@ void Widget::paintEvent(QPaintEvent *event)
|
||||||
};
|
};
|
||||||
const ColorizationArea area = Utilities::getColorizationArea();
|
const ColorizationArea area = Utilities::getColorizationArea();
|
||||||
const bool colorizedBorder = ((area == ColorizationArea::TitleBar_WindowBorder)
|
const bool colorizedBorder = ((area == ColorizationArea::TitleBar_WindowBorder)
|
||||||
|| (area == ColorizationArea::All));
|
|| (area == ColorizationArea::AllArea));
|
||||||
const QColor borderColor = (isActiveWindow() ? (colorizedBorder ? Utilities::getColorizationColor() : Qt::black) : Qt::darkGray);
|
const QColor borderColor = (isActiveWindow() ? (colorizedBorder ? Utilities::getColorizationColor() : Qt::black) : Qt::darkGray);
|
||||||
const auto borderThickness = static_cast<qreal>(Utilities::getWindowVisibleFrameBorderThickness(winId()));
|
const auto borderThickness = static_cast<qreal>(Utilities::getWindowVisibleFrameBorderThickness(winId()));
|
||||||
painter.setPen({borderColor, qMax(borderThickness, devicePixelRatioF())});
|
painter.setPen({borderColor, qMax(borderThickness, devicePixelRatioF())});
|
||||||
|
@ -170,9 +174,13 @@ void Widget::setupUi()
|
||||||
setObjectName(QStringLiteral("MainWidget"));
|
setObjectName(QStringLiteral("MainWidget"));
|
||||||
setWindowTitle(tr("Hello, World!"));
|
setWindowTitle(tr("Hello, World!"));
|
||||||
resize(800, 600);
|
resize(800, 600);
|
||||||
|
|
||||||
m_titleBarWidget = new QWidget(this);
|
m_titleBarWidget = new QWidget(this);
|
||||||
m_titleBarWidget->setObjectName(QStringLiteral("TitleBarWidget"));
|
m_titleBarWidget->setObjectName(QStringLiteral("TitleBarWidget"));
|
||||||
m_titleBarWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
m_titleBarWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||||
|
m_titleBarWidget->setFixedHeight(28);
|
||||||
|
const QSize systemButtonSize = {45, 30};
|
||||||
|
|
||||||
m_windowTitleLabel = new QLabel(m_titleBarWidget);
|
m_windowTitleLabel = new QLabel(m_titleBarWidget);
|
||||||
m_windowTitleLabel->setObjectName(QStringLiteral("WindowTitleLabel"));
|
m_windowTitleLabel->setObjectName(QStringLiteral("WindowTitleLabel"));
|
||||||
m_windowTitleLabel->setFrameShape(QFrame::NoFrame);
|
m_windowTitleLabel->setFrameShape(QFrame::NoFrame);
|
||||||
|
@ -181,11 +189,17 @@ void Widget::setupUi()
|
||||||
m_windowTitleLabel->setFont(titleFont);
|
m_windowTitleLabel->setFont(titleFont);
|
||||||
m_windowTitleLabel->setText(windowTitle());
|
m_windowTitleLabel->setText(windowTitle());
|
||||||
connect(this, &Widget::windowTitleChanged, m_windowTitleLabel, &QLabel::setText);
|
connect(this, &Widget::windowTitleChanged, m_windowTitleLabel, &QLabel::setText);
|
||||||
|
|
||||||
m_minimizeButton = new QPushButton(m_titleBarWidget);
|
m_minimizeButton = new QPushButton(m_titleBarWidget);
|
||||||
m_minimizeButton->setObjectName(QStringLiteral("MinimizeButton"));
|
m_minimizeButton->setObjectName(QStringLiteral("MinimizeButton"));
|
||||||
|
m_minimizeButton->setFixedSize(systemButtonSize);
|
||||||
|
m_minimizeButton->setIconSize(systemButtonSize);
|
||||||
connect(m_minimizeButton, &QPushButton::clicked, this, &Widget::showMinimized);
|
connect(m_minimizeButton, &QPushButton::clicked, this, &Widget::showMinimized);
|
||||||
|
|
||||||
m_maximizeButton = new QPushButton(m_titleBarWidget);
|
m_maximizeButton = new QPushButton(m_titleBarWidget);
|
||||||
m_maximizeButton->setObjectName(QStringLiteral("MaximizeButton"));
|
m_maximizeButton->setObjectName(QStringLiteral("MaximizeButton"));
|
||||||
|
m_maximizeButton->setFixedSize(systemButtonSize);
|
||||||
|
m_maximizeButton->setIconSize(systemButtonSize);
|
||||||
connect(m_maximizeButton, &QPushButton::clicked, this, [this](){
|
connect(m_maximizeButton, &QPushButton::clicked, this, [this](){
|
||||||
if (isMaximized() || isFullScreen()) {
|
if (isMaximized() || isFullScreen()) {
|
||||||
showNormal();
|
showNormal();
|
||||||
|
@ -194,11 +208,15 @@ void Widget::setupUi()
|
||||||
}
|
}
|
||||||
updateSystemButtonIcons();
|
updateSystemButtonIcons();
|
||||||
});
|
});
|
||||||
|
|
||||||
m_closeButton = new QPushButton(m_titleBarWidget);
|
m_closeButton = new QPushButton(m_titleBarWidget);
|
||||||
m_closeButton->setObjectName(QStringLiteral("CloseButton"));
|
m_closeButton->setObjectName(QStringLiteral("CloseButton"));
|
||||||
|
m_closeButton->setFixedSize(systemButtonSize);
|
||||||
|
m_closeButton->setIconSize(systemButtonSize);
|
||||||
connect(m_closeButton, &QPushButton::clicked, this, &Widget::close);
|
connect(m_closeButton, &QPushButton::clicked, this, &Widget::close);
|
||||||
|
|
||||||
updateSystemButtonIcons();
|
updateSystemButtonIcons();
|
||||||
updateTitleBarSize();
|
|
||||||
const auto titleBarLayout = new QHBoxLayout(m_titleBarWidget);
|
const auto titleBarLayout = new QHBoxLayout(m_titleBarWidget);
|
||||||
titleBarLayout->setContentsMargins(0, 0, 0, 0);
|
titleBarLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
titleBarLayout->setSpacing(0);
|
titleBarLayout->setSpacing(0);
|
||||||
|
@ -209,6 +227,7 @@ void Widget::setupUi()
|
||||||
titleBarLayout->addWidget(m_maximizeButton);
|
titleBarLayout->addWidget(m_maximizeButton);
|
||||||
titleBarLayout->addWidget(m_closeButton);
|
titleBarLayout->addWidget(m_closeButton);
|
||||||
m_titleBarWidget->setLayout(titleBarLayout);
|
m_titleBarWidget->setLayout(titleBarLayout);
|
||||||
|
|
||||||
m_clockLabel = new QLabel(this);
|
m_clockLabel = new QLabel(this);
|
||||||
m_clockLabel->setObjectName(QStringLiteral("ClockLabel"));
|
m_clockLabel->setObjectName(QStringLiteral("ClockLabel"));
|
||||||
m_clockLabel->setFrameShape(QFrame::NoFrame);
|
m_clockLabel->setFrameShape(QFrame::NoFrame);
|
||||||
|
@ -216,12 +235,14 @@ void Widget::setupUi()
|
||||||
clockFont.setBold(true);
|
clockFont.setBold(true);
|
||||||
clockFont.setPointSize(70);
|
clockFont.setPointSize(70);
|
||||||
m_clockLabel->setFont(clockFont);
|
m_clockLabel->setFont(clockFont);
|
||||||
|
|
||||||
const auto contentLayout = new QHBoxLayout;
|
const auto contentLayout = new QHBoxLayout;
|
||||||
contentLayout->setContentsMargins(0, 0, 0, 0);
|
contentLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
contentLayout->setSpacing(0);
|
contentLayout->setSpacing(0);
|
||||||
contentLayout->addStretch();
|
contentLayout->addStretch();
|
||||||
contentLayout->addWidget(m_clockLabel);
|
contentLayout->addWidget(m_clockLabel);
|
||||||
contentLayout->addStretch();
|
contentLayout->addStretch();
|
||||||
|
|
||||||
const auto mainLayout = new QVBoxLayout(this);
|
const auto mainLayout = new QVBoxLayout(this);
|
||||||
mainLayout->setContentsMargins(0, 0, 0, 0);
|
mainLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
mainLayout->setSpacing(0);
|
mainLayout->setSpacing(0);
|
||||||
|
@ -239,7 +260,7 @@ void Widget::updateStyleSheet()
|
||||||
const bool dark = Utilities::shouldAppsUseDarkMode();
|
const bool dark = Utilities::shouldAppsUseDarkMode();
|
||||||
const ColorizationArea area = Utilities::getColorizationArea();
|
const ColorizationArea area = Utilities::getColorizationArea();
|
||||||
const bool colorizedTitleBar = ((area == ColorizationArea::TitleBar_WindowBorder)
|
const bool colorizedTitleBar = ((area == ColorizationArea::TitleBar_WindowBorder)
|
||||||
|| (area == ColorizationArea::All));
|
|| (area == ColorizationArea::AllArea));
|
||||||
const QColor colorizationColor = Utilities::getColorizationColor();
|
const QColor colorizationColor = Utilities::getColorizationColor();
|
||||||
const QColor mainWidgetBackgroundColor = (dark ? systemDarkColor : systemLightColor);
|
const QColor mainWidgetBackgroundColor = (dark ? systemDarkColor : systemLightColor);
|
||||||
const QColor titleBarWidgetBackgroundColor = [active, colorizedTitleBar, &colorizationColor, dark]{
|
const QColor titleBarWidgetBackgroundColor = [active, colorizedTitleBar, &colorizationColor, dark]{
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QtWidgets/qwidget.h>
|
#include <QtWidgets/qwidget.h>
|
||||||
|
#include "../../framelesshelper.h"
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
QT_FORWARD_DECLARE_CLASS(QLabel)
|
QT_FORWARD_DECLARE_CLASS(QLabel)
|
||||||
|
@ -57,6 +58,7 @@ private:
|
||||||
void updateSystemButtonIcons();
|
void updateSystemButtonIcons();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
__flh_ns::FramelessHelper *m_helper = nullptr;
|
||||||
QWidget *m_titleBarWidget = nullptr;
|
QWidget *m_titleBarWidget = nullptr;
|
||||||
QLabel *m_windowTitleLabel = nullptr;
|
QLabel *m_windowTitleLabel = nullptr;
|
||||||
QPushButton *m_minimizeButton = nullptr;
|
QPushButton *m_minimizeButton = nullptr;
|
||||||
|
|
|
@ -113,10 +113,10 @@ Q_ENUM_NS(SystemMetric)
|
||||||
|
|
||||||
enum class ColorizationArea : int
|
enum class ColorizationArea : int
|
||||||
{
|
{
|
||||||
None = 0,
|
NoArea = 0, // ‘None’ has been defined as a macro in X11 headers.
|
||||||
StartMenu_TaskBar_ActionCenter,
|
StartMenu_TaskBar_ActionCenter,
|
||||||
TitleBar_WindowBorder,
|
TitleBar_WindowBorder,
|
||||||
All
|
AllArea
|
||||||
};
|
};
|
||||||
Q_ENUM_NS(ColorizationArea)
|
Q_ENUM_NS(ColorizationArea)
|
||||||
|
|
||||||
|
|
|
@ -109,8 +109,7 @@ bool Utilities::shouldAppsUseDarkMode()
|
||||||
ColorizationArea Utilities::getColorizationArea()
|
ColorizationArea Utilities::getColorizationArea()
|
||||||
{
|
{
|
||||||
// ### TO BE IMPLEMENTED
|
// ### TO BE IMPLEMENTED
|
||||||
//return ColorizationArea::None; // ‘None’ has been defined as a macro in X11 headers.
|
return ColorizationArea::NoArea;
|
||||||
return ColorizationArea::All;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Utilities::isThemeChanged(const void *data)
|
bool Utilities::isThemeChanged(const void *data)
|
||||||
|
|
|
@ -358,7 +358,7 @@ bool Utilities::shouldAppsUseDarkMode()
|
||||||
ColorizationArea Utilities::getColorizationArea()
|
ColorizationArea Utilities::getColorizationArea()
|
||||||
{
|
{
|
||||||
if (!isWin10OrGreater()) {
|
if (!isWin10OrGreater()) {
|
||||||
return ColorizationArea::None;
|
return ColorizationArea::NoArea;
|
||||||
}
|
}
|
||||||
const QString keyName = QStringLiteral("ColorPrevalence");
|
const QString keyName = QStringLiteral("ColorPrevalence");
|
||||||
const QSettings themeRegistry(QString::fromUtf8(kPersonalizeRegistryKey), QSettings::NativeFormat);
|
const QSettings themeRegistry(QString::fromUtf8(kPersonalizeRegistryKey), QSettings::NativeFormat);
|
||||||
|
@ -368,13 +368,13 @@ ColorizationArea Utilities::getColorizationArea()
|
||||||
const bool theme = (themeValue != 0);
|
const bool theme = (themeValue != 0);
|
||||||
const bool dwm = (dwmValue != 0);
|
const bool dwm = (dwmValue != 0);
|
||||||
if (theme && dwm) {
|
if (theme && dwm) {
|
||||||
return ColorizationArea::All;
|
return ColorizationArea::AllArea;
|
||||||
} else if (theme) {
|
} else if (theme) {
|
||||||
return ColorizationArea::StartMenu_TaskBar_ActionCenter;
|
return ColorizationArea::StartMenu_TaskBar_ActionCenter;
|
||||||
} else if (dwm) {
|
} else if (dwm) {
|
||||||
return ColorizationArea::TitleBar_WindowBorder;
|
return ColorizationArea::TitleBar_WindowBorder;
|
||||||
}
|
}
|
||||||
return ColorizationArea::None;
|
return ColorizationArea::NoArea;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Utilities::isThemeChanged(const void *data)
|
bool Utilities::isThemeChanged(const void *data)
|
||||||
|
|
Loading…
Reference in New Issue