diff options
Diffstat (limited to 'examples/widgets/painting/pathstroke')
-rw-r--r-- | examples/widgets/painting/pathstroke/CMakeLists.txt | 50 | ||||
-rw-r--r-- | examples/widgets/painting/pathstroke/main.cpp | 5 | ||||
-rw-r--r-- | examples/widgets/painting/pathstroke/pathstroke.cpp | 29 |
3 files changed, 17 insertions, 67 deletions
diff --git a/examples/widgets/painting/pathstroke/CMakeLists.txt b/examples/widgets/painting/pathstroke/CMakeLists.txt index feececacc8..5c995617eb 100644 --- a/examples/widgets/painting/pathstroke/CMakeLists.txt +++ b/examples/widgets/painting/pathstroke/CMakeLists.txt @@ -4,21 +4,11 @@ cmake_minimum_required(VERSION 3.16) project(pathstroke LANGUAGES CXX) -set(CMAKE_AUTOMOC ON) - -if(NOT DEFINED INSTALL_EXAMPLESDIR) - set(INSTALL_EXAMPLESDIR "examples") -endif() - -set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/painting/pathstroke") - find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets) +qt_standard_project_setup() + qt_add_executable(pathstroke - # remove files from ../shared - #../shared/arthurstyle.cpp ../shared/arthurstyle.h - #../shared/arthurwidgets.cpp ../shared/arthurwidgets.h - #../shared/hoverpoints.cpp ../shared/hoverpoints.h main.cpp pathstroke.cpp pathstroke.h ) @@ -28,18 +18,14 @@ set_target_properties(pathstroke PROPERTIES MACOSX_BUNDLE TRUE ) -target_include_directories(pathstroke PUBLIC - ../shared -) - if(NOT TARGET painting_shared::painting_shared) include(../shared/use_lib.cmake) endif() -target_link_libraries(pathstroke PUBLIC - Qt::Core - Qt::Gui - Qt::Widgets +target_link_libraries(pathstroke PRIVATE + Qt6::Core + Qt6::Gui + Qt6::Widgets painting_shared::painting_shared ) @@ -103,19 +89,15 @@ qt_add_resources(pathstroke "pathstroke" ${pathstroke_resource_files} ) -# remove files from ../shared -#if(QT_FEATURE_opengl) - #target_sources(affine PUBLIC - #../shared/fbopaintdevice.cpp ../shared/fbopaintdevice.h - #) - - #target_link_libraries(affine PUBLIC - #Qt::OpenGL - #) -#endif() - install(TARGETS pathstroke - RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" - BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" - LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION . + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) + +qt_generate_deploy_app_script( + TARGET pathstroke + OUTPUT_SCRIPT deploy_script + NO_UNSUPPORTED_PLATFORM_ERROR ) +install(SCRIPT ${deploy_script}) diff --git a/examples/widgets/painting/pathstroke/main.cpp b/examples/widgets/painting/pathstroke/main.cpp index d7c64b3c64..4f991e8a0a 100644 --- a/examples/widgets/painting/pathstroke/main.cpp +++ b/examples/widgets/painting/pathstroke/main.cpp @@ -7,11 +7,6 @@ int main(int argc, char **argv) { - Q_INIT_RESOURCE(pathstroke); -#ifdef Q_OS_ANDROID - qputenv("QT_SCALE_FACTOR", "2"); -#endif - QApplication app(argc, argv); bool smallScreen = QApplication::arguments().contains("-small-screen"); diff --git a/examples/widgets/painting/pathstroke/pathstroke.cpp b/examples/widgets/painting/pathstroke/pathstroke.cpp index 9bec56233c..cd54a7a8aa 100644 --- a/examples/widgets/painting/pathstroke/pathstroke.cpp +++ b/examples/widgets/painting/pathstroke/pathstroke.cpp @@ -177,12 +177,6 @@ void PathStrokeControls::layoutForDesktop() QPushButton *showSourceButton = new QPushButton(mainGroup); showSourceButton->setText(tr("Show Source")); -#if QT_CONFIG(opengl) - QPushButton *enableOpenGLButton = new QPushButton(mainGroup); - enableOpenGLButton->setText(tr("Use OpenGL")); - enableOpenGLButton->setCheckable(true); - enableOpenGLButton->setChecked(m_renderer->usesOpenGL()); -#endif QPushButton *whatsThisButton = new QPushButton(mainGroup); whatsThisButton->setText(tr("What's This?")); whatsThisButton->setCheckable(true); @@ -206,9 +200,6 @@ void PathStrokeControls::layoutForDesktop() mainGroupLayout->addWidget(animated); mainGroupLayout->addStretch(1); mainGroupLayout->addWidget(showSourceButton); -#if QT_CONFIG(opengl) - mainGroupLayout->addWidget(enableOpenGLButton); -#endif mainGroupLayout->addWidget(whatsThisButton); @@ -221,10 +212,6 @@ void PathStrokeControls::layoutForDesktop() connect(showSourceButton, &QAbstractButton::clicked, m_renderer, &ArthurFrame::showSource); -#if QT_CONFIG(opengl) - connect(enableOpenGLButton, &QAbstractButton::clicked, - m_renderer, &ArthurFrame::enableOpenGL); -#endif connect(whatsThisButton, &QAbstractButton::clicked, m_renderer, &ArthurFrame::setDescriptionEnabled); connect(m_renderer, &ArthurFrame::descriptionEnabledChanged, @@ -259,13 +246,6 @@ void PathStrokeControls::layoutForSmallScreens() penWidth->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); penWidth->setRange(0, 500); -#if QT_CONFIG(opengl) - QPushButton *enableOpenGLButton = new QPushButton(this); - enableOpenGLButton->setText(tr("Use OpenGL")); - enableOpenGLButton->setCheckable(true); - enableOpenGLButton->setChecked(m_renderer->usesOpenGL()); -#endif - // Layouts: QHBoxLayout *penWidthLayout = new QHBoxLayout; penWidthLayout->addWidget(penWidthLabel, 0, Qt::AlignRight); @@ -274,9 +254,6 @@ void PathStrokeControls::layoutForSmallScreens() QVBoxLayout *leftLayout = new QVBoxLayout; leftLayout->addWidget(m_capGroup); leftLayout->addWidget(m_joinGroup); -#if QT_CONFIG(opengl) - leftLayout->addWidget(enableOpenGLButton); -#endif leftLayout->addLayout(penWidthLayout); QVBoxLayout *rightLayout = new QVBoxLayout; @@ -297,10 +274,6 @@ void PathStrokeControls::layoutForSmallScreens() mainLayout->addWidget(quitBtn, 2, 1, Qt::AlignHCenter | Qt::AlignTop); mainLayout->addWidget(okBtn, 2, 2, Qt::AlignHCenter | Qt::AlignTop); -#if QT_CONFIG(opengl) - connect(enableOpenGLButton, &QAbstractButton::clicked, m_renderer, &ArthurFrame::enableOpenGL); -#endif - connect(penWidth, &QAbstractSlider::valueChanged, m_renderer, &PathStrokeRenderer::setPenWidth); connect(quitBtn, &QAbstractButton::clicked, this, &PathStrokeControls::emitQuitSignal); connect(okBtn, &QAbstractButton::clicked, this, &PathStrokeControls::emitOkSignal); @@ -341,7 +314,7 @@ PathStrokeWidget::PathStrokeWidget(bool smallScreen) connect(m_renderer, &PathStrokeRenderer::clicked, this, &PathStrokeWidget::showControls); connect(m_controls, &PathStrokeControls::okPressed, this, &PathStrokeWidget::hideControls); - connect(m_controls, SIGNAL(quitPressed()), QApplication::instance(), SLOT(quit())); + connect(m_controls, &PathStrokeControls::quitPressed, QApplication::instance(), &QApplication::quit); } void PathStrokeWidget::showControls() |