summaryrefslogtreecommitdiffstats
path: root/examples/widgets/itemviews/coloreditorfactory
diff options
context:
space:
mode:
Diffstat (limited to 'examples/widgets/itemviews/coloreditorfactory')
-rw-r--r--examples/widgets/itemviews/coloreditorfactory/CMakeLists.txt41
-rw-r--r--examples/widgets/itemviews/coloreditorfactory/coloreditorfactory.pro12
-rw-r--r--examples/widgets/itemviews/coloreditorfactory/colorlisteditor.cpp86
-rw-r--r--examples/widgets/itemviews/coloreditorfactory/colorlisteditor.h79
-rw-r--r--examples/widgets/itemviews/coloreditorfactory/main.cpp63
-rw-r--r--examples/widgets/itemviews/coloreditorfactory/window.cpp102
-rw-r--r--examples/widgets/itemviews/coloreditorfactory/window.h67
7 files changed, 0 insertions, 450 deletions
diff --git a/examples/widgets/itemviews/coloreditorfactory/CMakeLists.txt b/examples/widgets/itemviews/coloreditorfactory/CMakeLists.txt
deleted file mode 100644
index 478c61dec7..0000000000
--- a/examples/widgets/itemviews/coloreditorfactory/CMakeLists.txt
+++ /dev/null
@@ -1,41 +0,0 @@
-# Generated from coloreditorfactory.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(coloreditorfactory LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/itemviews/coloreditorfactory")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-
-qt_add_executable(coloreditorfactory
- colorlisteditor.cpp colorlisteditor.h
- main.cpp
- window.cpp window.h
-)
-set_target_properties(coloreditorfactory PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(coloreditorfactory PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
-)
-
-install(TARGETS coloreditorfactory
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/widgets/itemviews/coloreditorfactory/coloreditorfactory.pro b/examples/widgets/itemviews/coloreditorfactory/coloreditorfactory.pro
deleted file mode 100644
index 2d16ab5e2b..0000000000
--- a/examples/widgets/itemviews/coloreditorfactory/coloreditorfactory.pro
+++ /dev/null
@@ -1,12 +0,0 @@
-QT += widgets
-requires(qtConfig(combobox))
-
-HEADERS = colorlisteditor.h \
- window.h
-SOURCES = colorlisteditor.cpp \
- window.cpp \
- main.cpp
-
-# install
-target.path = $$[QT_INSTALL_EXAMPLES]/widgets/itemviews/coloreditorfactory
-INSTALLS += target
diff --git a/examples/widgets/itemviews/coloreditorfactory/colorlisteditor.cpp b/examples/widgets/itemviews/coloreditorfactory/colorlisteditor.cpp
deleted file mode 100644
index 0b65c53477..0000000000
--- a/examples/widgets/itemviews/coloreditorfactory/colorlisteditor.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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 "colorlisteditor.h"
-
-#include <QtWidgets>
-
-ColorListEditor::ColorListEditor(QWidget *widget) : QComboBox(widget)
-{
- populateList();
-}
-
-//! [0]
-QColor ColorListEditor::color() const
-{
- return qvariant_cast<QColor>(itemData(currentIndex(), Qt::DecorationRole));
-}
-//! [0]
-
-//! [1]
-void ColorListEditor::setColor(const QColor &color)
-{
- setCurrentIndex(findData(color, Qt::DecorationRole));
-}
-//! [1]
-
-//! [2]
-void ColorListEditor::populateList()
-{
- const QStringList colorNames = QColor::colorNames();
-
- for (int i = 0; i < colorNames.size(); ++i) {
- QColor color(colorNames[i]);
-
- insertItem(i, colorNames[i]);
- setItemData(i, color, Qt::DecorationRole);
- }
-}
-//! [2]
diff --git a/examples/widgets/itemviews/coloreditorfactory/colorlisteditor.h b/examples/widgets/itemviews/coloreditorfactory/colorlisteditor.h
deleted file mode 100644
index f9d736d298..0000000000
--- a/examples/widgets/itemviews/coloreditorfactory/colorlisteditor.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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 COLORLISTEDITOR_H
-#define COLORLISTEDITOR_H
-
-#include <QComboBox>
-
-QT_BEGIN_NAMESPACE
-class QColor;
-class QWidget;
-QT_END_NAMESPACE
-
-//! [0]
-class ColorListEditor : public QComboBox
-{
- Q_OBJECT
- Q_PROPERTY(QColor color READ color WRITE setColor USER true)
-
-public:
- ColorListEditor(QWidget *widget = nullptr);
-
-public:
- QColor color() const;
- void setColor(const QColor &color);
-
-private:
- void populateList();
-};
-//! [0]
-
-#endif
diff --git a/examples/widgets/itemviews/coloreditorfactory/main.cpp b/examples/widgets/itemviews/coloreditorfactory/main.cpp
deleted file mode 100644
index d712abc010..0000000000
--- a/examples/widgets/itemviews/coloreditorfactory/main.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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 <QtWidgets>
-
-#include "window.h"
-
-int main(int argv, char **args)
-{
- QApplication app(argv, args);
-
- Window window;
- window.show();
-
- return app.exec();
-}
diff --git a/examples/widgets/itemviews/coloreditorfactory/window.cpp b/examples/widgets/itemviews/coloreditorfactory/window.cpp
deleted file mode 100644
index fde82accfd..0000000000
--- a/examples/widgets/itemviews/coloreditorfactory/window.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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 "window.h"
-#include "colorlisteditor.h"
-
-#include <QtWidgets>
-
-//! [0]
-Window::Window()
-{
- QItemEditorFactory *factory = new QItemEditorFactory;
-
- QItemEditorCreatorBase *colorListCreator =
- new QStandardItemEditorCreator<ColorListEditor>();
-
- factory->registerEditor(QMetaType::QColor, colorListCreator);
-
- QItemEditorFactory::setDefaultFactory(factory);
-
- createGUI();
-}
-//! [0]
-
-void Window::createGUI()
-{
- const QList<QPair<QString, QColor>> list = { { tr("Alice"), QColor("aliceblue") },
- { tr("Neptun"), QColor("aquamarine") },
- { tr("Ferdinand"), QColor("springgreen") } };
-
- QTableWidget *table = new QTableWidget(3, 2);
- table->setHorizontalHeaderLabels({ tr("Name"), tr("Hair Color") });
- table->verticalHeader()->setVisible(false);
- table->resize(150, 50);
-
- for (int i = 0; i < 3; ++i) {
- const QPair<QString, QColor> &pair = list.at(i);
-
- QTableWidgetItem *nameItem = new QTableWidgetItem(pair.first);
- QTableWidgetItem *colorItem = new QTableWidgetItem;
- colorItem->setData(Qt::DisplayRole, pair.second);
-
- table->setItem(i, 0, nameItem);
- table->setItem(i, 1, colorItem);
- }
- table->resizeColumnToContents(0);
- table->horizontalHeader()->setStretchLastSection(true);
-
- QGridLayout *layout = new QGridLayout;
- layout->addWidget(table, 0, 0);
-
- setLayout(layout);
-
- setWindowTitle(tr("Color Editor Factory"));
-}
diff --git a/examples/widgets/itemviews/coloreditorfactory/window.h b/examples/widgets/itemviews/coloreditorfactory/window.h
deleted file mode 100644
index 59c97673b7..0000000000
--- a/examples/widgets/itemviews/coloreditorfactory/window.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples 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 WINDOW_H
-#define WINDOW_H
-
-#include <QWidget>
-
-class Window : public QWidget
-{
- Q_OBJECT
-
-public:
- Window();
-
-private:
- void createGUI();
-};
-
-#endif