summaryrefslogtreecommitdiffstats
path: root/examples/widgets/itemviews/interview
diff options
context:
space:
mode:
Diffstat (limited to 'examples/widgets/itemviews/interview')
-rw-r--r--examples/widgets/itemviews/interview/CMakeLists.txt48
-rw-r--r--examples/widgets/itemviews/interview/README2
-rw-r--r--examples/widgets/itemviews/interview/images/folder.pngbin3910 -> 0 bytes
-rw-r--r--examples/widgets/itemviews/interview/images/interview.pngbin174 -> 0 bytes
-rw-r--r--examples/widgets/itemviews/interview/images/services.pngbin3749 -> 0 bytes
-rw-r--r--examples/widgets/itemviews/interview/interview.pro16
-rw-r--r--examples/widgets/itemviews/interview/interview.qrc7
-rw-r--r--examples/widgets/itemviews/interview/main.cpp104
-rw-r--r--examples/widgets/itemviews/interview/model.cpp157
-rw-r--r--examples/widgets/itemviews/interview/model.h100
10 files changed, 0 insertions, 434 deletions
diff --git a/examples/widgets/itemviews/interview/CMakeLists.txt b/examples/widgets/itemviews/interview/CMakeLists.txt
deleted file mode 100644
index 610db3972d..0000000000
--- a/examples/widgets/itemviews/interview/CMakeLists.txt
+++ /dev/null
@@ -1,48 +0,0 @@
-cmake_minimum_required(VERSION 3.16)
-project(interview LANGUAGES CXX)
-
-set(CMAKE_AUTOMOC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/itemviews/interview")
-
-find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
-
-qt_add_executable(interview
- main.cpp
- model.cpp model.h
-)
-
-set_target_properties(interview PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-
-target_link_libraries(interview PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
-)
-
-# Resources:
-set(interview_resource_files
- "images/folder.png"
- "images/interview.png"
- "images/services.png"
-)
-
-qt_add_resources(interview "interview"
- PREFIX
- "/"
- FILES
- ${interview_resource_files}
-)
-
-install(TARGETS interview
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/widgets/itemviews/interview/README b/examples/widgets/itemviews/interview/README
deleted file mode 100644
index 50894428f6..0000000000
--- a/examples/widgets/itemviews/interview/README
+++ /dev/null
@@ -1,2 +0,0 @@
-The interview example shows the same model and selection being shared
-between three different views.
diff --git a/examples/widgets/itemviews/interview/images/folder.png b/examples/widgets/itemviews/interview/images/folder.png
deleted file mode 100644
index 589fd2df59..0000000000
--- a/examples/widgets/itemviews/interview/images/folder.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/itemviews/interview/images/interview.png b/examples/widgets/itemviews/interview/images/interview.png
deleted file mode 100644
index 0c3d690258..0000000000
--- a/examples/widgets/itemviews/interview/images/interview.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/itemviews/interview/images/services.png b/examples/widgets/itemviews/interview/images/services.png
deleted file mode 100644
index 6b2ad969d4..0000000000
--- a/examples/widgets/itemviews/interview/images/services.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/itemviews/interview/interview.pro b/examples/widgets/itemviews/interview/interview.pro
deleted file mode 100644
index 6d64f23eb9..0000000000
--- a/examples/widgets/itemviews/interview/interview.pro
+++ /dev/null
@@ -1,16 +0,0 @@
-TEMPLATE = app
-QT += widgets
-requires(qtConfig(treeview))
-
-HEADERS += model.h
-SOURCES += model.cpp main.cpp
-RESOURCES += interview.qrc
-
-build_all:!build_pass {
- CONFIG -= build_all
- CONFIG += release
-}
-
-# install
-target.path = $$[QT_INSTALL_EXAMPLES]/widgets/itemviews/interview
-INSTALLS += target
diff --git a/examples/widgets/itemviews/interview/interview.qrc b/examples/widgets/itemviews/interview/interview.qrc
deleted file mode 100644
index b28ea34d8a..0000000000
--- a/examples/widgets/itemviews/interview/interview.qrc
+++ /dev/null
@@ -1,7 +0,0 @@
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource prefix="/">
- <file>images/folder.png</file>
- <file>images/services.png</file>
- <file>images/interview.png</file>
-</qresource>
-</RCC>
diff --git a/examples/widgets/itemviews/interview/main.cpp b/examples/widgets/itemviews/interview/main.cpp
deleted file mode 100644
index 10cbc363c8..0000000000
--- a/examples/widgets/itemviews/interview/main.cpp
+++ /dev/null
@@ -1,104 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "model.h"
-
-#include <QApplication>
-#include <QHeaderView>
-#include <QListView>
-#include <QSplitter>
-#include <QTableView>
-#include <QTreeView>
-
-int main(int argc, char *argv[])
-{
- Q_INIT_RESOURCE(interview);
-
- QApplication app(argc, argv);
- QSplitter page;
-
- QAbstractItemModel *data = new Model(1000, 10, &page);
- QItemSelectionModel *selections = new QItemSelectionModel(data);
-
- QTableView *table = new QTableView;
- table->setModel(data);
- table->setSelectionModel(selections);
- table->horizontalHeader()->setSectionsMovable(true);
- table->verticalHeader()->setSectionsMovable(true);
- // Set StaticContents to enable minimal repaints on resizes.
- table->viewport()->setAttribute(Qt::WA_StaticContents);
- page.addWidget(table);
-
- QTreeView *tree = new QTreeView;
- tree->setModel(data);
- tree->setSelectionModel(selections);
- tree->setUniformRowHeights(true);
- tree->header()->setStretchLastSection(false);
- tree->viewport()->setAttribute(Qt::WA_StaticContents);
- // Disable the focus rect to get minimal repaints when scrolling on Mac.
- tree->setAttribute(Qt::WA_MacShowFocusRect, false);
- page.addWidget(tree);
-
- QListView *list = new QListView;
- list->setModel(data);
- list->setSelectionModel(selections);
- list->setViewMode(QListView::IconMode);
- list->setSelectionMode(QAbstractItemView::ExtendedSelection);
- list->setAlternatingRowColors(false);
- list->viewport()->setAttribute(Qt::WA_StaticContents);
- list->setAttribute(Qt::WA_MacShowFocusRect, false);
- page.addWidget(list);
-
- page.setWindowIcon(QPixmap(":/images/interview.png"));
- page.setWindowTitle("Interview");
- page.show();
-
- return app.exec();
-}
diff --git a/examples/widgets/itemviews/interview/model.cpp b/examples/widgets/itemviews/interview/model.cpp
deleted file mode 100644
index 5422757d95..0000000000
--- a/examples/widgets/itemviews/interview/model.cpp
+++ /dev/null
@@ -1,157 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "model.h"
-
-#include <QPixmap>
-
-Model::Model(int rows, int columns, QObject *parent)
- : QAbstractItemModel(parent),
- services(QPixmap(":/images/services.png")),
- rc(rows),
- cc(columns),
- tree(new QList<Node>(rows, Node()))
-{
-
-}
-
-Model::~Model()
-{
- delete tree;
-}
-
-QModelIndex Model::index(int row, int column, const QModelIndex &parent) const
-{
- if (row < rc && row >= 0 && column < cc && column >= 0) {
- Node *parentNode = static_cast<Node*>(parent.internalPointer());
- Node *childNode = node(row, parentNode);
- if (childNode)
- return createIndex(row, column, childNode);
- }
- return QModelIndex();
-}
-
-QModelIndex Model::parent(const QModelIndex &child) const
-{
- if (child.isValid()) {
- Node *childNode = static_cast<Node*>(child.internalPointer());
- Node *parentNode = parent(childNode);
- if (parentNode)
- return createIndex(row(parentNode), 0, parentNode);
- }
- return QModelIndex();
-}
-
-int Model::rowCount(const QModelIndex &parent) const
-{
- return (parent.isValid() && parent.column() != 0) ? 0 : rc;
-}
-
-int Model::columnCount(const QModelIndex &parent) const
-{
- Q_UNUSED(parent);
- return cc;
-}
-
-QVariant Model::data(const QModelIndex &index, int role) const
-{
- if (!index.isValid())
- return QVariant();
- if (role == Qt::DisplayRole)
- return QVariant("Item " + QString::number(index.row()) + ':' + QString::number(index.column()));
- if (role == Qt::DecorationRole) {
- if (index.column() == 0)
- return iconProvider.icon(QFileIconProvider::Folder);
- return iconProvider.icon(QFileIconProvider::File);
- }
- return QVariant();
-}
-
-QVariant Model::headerData(int section, Qt::Orientation orientation, int role) const
-{
- if (role == Qt::DisplayRole)
- return QString::number(section);
- if (role == Qt::DecorationRole)
- return QVariant::fromValue(services);
- return QAbstractItemModel::headerData(section, orientation, role);
-}
-
-bool Model::hasChildren(const QModelIndex &parent) const
-{
- if (parent.isValid() && parent.column() != 0)
- return false;
- return rc > 0 && cc > 0;
-}
-
-Qt::ItemFlags Model::flags(const QModelIndex &index) const
-{
- if (!index.isValid())
- return {};
- return Qt::ItemIsDragEnabled|QAbstractItemModel::flags(index);
-}
-
-Model::Node *Model::node(int row, Node *parent) const
-{
- if (parent && !parent->children)
- parent->children = new QList<Node>(rc, Node(parent));
- QList<Node> *v = parent ? parent->children : tree;
- return const_cast<Node*>(&(v->at(row)));
-}
-
-Model::Node *Model::parent(Node *child) const
-{
- return child ? child->parent : nullptr;
-}
-
-int Model::row(Node *node) const
-{
- const Node *first = node->parent ? &(node->parent->children->at(0)) : &(tree->at(0));
- return node - first;
-}
diff --git a/examples/widgets/itemviews/interview/model.h b/examples/widgets/itemviews/interview/model.h
deleted file mode 100644
index ee64a32f93..0000000000
--- a/examples/widgets/itemviews/interview/model.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the demonstration applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MODEL_H
-#define MODEL_H
-
-#include <QAbstractItemModel>
-#include <QFileIconProvider>
-#include <QIcon>
-#include <QList>
-
-class Model : public QAbstractItemModel
-{
- Q_OBJECT
-
-public:
- Model(int rows, int columns, QObject *parent = nullptr);
- ~Model();
-
- QModelIndex index(int row, int column, const QModelIndex &parent) const override;
- QModelIndex parent(const QModelIndex &child) const override;
-
- int rowCount(const QModelIndex &parent) const override;
- int columnCount(const QModelIndex &parent) const override;
-
- QVariant data(const QModelIndex &index, int role) const override;
- QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
-
- bool hasChildren(const QModelIndex &parent) const override;
- Qt::ItemFlags flags(const QModelIndex &index) const override;
-
-private:
-
- struct Node
- {
- Node(Node *parent = nullptr) : parent(parent), children(nullptr) {}
- ~Node() { delete children; }
- Node *parent;
- QList<Node> *children;
- };
-
- Node *node(int row, Node *parent) const;
- Node *parent(Node *child) const;
- int row(Node *node) const;
-
- QIcon services;
- int rc;
- int cc;
- QList<Node> *tree;
- QFileIconProvider iconProvider;
-};
-
-#endif // MODEL_H