Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

examples fixes for qt6 #88

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ else()
set(prefixPath ${CMAKE_BINARY_DIR}/${CMAKE_PREFIX_PATH})
endif()

ExternalProject_Add(books
SOURCE_DIR ${CMAKE_SOURCE_DIR}/books
INSTALL_COMMAND ""
CMAKE_ARGS
-DCMAKE_PREFIX_PATH=${prefixPath}
)
ExternalProject_Add(codegen
SOURCE_DIR ${CMAKE_SOURCE_DIR}/codegen
INSTALL_COMMAND ""
Expand All @@ -25,6 +19,13 @@ ExternalProject_Add(codegen
)

if (NOT GRANTLEE_BUILD_WITH_QT6)
ExternalProject_Add(books
SOURCE_DIR ${CMAKE_SOURCE_DIR}/books
INSTALL_COMMAND ""
CMAKE_ARGS
-DCMAKE_PREFIX_PATH=${prefixPath}
)

ExternalProject_Add(contacts
SOURCE_DIR ${CMAKE_SOURCE_DIR}/contacts
INSTALL_COMMAND ""
Expand All @@ -40,12 +41,12 @@ if (NOT GRANTLEE_BUILD_WITH_QT6)
-DCMAKE_PREFIX_PATH=${prefixPath}
DEPENDS contacts
)
endif()

ExternalProject_Add(textedit
SOURCE_DIR ${CMAKE_SOURCE_DIR}/textedit
INSTALL_COMMAND ""
CMAKE_ARGS
-DCMAKE_PREFIX_PATH=${prefixPath}
DEPENDS htmlapps
)
ExternalProject_Add(textedit
SOURCE_DIR ${CMAKE_SOURCE_DIR}/textedit
INSTALL_COMMAND ""
CMAKE_ARGS
-DCMAKE_PREFIX_PATH=${prefixPath}
DEPENDS htmlapps
)
endif()
10 changes: 8 additions & 2 deletions examples/books/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,13 @@ get_filename_component(Grantlee_PLUGIN_DIR ${Grantlee_PLUGIN_DIR} PATH)

configure_file(grantlee_paths.h.cmake ${PROJECT_BINARY_DIR}/grantlee_paths.h)

find_package(Qt5Widgets REQUIRED)
find_package(Qt5Sql REQUIRED)
if (GRANTLEE_BUILD_WITH_QT6)
find_package(Qt6Widgets REQUIRED)
find_package(Qt6Sql REQUIRED)
else()
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Sql REQUIRED)
endif()

add_executable(books
main.cpp
Expand All @@ -31,6 +36,7 @@ target_link_libraries(
books
Grantlee5::Templates
)

if (GRANTLEE_BUILD_WITH_QT6)
target_link_libraries(books
Qt6::Widgets
Expand Down
9 changes: 7 additions & 2 deletions examples/codegen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ get_filename_component(Grantlee_PLUGIN_DIR ${Grantlee_PLUGIN_DIR} PATH)

configure_file(grantlee_paths.h.cmake ${PROJECT_BINARY_DIR}/grantlee_paths.h)

qt5_add_resources(
qt_add_resources(
codegen_example_RCS_SRCS
custom_tags.qrc
OPTIONS -root "/plugins/grantlee/${Grantlee5_VERSION_MAJOR}.${Grantlee5_VERSION_MINOR}/"
Expand All @@ -35,12 +35,17 @@ add_executable(codegen
)
target_compile_definitions(codegen PRIVATE QT_DISABLE_DEPRECATED_BEFORE=0)

find_package(Qt5Widgets REQUIRED)
if (GRANTLEE_BUILD_WITH_QT6)
find_package(Qt6Widgets REQUIRED)
else()
find_package(Qt5Widgets REQUIRED)
endif()

target_link_libraries(
codegen
Grantlee5::Templates
)

if (GRANTLEE_BUILD_WITH_QT6)
target_link_libraries(codegen
Qt6::Widgets
Expand Down
2 changes: 1 addition & 1 deletion examples/codegen/designwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class DesignWidget : public QWidget
{
Q_OBJECT
public:
DesignWidget(QWidget *parent = 0, Qt::WindowFlags f = 0);
DesignWidget(QWidget *parent = 0, Qt::WindowFlags f = Qt::Widget);

Grantlee::Context getContext();

Expand Down
2 changes: 1 addition & 1 deletion examples/codegen/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = 0, Qt::WindowFlags flags = 0);
MainWindow(QWidget *parent = 0, Qt::WindowFlags flags = Qt::Widget);
virtual ~MainWindow();

private Q_SLOTS:
Expand Down
4 changes: 2 additions & 2 deletions examples/contacts/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class MainWindow : public QWidget
Q_OBJECT
public:
MainWindow(const QString &templateDir, QWidget *parent = 0,
Qt::WindowFlags f = 0);
Qt::WindowFlags f = Qt::Widget);

protected:
virtual void initLocalizer();
Expand All @@ -65,7 +65,7 @@ template <typename T> class AppMainWindow : public MainWindow
{
public:
AppMainWindow(const QString &templateDir, QWidget *parent = 0,
Qt::WindowFlags f = 0)
Qt::WindowFlags f = Qt::Widget)
: MainWindow(templateDir, parent, f)
{
}
Expand Down
23 changes: 14 additions & 9 deletions examples/textedit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ cmake_minimum_required(VERSION 3.5)
project(textedit_grantlee)

find_package(Grantlee5 REQUIRED)
find_package(Qt5Widgets REQUIRED)

if (GRANTLEE_BUILD_WITH_QT6)
find_package(Qt6Widgets REQUIRED)
else()
find_package(Qt5Widgets REQUIRED)
endif()

set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
Expand Down Expand Up @@ -47,13 +52,13 @@ target_link_libraries(
)

if (GRANTLEE_BUILD_WITH_QT6)
target_link_libraries(
textedit
Qt6::Widgets
)
target_link_libraries(
textedit
Qt6::Widgets
)
else()
target_link_libraries(
textedit
Qt5::Widgets
)
target_link_libraries(
textedit
Qt5::Widgets
)
endif()