diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml
index 3fb10b4..a40886b 100644
--- a/.github/workflows/linux.yml
+++ b/.github/workflows/linux.yml
@@ -21,10 +21,11 @@ jobs:
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
- version: '5.15.2'
+ aqtversion: "==3.1.*"
+ version: "6.8.0"
host: linux
target: desktop
- arch: gcc_64
+ arch: linux_gcc_64
- name: Configure CMake
run: cmake --preset linux
diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml
index c3cec6b..8b767f7 100644
--- a/.github/workflows/macos.yml
+++ b/.github/workflows/macos.yml
@@ -21,13 +21,14 @@ jobs:
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
- version: '5.15.2'
+ aqtversion: "==3.1.*"
+ version: "6.8.0"
host: mac
target: desktop
arch: clang_64
- name: Configure CMake
- run: cmake --preset macos -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED=OFF -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY="" -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGN_STYLE="Manual"
+ run: cmake --preset macos
- name: Build the library.
run: cmake --build --preset macos
diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml
index ac19a62..ba4e061 100644
--- a/.github/workflows/windows.yml
+++ b/.github/workflows/windows.yml
@@ -21,10 +21,11 @@ jobs:
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
- version: '5.15.2'
+ aqtversion: "==3.1.*"
+ version: "6.8.0"
host: windows
target: desktop
- arch: win64_msvc2019_64
+ arch: win64_msvc2022_64
- name: Configure CMake
run: cmake --preset windows
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fe2c62a..ae104ba 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.21.0)
# Custom CMake modules.
-list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
+# list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
# Enable parallel build (not enabled by default on Windows).
set(CMAKE_BUILD_PARALLEL_LEVEL $ENV{NUMBER_OF_PROCESSORS})
@@ -15,16 +15,6 @@ project("qlementine"
set(PROJECT_COPYRIGHT "© Olivier Cléro, MIT License.")
set(PROJECT_NAMESPACE "oclero")
-# Temporary hack to make it work with Qt6 <6.4.2 && >6.4.2
-# With Qt5, it was "path/to/Qt/6.7.0/msvc2019_64/lib/cmake/Qt6",
-# but with Qt6, it is now "path/to/Qt/6.7.0/msvc2019_64".
-if(WIN32)
- string(FIND "${CMAKE_PREFIX_PATH}" "/lib/cmake/Qt6" USING_Qt6_INDEX)
- if(NOT ${USING_Qt6_INDEX} EQUAL -1)
- string(REPLACE "/lib/cmake/Qt6" "" "${CMAKE_PREFIX_PATH}" "${CMAKE_PREFIX_PATH}")
- endif()
-endif()
-
# Global flags.
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD 17)
@@ -38,14 +28,10 @@ if (NOT CMAKE_OSX_DEPLOYMENT_TARGET)
endif()
# Find Qt.
-find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core)
-find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Widgets Svg)
-
-if(${QT_VERSION_MAJOR} STREQUAL "6")
- qt_standard_project_setup()
-endif()
+find_package(Qt6 REQUIRED COMPONENTS Core Widgets Svg)
+qt_standard_project_setup()
-include(DeployQt)
+# include(DeployQt)
# The library.
add_subdirectory(lib)
diff --git a/CMakePresets.json b/CMakePresets.json
index fe4cf1d..7e24687 100644
--- a/CMakePresets.json
+++ b/CMakePresets.json
@@ -13,7 +13,7 @@
"generator": "Xcode",
"binaryDir": "${sourceDir}/_build",
"cacheVariables": {
- "QT_DIR": "/opt/homebrew/opt/qt/lib/cmake/Qt5"
+ "CMAKE_PREFIX_PATH": "/opt/homebrew/opt/qt/lib/cmake/Qt6"
},
"condition": {
"type": "equals",
@@ -28,7 +28,7 @@
"generator": "Visual Studio 17 2022",
"binaryDir": "${sourceDir}/_build",
"cacheVariables": {
- "CMAKE_PREFIX_PATH": "C:/Qt/5.15.2/msvc2019_64/lib/cmake/Qt5"
+ "CMAKE_PREFIX_PATH": "C:/Qt/6.8.0/msvc2022_64"
},
"condition": {
"type": "equals",
diff --git a/README.md b/README.md
index f07351e..84475e3 100644
--- a/README.md
+++ b/README.md
@@ -1,22 +1,21 @@
# Qlementine
-[![License: MIT](https://img.shields.io/badge/license-MIT-green)](https://mit-license.org/)
-[![CMake version](https://img.shields.io/badge/CMake-3.17.5+-064F8C?logo=cmake)](https://www.qt.io)
+[![License: MIT](https://img.shields.io/badge/license-MIT-green)](https://mit-license.org)
+[![CMake version](https://img.shields.io/badge/CMake-3.21.0+-064F8C?logo=cmake)](https://cmake.org)
[![C++ version](https://img.shields.io/badge/C++-17-00599C?logo=++)](https://www.qt.io)
-[![Qt version](https://img.shields.io/badge/Qt-5.15.3+-41CD52?logo=qt)](https://www.qt.io)
-[![Qt version](https://img.shields.io/badge/Qt-6.0.0+-41CD52?logo=qt)](https://www.qt.io)
+[![Qt version](https://img.shields.io/badge/Qt-6.8.0+-41CD52?logo=qt)](https://www.qt.io)
[![Linux](https://github.com/oclero/qlementine/actions/workflows/linux.yml/badge.svg)](https://github.com/oclero/qlementine/actions/workflows/linux.yml)
[![Linux](https://github.com/oclero/qlementine/actions/workflows/windows.yml/badge.svg)](https://github.com/oclero/qlementine/actions/workflows/windows.yml)
[![Linux](https://github.com/oclero/qlementine/actions/workflows/macos.yml/badge.svg)](https://github.com/oclero/qlementine/actions/workflows/macos.yml)
-Modern QStyle for desktop Qt5/Qt6 applications.
+Modern QStyle for desktop Qt6 applications.
See [documentation](https://oclero.github.io/qlementine) for more information.
@@ -35,8 +34,8 @@ See [documentation](https://oclero.github.io/qlementine) for more information.
## Requirements
- Windows, MacOS or Linux.
-- [CMake 3.20.0+](https://cmake.org/download)
-- [Qt 5.15.3+ or Qt 6.0.0+](https://www.qt.io/download-qt-installer)
+- [CMake 3.21.0+](https://cmake.org/download)
+- [Qt 6.8.0+](https://www.qt.io/download-qt-installer)
## Features
diff --git a/cmake/DeployQt.cmake b/cmake/DeployQt.cmake
deleted file mode 100644
index 07a53d1..0000000
--- a/cmake/DeployQt.cmake
+++ /dev/null
@@ -1,46 +0,0 @@
-# Deploys Qt libraries besides the target executable.
-function(target_deploy_qt TARGET_NAME)
- if(WIN32)
- set(DEPLOYQT_NAME "windeployqt")
- elseif(APPLE)
- set(DEPLOYQT_NAME "macdeployqt")
- else()
- #message(WARNING "Deployement of dependecies not implemented yet for this platform.")
- return()
- endif()
-
- if (DEPLOYQT_NAME)
- get_target_property(QMAKE_LOCATION Qt::qmake IMPORTED_LOCATION)
- get_filename_component(QT_BINARY_DIR ${QMAKE_LOCATION} DIRECTORY)
- find_program(DEPLOYQT_EXE "${DEPLOYQT_NAME}" HINTS "${QT_BINARY_DIR}" REQUIRED)
- set(QTDEPLOY_TARGET_NAME Qt::deploy)
- add_executable(${QTDEPLOY_TARGET_NAME} IMPORTED)
- set_property(TARGET ${QTDEPLOY_TARGET_NAME} PROPERTY IMPORTED_LOCATION ${DEPLOYQT_EXE})
-
- # Deploy Qt dependencies to help launch individual instances.
- if(TARGET ${QTDEPLOY_TARGET_NAME})
- if(WIN32)
- if(${QT_VERSION_MAJOR} STREQUAL "6")
- add_custom_command(TARGET ${TARGET_NAME} POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E echo "Deploying Qt..."
- COMMAND ${QTDEPLOY_TARGET_NAME} --verbose 0 --no-patchqt --no-compiler-runtime --no-system-d3d-compiler --no-translations --no-opengl-sw --dir "$" "$"
- )
- else()
- add_custom_command(TARGET ${TARGET_NAME} POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E echo "Deploying Qt..."
- COMMAND ${QTDEPLOY_TARGET_NAME} --verbose 0 --no-patchqt --no-compiler-runtime --no-webkit2 --no-system-d3d-compiler --no-translations --no-angle --no-opengl-sw --dir "$" "$"
- )
- endif()
- elseif(APPLE)
- add_custom_command(TARGET ${TARGET_NAME} POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E echo "Deploying Qt..."
- COMMAND ${QTDEPLOY_TARGET_NAME} "$" -verbose=0
- )
- add_custom_command(TARGET ${TARGET_NAME} POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E echo "Removing unwanted codesigning made by macdeployqt..."
- COMMAND codesign --remove-signature "$"
- )
- endif()
- endif()
- endif()
-endfunction()
diff --git a/docs/index.md b/docs/index.md
index d1db47e..3537a14 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -4,7 +4,7 @@
# Qlementine
-[Qlementine](https://github.com/oclero/qlementine) is a modern QStyle for desktop Qt5/Qt6 applications, released under the MIT license.
+[Qlementine](https://github.com/oclero/qlementine) is a modern QStyle for desktop Qt6 applications, released under the MIT license.
## Library content
@@ -17,8 +17,8 @@ This library contains:
## Requirements
- Windows, MacOS or Linux.
-- [CMake 3.17.5+](https://cmake.org/download)
-- [Qt 5.15.3+ or Qt 6.0.0+](https://www.qt.io/download-qt-installer)
+- [CMake 3.21.0+](https://cmake.org/download)
+- [Qt 6.8.0+](https://www.qt.io/download-qt-installer)
## FAQ
diff --git a/docs/usage.md b/docs/usage.md
index 18717dd..07385f4 100644
--- a/docs/usage.md
+++ b/docs/usage.md
@@ -16,7 +16,7 @@
target_link_libraries(your_project oclero::qlementine)
```
-## Usage
+## Usage in code
Define the `QStyle` on your `QApplication`.
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index 7e6f6a1..496ba05 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -1,13 +1,5 @@
set(LIB_TARGET_NAME ${PROJECT_NAME})
-find_package(Qt${QT_VERSION_MAJOR}
- COMPONENTS
- Core
- Widgets
- Svg
- REQUIRED
-)
-
# Declare files.
set(SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/src/animation/WidgetAnimator.cpp
@@ -111,19 +103,16 @@ set(RESOURCES
$<$:resources/qlementine_font_inter_windows.qrc>
)
-# Configure target.
-add_library(${LIB_TARGET_NAME} STATIC)
+# Create target.
+qt_add_library(${LIB_TARGET_NAME} STATIC
+ ${HEADERS}
+ ${SOURCES}
+ ${RESOURCES}
+)
# Create a target alias.
add_library(${PROJECT_NAMESPACE}::${LIB_TARGET_NAME} ALIAS ${LIB_TARGET_NAME})
-target_sources(${LIB_TARGET_NAME}
- PRIVATE
- ${HEADERS}
- ${SOURCES}
- ${RESOURCES}
-)
-
target_include_directories(${LIB_TARGET_NAME}
PUBLIC
$
@@ -132,9 +121,9 @@ target_include_directories(${LIB_TARGET_NAME}
)
target_link_libraries(${LIB_TARGET_NAME} PUBLIC
- Qt::Core
- Qt::Widgets
- Qt::Svg
+ Qt6::Core
+ Qt6::Widgets
+ Qt6::Svg
)
set_target_properties(${LIB_TARGET_NAME}
diff --git a/lib/include/oclero/qlementine/widgets/AbstractItemListWidget.hpp b/lib/include/oclero/qlementine/widgets/AbstractItemListWidget.hpp
index 2604b76..714ed66 100644
--- a/lib/include/oclero/qlementine/widgets/AbstractItemListWidget.hpp
+++ b/lib/include/oclero/qlementine/widgets/AbstractItemListWidget.hpp
@@ -80,11 +80,7 @@ class AbstractItemListWidget : public QWidget {
void keyPressEvent(QKeyEvent* e) override;
void keyReleaseEvent(QKeyEvent* e) override;
void mousePressEvent(QMouseEvent* e) override;
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- void enterEvent(QEvent* e) override;
-#else
void enterEvent(QEnterEvent* e) override;
-#endif
void leaveEvent(QEvent* e) override;
void mouseReleaseEvent(QMouseEvent* e) override;
void mouseMoveEvent(QMouseEvent* e) override;
diff --git a/lib/include/oclero/qlementine/widgets/Switch.hpp b/lib/include/oclero/qlementine/widgets/Switch.hpp
index ef9c3db..b341e2e 100644
--- a/lib/include/oclero/qlementine/widgets/Switch.hpp
+++ b/lib/include/oclero/qlementine/widgets/Switch.hpp
@@ -24,11 +24,7 @@ class Switch : public QAbstractButton {
protected:
void paintEvent(QPaintEvent* e) override;
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- void enterEvent(QEvent* e) override;
-#else
void enterEvent(QEnterEvent* e) override;
-#endif
void leaveEvent(QEvent* e) override;
void changeEvent(QEvent* e) override;
void focusInEvent(QFocusEvent* e) override;
diff --git a/lib/src/style/QlementineStyle.cpp b/lib/src/style/QlementineStyle.cpp
index e839c51..236a3cb 100644
--- a/lib/src/style/QlementineStyle.cpp
+++ b/lib/src/style/QlementineStyle.cpp
@@ -1755,12 +1755,8 @@ void QlementineStyle::drawControl(ControlElement ce, const QStyleOption* opt, QP
const auto autoIconColor = this->autoIconColor(w);
const auto colorize = autoIconColor != AutoIconColor::None;
const auto iconMode = (optHeader->state & State_Enabled || colorize) ? QIcon::Normal : QIcon::Disabled;
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- const auto iconPixmap = icon.pixmap(qlementine::getWindow(w), { iconExtent, iconExtent }, iconMode);
-#else
const auto iconPixmap =
icon.pixmap({ iconExtent, iconExtent }, qlementine::getWindow(w)->devicePixelRatio(), iconMode);
-#endif
const auto& colorizedPixmap = colorize ? qlementine::colorizePixmap(iconPixmap, fgColor) : iconPixmap;
p->drawPixmap(iconRect, colorizedPixmap);
}
@@ -3759,13 +3755,7 @@ QSize QlementineStyle::sizeFromContents(
// Shortcut. NB: Some difficulties to understand what's going on. Qt changes the width so here's a hack.
const auto hasShortcut = shortcut.length() > 0;
-
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- const auto reservedShortcutW = optMenuItem->tabWidth;
-#else
const auto reservedShortcutW = optMenuItem->reservedShortcutWidth;
-#endif
-
const auto shortcutW = hasShortcut ? 3 * spacing - reservedShortcutW : 0;
// Icon.
@@ -4098,12 +4088,6 @@ int QlementineStyle::pixelMetric(PixelMetric m, const QStyleOption* opt, const Q
return _impl->theme.iconSize.height();
// Dialog.
- case PM_DialogButtonsSeparator:
- break;
- case PM_DialogButtonsButtonWidth:
- break;
- case PM_DialogButtonsButtonHeight:
- return _impl->theme.controlHeightLarge;
case PM_MessageBoxIconSize:
return _impl->theme.iconSizeLarge.height();
diff --git a/lib/src/utils/ColorUtils.cpp b/lib/src/utils/ColorUtils.cpp
index 08bb401..18cff3c 100644
--- a/lib/src/utils/ColorUtils.cpp
+++ b/lib/src/utils/ColorUtils.cpp
@@ -145,17 +145,10 @@ std::optional tryGetColorFromHexaString(QString const& str) {
if (str.startsWith('#') && (length == RGB_LENGTH || length == RGBA_LENGTH)) {
auto success{ false };
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- const auto r_str = str.midRef(1, 2);
- const auto g_str = str.midRef(3, 2);
- const auto b_str = str.midRef(5, 2);
- const auto a_str = str.midRef(7, 2);
-#else
const auto r_str = str.mid(1, 2);
const auto g_str = str.mid(3, 2);
const auto b_str = str.mid(5, 2);
const auto a_str = str.mid(7, 2);
-#endif
const auto r = r_str.toInt(&success, HEX_BASE);
if (success) {
@@ -180,11 +173,7 @@ std::optional tryGetColorFromHexaString(QString const& str) {
}
std::optional tryGetColorFromVariant(QVariant const& variant) {
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- const auto variantType = static_cast(variant.type());
-#else
const auto variantType = variant.typeId();
-#endif
// Channel list ([RRR, GGG, BBB, AAA]).
if (variantType == QMetaType::Type::QVariantList) {
diff --git a/lib/src/utils/PrimitiveUtils.cpp b/lib/src/utils/PrimitiveUtils.cpp
index 85d2589..f93beaf 100644
--- a/lib/src/utils/PrimitiveUtils.cpp
+++ b/lib/src/utils/PrimitiveUtils.cpp
@@ -1362,19 +1362,15 @@ QPixmap getPixmap(
QIcon const& icon, const QSize& iconSize, MouseState const mouse, CheckState const checked, const QWidget* widget) {
const auto iconMode = getIconMode(mouse);
const auto iconState = getIconState(checked);
- // QIcon::pixmap will automatically get the correct pixel ratio based on the window's pixel ratio.
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- return icon.pixmap(getWindow(widget), iconSize, iconMode, iconState);
-#else
const auto devicePixelRatio = widget ? widget->devicePixelRatio() : qApp->devicePixelRatio();
// Qt icon pixmap cache is broken when devicePixelRatio > 1.0.
auto cacheKey = QString("qlementine_icon_pixmap_%1_%2_%3_%4_%5_%6")
- .arg(icon.cacheKey())
- .arg(iconSize.width())
- .arg(iconSize.height())
- .arg(devicePixelRatio)
- .arg(static_cast(iconMode))
- .arg(static_cast(iconState));
+ .arg(icon.cacheKey())
+ .arg(iconSize.width())
+ .arg(iconSize.height())
+ .arg(devicePixelRatio)
+ .arg(static_cast(iconMode))
+ .arg(static_cast(iconState));
QPixmap pixmap;
if (QPixmapCache::find(cacheKey, &pixmap)) {
return pixmap;
@@ -1382,7 +1378,6 @@ QPixmap getPixmap(
pixmap = icon.pixmap(iconSize, devicePixelRatio, iconMode, iconState);
QPixmapCache::insert(cacheKey, pixmap);
return pixmap;
-#endif
}
QRect drawIcon(const QRect& rect, QPainter* p, const QIcon& icon, const MouseState mouse, const CheckState checked,
diff --git a/lib/src/utils/StyleUtils.cpp b/lib/src/utils/StyleUtils.cpp
index 90e7442..8bf88cf 100644
--- a/lib/src/utils/StyleUtils.cpp
+++ b/lib/src/utils/StyleUtils.cpp
@@ -88,11 +88,7 @@ bool shouldNotHaveWheelEvents(const QWidget* w) {
}
int getTabIndex(const QStyleOptionTab* optTab, const QWidget* parentWidget) {
-#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
if (const auto* optTabV4 = qstyleoption_cast(optTab)) {
-#else
- if (const auto* optTabV4 = qstyleoption_cast(optTab)) {
-#endif
return optTabV4->tabIndex;
}
diff --git a/lib/src/widgets/AbstractItemListWidget.cpp b/lib/src/widgets/AbstractItemListWidget.cpp
index 6af7f89..07e80c1 100644
--- a/lib/src/widgets/AbstractItemListWidget.cpp
+++ b/lib/src/widgets/AbstractItemListWidget.cpp
@@ -343,11 +343,7 @@ void AbstractItemListWidget::keyReleaseEvent(QKeyEvent* e) {
}
}
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
-void AbstractItemListWidget::enterEvent(QEvent* e) {
-#else
void AbstractItemListWidget::enterEvent(QEnterEvent* e) {
-#endif
QWidget::enterEvent(e);
update();
}
diff --git a/lib/src/widgets/ColorButton.cpp b/lib/src/widgets/ColorButton.cpp
index 64665ca..9fdd259 100644
--- a/lib/src/widgets/ColorButton.cpp
+++ b/lib/src/widgets/ColorButton.cpp
@@ -80,8 +80,8 @@ void ColorButton::setColorMode(ColorMode mode) {
QSize ColorButton::sizeHint() const {
const auto* style = this->style();
const auto* qlementineStyle = qobject_cast(style);
- const auto extent = qlementineStyle ? qlementineStyle->theme().controlHeightMedium
- : style->pixelMetric(QStyle::PM_DialogButtonsButtonHeight);
+ const auto extent =
+ qlementineStyle ? qlementineStyle->theme().controlHeightMedium : style->pixelMetric(QStyle::PM_ButtonIconSize);
return { extent, extent };
}
diff --git a/lib/src/widgets/Popover.cpp b/lib/src/widgets/Popover.cpp
index a5b4518..5f2ab58 100644
--- a/lib/src/widgets/Popover.cpp
+++ b/lib/src/widgets/Popover.cpp
@@ -59,11 +59,7 @@ class PopoverFrame : public QWidget {
void updateMask() {
const auto mask = getMask();
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- const auto maskPixmap = QBitmap(mask);
-#else
const auto maskPixmap = QBitmap::fromPixmap(mask);
-#endif
setMask(maskPixmap);
}
};
diff --git a/lib/src/widgets/Switch.cpp b/lib/src/widgets/Switch.cpp
index 4987dfa..946ee07 100644
--- a/lib/src/widgets/Switch.cpp
+++ b/lib/src/widgets/Switch.cpp
@@ -87,7 +87,8 @@ void Switch::paintEvent(QPaintEvent*) {
// Draw icon.
const auto extent = iconSize.height();
if (hasIcon && availableW >= extent) {
- const auto pixmap = qlementine::getPixmap(icon(), {extent, extent}, MouseState::Normal, CheckState::Checked, this);
+ const auto pixmap =
+ qlementine::getPixmap(icon(), { extent, extent }, MouseState::Normal, CheckState::Checked, this);
const auto coloredPixmap = getColorizedPixmap(pixmap, textColor);
const auto iconX = availableX;
const auto iconY = contentRect.y() + (contentRect.height() - extent) / 2;
@@ -113,11 +114,7 @@ void Switch::paintEvent(QPaintEvent*) {
}
}
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
-void Switch::enterEvent(QEvent* e) {
-#else
void Switch::enterEvent(QEnterEvent* e) {
-#endif
QAbstractButton::enterEvent(e);
_isMouseOver = true;
startAnimation();
diff --git a/sandbox/CMakeLists.txt b/sandbox/CMakeLists.txt
index c6dcdda..f5ded43 100644
--- a/sandbox/CMakeLists.txt
+++ b/sandbox/CMakeLists.txt
@@ -7,7 +7,7 @@ if(APPLE)
)
endif()
-set(SOURCES
+qt_add_executable(${SANDBOX_NAME} WIN32 MACOSX_BUNDLE
${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/SandboxWindow.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/SandboxWindow.hpp
@@ -15,16 +15,6 @@ set(SOURCES
${APP_ICON_MACOS}
)
-if(${QT_VERSION_MAJOR} STREQUAL "6")
- qt_add_executable(${SANDBOX_NAME} WIN32 MACOSX_BUNDLE
- ${SOURCES}
- )
-else()
- add_executable(${SANDBOX_NAME} WIN32 MACOSX_BUNDLE
- ${SOURCES}
- )
-endif()
-
target_link_libraries(${SANDBOX_NAME} PUBLIC
oclero::qlementine
)
@@ -50,13 +40,13 @@ set_target_properties(${SANDBOX_NAME} PROPERTIES
MACOSX_BUNDLE_ICON_FILE "icon.icns"
MACOSX_BUNDLE_COPYRIGHT ${PROJECT_COPYRIGHT}
- XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "${XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED}"
- XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "${XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY}"
- XCODE_ATTRIBUTE_CODE_SIGN_STYLE "${XCODE_ATTRIBUTE_CODE_SIGN_STYLE}"
+ XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED OFF
+ XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY ""
+ XCODE_ATTRIBUTE_CODE_SIGN_STYLE "Manual"
XCODE_ATTRIBUTE_CODE_SIGN_INJECT_BASE_ENTITLEMENTS OFF
)
-target_deploy_qt(sandbox)
+# target_deploy_qt(sandbox)
# if(${QT_VERSION_MAJOR} STREQUAL "6")
# # NB: Broken in 6.7.x
@@ -79,6 +69,3 @@ target_deploy_qt(sandbox)
# else()
# target_deploy_qt(sandbox)
# endif()
-
-
-
diff --git a/sandbox/src/SandboxWindow.cpp b/sandbox/src/SandboxWindow.cpp
index 7222727..efd0b11 100644
--- a/sandbox/src/SandboxWindow.cpp
+++ b/sandbox/src/SandboxWindow.cpp
@@ -230,12 +230,7 @@ struct SandboxWindow::Impl {
}
void setupShortcuts() {
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- auto* enableShortcut = new QShortcut(Qt::CTRL + Qt::Key_E, &owner);
-#else
auto* enableShortcut = new QShortcut(Qt::CTRL | Qt::Key_E, &owner);
-#endif
-
enableShortcut->setAutoRepeat(false);
enableShortcut->setContext(Qt::ShortcutContext::ApplicationShortcut);
QObject::connect(enableShortcut, &QShortcut::activated, enableShortcut, [this]() {
@@ -248,12 +243,7 @@ struct SandboxWindow::Impl {
}
});
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- auto* themeShortcut = new QShortcut(Qt::CTRL + Qt::Key_T, &owner);
-#else
auto* themeShortcut = new QShortcut(Qt::CTRL | Qt::Key_T, &owner);
-#endif
-
themeShortcut->setAutoRepeat(false);
themeShortcut->setContext(Qt::ShortcutContext::ApplicationShortcut);
QObject::connect(themeShortcut, &QShortcut::activated, themeShortcut, [this]() {
@@ -268,11 +258,7 @@ struct SandboxWindow::Impl {
}
});
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- auto* focusShortcut = new QShortcut(Qt::CTRL + Qt::Key_F, &owner);
-#else
auto* focusShortcut = new QShortcut(Qt::CTRL | Qt::Key_F, &owner);
-#endif
focusShortcut->setAutoRepeat(false);
focusShortcut->setContext(Qt::ShortcutContext::ApplicationShortcut);
QObject::connect(focusShortcut, &QShortcut::activated, focusShortcut, []() {
@@ -774,21 +760,12 @@ struct SandboxWindow::Impl {
action->setCheckable(true);
action->setChecked(true);
} else if (j % 2 == 0) {
- const auto key_number = (Qt::Key)(Qt::Key_0 + j);
-
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- const auto keySeq = QKeySequence(Qt::CTRL + (Qt::Key_0 + key_number));
-#else
- const auto keySeq = QKeySequence(Qt::CTRL | (Qt::Key_0 + key_number));
-#endif
+ const auto keyNumber = (Qt::Key)(Qt::Key_0 + j);
+ const auto keySeq = QKeySequence(Qt::CTRL | (Qt::Key_0 + keyNumber));
action->setShortcut(keySeq);
} else if (j % 3 == 0) {
- const auto key_number = (Qt::Key)(Qt::Key_0 + j);
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- const auto keySeq = QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::ALT | (Qt::Key_0 + key_number));
-#else
- const auto keySeq = QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::ALT | (Qt::Key_0 + key_number));
-#endif
+ const auto keyNumber = (Qt::Key)(Qt::Key_0 + j);
+ const auto keySeq = QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::ALT | (Qt::Key_0 + keyNumber));
action->setShortcut(keySeq);
} else if (j % 5 == 0) {
action->setEnabled(false);
@@ -1551,11 +1528,7 @@ Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deseru
const auto& clickPos = e->pos();
const auto clickPosStr = QString("(%1, %2)").arg(clickPos.x()).arg(clickPos.y());
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- menu.addAction(QString("Pos: %1").arg(clickPosStr), cb, Qt::CTRL + Qt::Key_A);
-#else
menu.addAction(QString("Pos: %1").arg(clickPosStr), Qt::CTRL | Qt::Key_A, cb);
-#endif
const auto randomCount = getRandomInt(1, 10);
for (auto i = 0; i < randomCount; ++i) {
@@ -1565,11 +1538,7 @@ Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deseru
textList.append("A");
}
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- menu.addAction(textList.join("") + QString(" %1").arg(i), cb, Qt::ALT + Qt::SHIFT + Qt::Key_0 + i);
-#else
menu.addAction(textList.join("") + QString(" %1").arg(i), Qt::ALT | Qt::SHIFT | Qt::Key_0 + i, cb);
-#endif
}
// Show menu.
diff --git a/sandbox/src/main.cpp b/sandbox/src/main.cpp
index 694dbb6..15ab031 100644
--- a/sandbox/src/main.cpp
+++ b/sandbox/src/main.cpp
@@ -16,10 +16,7 @@
int main(int argc, char* argv[]) {
// Must be set before creating a QApplication.
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true);
- QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true);
-#endif
+ QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
QApplication qApplication(argc, argv);
@@ -30,7 +27,6 @@ int main(int argc, char* argv[]) {
QCoreApplication::setOrganizationName("oclero");
QCoreApplication::setOrganizationDomain("olivierclero.com");
QCoreApplication::setApplicationVersion("1.0.0");
- QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
QApplication::setWindowIcon(QIcon(QStringLiteral(":/qlementine_icon.ico")));
// Set custom QStyle.
diff --git a/scripts/install-deps-ubuntu.sh b/scripts/install-deps-ubuntu.sh
index 3b2d8dd..d8d89da 100755
--- a/scripts/install-deps-ubuntu.sh
+++ b/scripts/install-deps-ubuntu.sh
@@ -1,48 +1,21 @@
#!/bin/bash
-if [ "$#" -ne 1 ]; then
- echo "Please specify Qt major version number. Supported versions are [5, 6]."
- exit 1
-fi
-
-declare qt_version=$1
-
-# # General dependencies.
+# General dependencies.
+echo "Installing general dependencies..."
sudo apt install -y \
build-essential \
cmake \
pkg-config
-# # Qt dependencies.
-if [[ $qt_version -eq 5 ]]; then
- echo "Installing Qt$qt_version..."
-
- sudo apt-get install -y \
- qtbase5-dev \
- qtbase5-dev-tools \
- qt5-qmake \
- qttools5-dev \
- qttools5-dev-tools \
- qt5svg5*
-
- echo "Done."
-
-elif [[ $qt_version -eq 6 ]]; then
- echo "Installing Qt$qt_version..."
-
- sudo apt-get install -y \
- qt6-base-dev \
- qt6-base-dev-tools \
- qt6-tools-dev \
- qt6-tools-dev-tools \
- qmake6 \
- libqt6svg6 \
- libqt6svg6-dev
-
- echo "Done."
-
-else
- echo "Wrong parameter. Supported versions are: [5, 6]."
- exit 1
-
-fi
+# Qt dependencies.
+echo "Installing Qt6 dependencies..."
+sudo apt-get install -y \
+ qt6-base-dev \
+ qt6-base-dev-tools \
+ qt6-tools-dev \
+ qt6-tools-dev-tools \
+ qmake6 \
+ libqt6svg6 \
+ libqt6svg6-dev
+
+echo "Done."