From 5ca81ad837c32d502fd810893495857670a45211 Mon Sep 17 00:00:00 2001 From: Andrey Rodionov Date: Sat, 9 Jan 2021 19:55:26 +0300 Subject: [PATCH] Add support Qt6 --- CMakeLists.txt | 11 +++++++---- rtptheme.h | 4 ++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5d8079d..cb75633 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.5) +cmake_minimum_required(VERSION 3.16) project(rtptheme LANGUAGES CXX) @@ -9,7 +9,10 @@ set(CMAKE_AUTORCC ON) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) -find_package(Qt5 COMPONENTS Widgets REQUIRED) +if(NOT QT_DEFAULT_MAJOR_VERSION) + set(QT_DEFAULT_MAJOR_VERSION 5 CACHE STRING "Qt version to use (5 or 6), defaults to 5") +endif() +find_package(Qt${QT_DEFAULT_MAJOR_VERSION} COMPONENTS Widgets REQUIRED) add_library(rtptheme SHARED main.cpp @@ -18,8 +21,8 @@ add_library(rtptheme SHARED rtptheme.json ) -target_link_libraries(rtptheme PRIVATE Qt5::Widgets) -target_link_libraries(rtptheme PRIVATE Qt5::GuiPrivate) +target_link_libraries(rtptheme PRIVATE Qt::Widgets) +target_link_libraries(rtptheme PRIVATE Qt::GuiPrivate) target_compile_definitions(rtptheme PRIVATE RTPTHEME_LIBRARY) diff --git a/rtptheme.h b/rtptheme.h index ed03684..f16c7e5 100644 --- a/rtptheme.h +++ b/rtptheme.h @@ -1,4 +1,4 @@ -#ifndef RTPTHEME_H +#ifndef RTPTHEME_H #define RTPTHEME_H #include @@ -33,7 +33,7 @@ public: QPixmap standardPixmap(StandardPixmap sp, const QSizeF &size) const override; QIcon fileIcon(const QFileInfo &fileInfo, - QPlatformTheme::IconOptions iconOptions = nullptr) const override; + QPlatformTheme::IconOptions iconOptions = {}) const override; QIconEngine *createIconEngine(const QString &iconName) const override;