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

test qt components #5922

Closed
wants to merge 2 commits into from
Closed
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
4 changes: 2 additions & 2 deletions recipes/qt/5.x.x/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ conan_set_vs_runtime()
conan_set_libcxx()
conan_output_dirs_setup()

find_package(Qt5 COMPONENTS Core REQUIRED CONFIG)
find_package(Qt5 COMPONENTS Core Network Sql REQUIRED CONFIG)

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
Expand All @@ -20,4 +20,4 @@ add_executable(${PROJECT_NAME} ${SOURCES})
# Must compile with "-fPIC" since Qt was built with -reduce-relocations.
target_compile_options(${PROJECT_NAME} PRIVATE -fPIC)

target_link_libraries(${PROJECT_NAME} Qt5::Core)
target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Network Qt5::Sql)
2 changes: 1 addition & 1 deletion recipes/qt/5.x.x/test_package/meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
project('test_package', 'cpp')
qt5 = import('qt5')
qt5_dep = dependency('qt5', modules: ['Core'])
qt5_dep = dependency('qt5', modules: ['Core', 'Network', 'Sql'])
moc_files = qt5.preprocess(moc_headers : 'greeter.h', qresources : 'example.qrc')
executable('test_package', 'test_package.cpp', moc_files,
dependencies : qt5_dep)
9 changes: 9 additions & 0 deletions recipes/qt/5.x.x/test_package/test_package.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
#include "greeter.h"
#include <QFile>

// Qt Network test
#include <QNetworkAccessManager>

// Qt Sql test
#include <QtSql>

int main(int argc, char *argv[]){
QCoreApplication app(argc, argv);
QCoreApplication::setApplicationName("Application Example");
Expand All @@ -25,5 +31,8 @@ int main(int argc, char *argv[]){
qDebug() << "Resource content:" << f.readAll();
f.close();

QNetworkAccessManager networkTester;

QSqlDatabase sqlTester;
return app.exec();
}
1 change: 1 addition & 0 deletions recipes/qt/5.x.x/test_package/test_package.pro
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ HEADERS += greeter.h
RESOURCES = example.qrc

QT -= gui
QT += network sql

CONFIG += console

Expand Down