diff options
Diffstat (limited to 'examples/widgets/graphicsview/chip')
-rw-r--r-- | examples/widgets/graphicsview/chip/.prev_CMakeLists.txt | 58 | ||||
-rw-r--r-- | examples/widgets/graphicsview/chip/CMakeLists.txt | 60 | ||||
-rw-r--r-- | examples/widgets/graphicsview/chip/chip.pro | 1 | ||||
-rw-r--r-- | examples/widgets/graphicsview/chip/view.cpp | 21 | ||||
-rw-r--r-- | examples/widgets/graphicsview/chip/view.h | 2 |
5 files changed, 118 insertions, 24 deletions
diff --git a/examples/widgets/graphicsview/chip/.prev_CMakeLists.txt b/examples/widgets/graphicsview/chip/.prev_CMakeLists.txt new file mode 100644 index 0000000000..b82c3eced8 --- /dev/null +++ b/examples/widgets/graphicsview/chip/.prev_CMakeLists.txt @@ -0,0 +1,58 @@ +# Generated from chip.pro. + +cmake_minimum_required(VERSION 3.14) +project(chip LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/widgets/graphicsview/chip") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Widgets) + +add_qt_gui_executable(chip + chip.cpp chip.h + main.cpp + mainwindow.cpp mainwindow.h + view.cpp view.h +) +target_link_libraries(chip PUBLIC + Qt::Core + Qt::Gui + Qt::Widgets +) + + +# Resources: +set(images_resource_files + "fileprint.png" + "qt4logo.png" + "rotateleft.png" + "rotateright.png" + "zoomin.png" + "zoomout.png" +) + +qt6_add_resources(chip "images" + PREFIX + "/" + FILES + ${images_resource_files} +) + +if(TARGET Qt::PrintSupport) + target_link_libraries(chip PUBLIC + Qt::PrintSupport + ) +endif() + +install(TARGETS chip + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/widgets/graphicsview/chip/CMakeLists.txt b/examples/widgets/graphicsview/chip/CMakeLists.txt new file mode 100644 index 0000000000..41af2553ee --- /dev/null +++ b/examples/widgets/graphicsview/chip/CMakeLists.txt @@ -0,0 +1,60 @@ +# Generated from chip.pro. + +cmake_minimum_required(VERSION 3.14) +project(chip LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(INSTALL_EXAMPLEDIR "examples/widgets/graphicsview/chip") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Widgets) +find_package(Qt6 COMPONENTS OpenGL) # special case +find_package(Qt6 COMPONENTS PrintSupport) # special case + +add_qt_gui_executable(chip + chip.cpp chip.h + main.cpp + mainwindow.cpp mainwindow.h + view.cpp view.h +) +target_link_libraries(chip PUBLIC + Qt::Core + Qt::Gui + Qt::Widgets +) + + +# Resources: +set(images_resource_files + "fileprint.png" + "qt4logo.png" + "rotateleft.png" + "rotateright.png" + "zoomin.png" + "zoomout.png" +) + +qt6_add_resources(chip "images" + PREFIX + "/" + FILES + ${images_resource_files} +) + +if(TARGET Qt::PrintSupport) + target_link_libraries(chip PUBLIC + Qt::PrintSupport + ) +endif() + +install(TARGETS chip + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/examples/widgets/graphicsview/chip/chip.pro b/examples/widgets/graphicsview/chip/chip.pro index a46f07ce35..508928d026 100644 --- a/examples/widgets/graphicsview/chip/chip.pro +++ b/examples/widgets/graphicsview/chip/chip.pro @@ -6,7 +6,6 @@ SOURCES += mainwindow.cpp view.cpp chip.cpp QT += widgets qtHaveModule(printsupport): QT += printsupport -qtHaveModule(opengl): QT += opengl build_all:!build_pass { CONFIG -= build_all diff --git a/examples/widgets/graphicsview/chip/view.cpp b/examples/widgets/graphicsview/chip/view.cpp index 3b1718bdbd..186b24655b 100644 --- a/examples/widgets/graphicsview/chip/view.cpp +++ b/examples/widgets/graphicsview/chip/view.cpp @@ -57,11 +57,7 @@ #include <QPrintDialog> #endif #endif -#ifndef QT_NO_OPENGL -#include <QtOpenGL> -#else #include <QtWidgets> -#endif #include <QtMath> #if QT_CONFIG(wheelevent) @@ -156,14 +152,6 @@ View::View(const QString &name, QWidget *parent) antialiasButton->setText(tr("Antialiasing")); antialiasButton->setCheckable(true); antialiasButton->setChecked(false); - openGlButton = new QToolButton; - openGlButton->setText(tr("OpenGL")); - openGlButton->setCheckable(true); -#ifndef QT_NO_OPENGL - openGlButton->setEnabled(QGLFormat::hasOpenGL()); -#else - openGlButton->setEnabled(false); -#endif printButton = new QToolButton; printButton->setIcon(QIcon(QPixmap(":/fileprint.png"))); @@ -179,7 +167,6 @@ View::View(const QString &name, QWidget *parent) labelLayout->addWidget(dragModeButton); labelLayout->addStretch(); labelLayout->addWidget(antialiasButton); - labelLayout->addWidget(openGlButton); labelLayout->addWidget(printButton); QGridLayout *topLayout = new QGridLayout; @@ -200,7 +187,6 @@ View::View(const QString &name, QWidget *parent) connect(selectModeButton, &QAbstractButton::toggled, this, &View::togglePointerMode); connect(dragModeButton, &QAbstractButton::toggled, this, &View::togglePointerMode); connect(antialiasButton, &QAbstractButton::toggled, this, &View::toggleAntialiasing); - connect(openGlButton, &QAbstractButton::toggled, this, &View::toggleOpenGL); connect(rotateLeftIcon, &QAbstractButton::clicked, this, &View::rotateLeft); connect(rotateRightIcon, &QAbstractButton::clicked, this, &View::rotateRight); connect(zoomInIcon, &QAbstractButton::clicked, this, &View::zoomIn); @@ -250,13 +236,6 @@ void View::togglePointerMode() graphicsView->setInteractive(selectModeButton->isChecked()); } -void View::toggleOpenGL() -{ -#ifndef QT_NO_OPENGL - graphicsView->setViewport(openGlButton->isChecked() ? new QGLWidget(QGLFormat(QGL::SampleBuffers)) : new QWidget); -#endif -} - void View::toggleAntialiasing() { graphicsView->setRenderHint(QPainter::Antialiasing, antialiasButton->isChecked()); diff --git a/examples/widgets/graphicsview/chip/view.h b/examples/widgets/graphicsview/chip/view.h index ea7bd414f5..b780702c34 100644 --- a/examples/widgets/graphicsview/chip/view.h +++ b/examples/widgets/graphicsview/chip/view.h @@ -94,7 +94,6 @@ private slots: void setResetButtonEnabled(); void setupMatrix(); void togglePointerMode(); - void toggleOpenGL(); void toggleAntialiasing(); void print(); void rotateLeft(); @@ -106,7 +105,6 @@ private: QLabel *label2; QToolButton *selectModeButton; QToolButton *dragModeButton; - QToolButton *openGlButton; QToolButton *antialiasButton; QToolButton *printButton; QToolButton *resetButton; |