summaryrefslogtreecommitdiffstats
path: root/examples/widgets/widgets/validators
diff options
context:
space:
mode:
Diffstat (limited to 'examples/widgets/widgets/validators')
-rw-r--r--examples/widgets/widgets/validators/CMakeLists.txt54
-rw-r--r--examples/widgets/widgets/validators/ledoff.pngbin562 -> 0 bytes
-rw-r--r--examples/widgets/widgets/validators/ledon.pngbin486 -> 0 bytes
-rw-r--r--examples/widgets/widgets/validators/ledwidget.cpp72
-rw-r--r--examples/widgets/widgets/validators/ledwidget.h74
-rw-r--r--examples/widgets/widgets/validators/localeselector.cpp95
-rw-r--r--examples/widgets/widgets/validators/localeselector.h70
-rw-r--r--examples/widgets/widgets/validators/main.cpp65
-rw-r--r--examples/widgets/widgets/validators/validators.pro12
-rw-r--r--examples/widgets/widgets/validators/validators.qrc6
-rw-r--r--examples/widgets/widgets/validators/validators.ui468
-rw-r--r--examples/widgets/widgets/validators/validatorwidget.cpp122
-rw-r--r--examples/widgets/widgets/validators/validatorwidget.h64
13 files changed, 0 insertions, 1102 deletions
diff --git a/examples/widgets/widgets/validators/CMakeLists.txt b/examples/widgets/widgets/validators/CMakeLists.txt
deleted file mode 100644
index 0151d68d0e..0000000000
--- a/examples/widgets/widgets/validators/CMakeLists.txt
+++ /dev/null
@@ -1,54 +0,0 @@
-cmake_minimum_required(VERSION 3.16)
-project(validators 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/widgets/validators")
-
-find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
-
-qt_add_executable(validators
- ledwidget.cpp ledwidget.h
- localeselector.cpp localeselector.h
- main.cpp
- validators.ui
- validatorwidget.cpp validatorwidget.h
-)
-
-set_target_properties(validators PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-
-target_link_libraries(validators PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
-)
-
-# Resources:
-set(validators_resource_files
- "ledoff.png"
- "ledon.png"
-)
-
-qt_add_resources(validators "validators"
- PREFIX
- "/"
- FILES
- ${validators_resource_files}
-)
-
-install(TARGETS validators
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/widgets/widgets/validators/ledoff.png b/examples/widgets/widgets/validators/ledoff.png
deleted file mode 100644
index 8b1f2ed123..0000000000
--- a/examples/widgets/widgets/validators/ledoff.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/widgets/validators/ledon.png b/examples/widgets/widgets/validators/ledon.png
deleted file mode 100644
index 601c34d5a8..0000000000
--- a/examples/widgets/widgets/validators/ledon.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/widgets/validators/ledwidget.cpp b/examples/widgets/widgets/validators/ledwidget.cpp
deleted file mode 100644
index 462f416c86..0000000000
--- a/examples/widgets/widgets/validators/ledwidget.cpp
+++ /dev/null
@@ -1,72 +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 "ledwidget.h"
-
-LEDWidget::LEDWidget(QWidget *parent)
- : QLabel(parent), onPixmap(":/ledon.png"), offPixmap(":/ledoff.png")
-{
- setPixmap(offPixmap);
- flashTimer.setInterval(200);
- flashTimer.setSingleShot(true);
- connect(&flashTimer, &QTimer::timeout, this, &LEDWidget::extinguish);
-};
-
-void LEDWidget::extinguish()
-{
- setPixmap(offPixmap);
-}
-
-void LEDWidget::flash()
-{
- setPixmap(onPixmap);
- flashTimer.start();
-}
-
diff --git a/examples/widgets/widgets/validators/ledwidget.h b/examples/widgets/widgets/validators/ledwidget.h
deleted file mode 100644
index c4b406db23..0000000000
--- a/examples/widgets/widgets/validators/ledwidget.h
+++ /dev/null
@@ -1,74 +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 LEDWIDGET_H
-#define LEDWIDGET_H
-
-#include <QLabel>
-#include <QPixmap>
-#include <QTimer>
-
-class LEDWidget : public QLabel
-{
- Q_OBJECT
-public:
- LEDWidget(QWidget *parent = nullptr);
-public slots:
- void flash();
-
-private slots:
- void extinguish();
-
-private:
- QPixmap onPixmap, offPixmap;
- QTimer flashTimer;
-};
-
-#endif // LEDWIDGET_H
diff --git a/examples/widgets/widgets/validators/localeselector.cpp b/examples/widgets/widgets/validators/localeselector.cpp
deleted file mode 100644
index 3fdf5c6b3b..0000000000
--- a/examples/widgets/widgets/validators/localeselector.cpp
+++ /dev/null
@@ -1,95 +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 "localeselector.h"
-
-#include <QLocale>
-
-LocaleSelector::LocaleSelector(QWidget *parent)
- : QComboBox(parent)
-{
- int curIndex = -1;
- int index = 0;
- for (int _lang = QLocale::C; _lang <= QLocale::LastLanguage; ++_lang) {
- QLocale::Language lang = static_cast<QLocale::Language>(_lang);
- const QList<QLocale> locales =
- QLocale::matchingLocales(lang, QLocale::AnyScript, QLocale::AnyTerritory);
- for (const QLocale &l : locales) {
- QString label = QLocale::languageToString(l.language());
- label += QLatin1Char('/');
- label += QLocale::territoryToString(l.territory());
- // distinguish locales by script, if there are more than one script for a language/territory pair
- if (QLocale::matchingLocales(l.language(), QLocale::AnyScript, l.territory()).size() > 1)
- label += QLatin1String(" (") + QLocale::scriptToString(l.script()) + QLatin1Char(')');
-
- addItem(label, QVariant::fromValue(l));
-
- if (l.language() == locale().language() && l.territory() == locale().territory()
- && (locale().script() == QLocale::AnyScript || l.script() == locale().script())) {
- curIndex = index;
- }
- ++index;
- }
- }
- if (curIndex != -1)
- setCurrentIndex(curIndex);
-
- connect(this, QOverload<int>::of(&LocaleSelector::activated),
- this, &LocaleSelector::emitLocaleSelected);
-}
-
-void LocaleSelector::emitLocaleSelected(int index)
-{
- QVariant v = itemData(index);
- if (!v.isValid())
- return;
- const QLocale l = qvariant_cast<QLocale>(v);
- emit localeSelected(l);
-}
diff --git a/examples/widgets/widgets/validators/localeselector.h b/examples/widgets/widgets/validators/localeselector.h
deleted file mode 100644
index 611e2da66e..0000000000
--- a/examples/widgets/widgets/validators/localeselector.h
+++ /dev/null
@@ -1,70 +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 LOCALESELECTOR_H
-#define LOCALESELECTOR_H
-
-#include <QComboBox>
-
-class LocaleSelector : public QComboBox
-{
- Q_OBJECT
-
-public:
- LocaleSelector(QWidget *parent = nullptr);
-
-signals:
- void localeSelected(const QLocale &locale);
-
-private slots:
- void emitLocaleSelected(int index);
-};
-
-#endif //LOCALESELECTOR_H
diff --git a/examples/widgets/widgets/validators/main.cpp b/examples/widgets/widgets/validators/main.cpp
deleted file mode 100644
index 1fbf12410d..0000000000
--- a/examples/widgets/widgets/validators/main.cpp
+++ /dev/null
@@ -1,65 +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 "validatorwidget.h"
-
-#include <QApplication>
-
-int main(int argc, char **argv)
-{
- Q_INIT_RESOURCE(validators);
-
- QApplication app(argc, argv);
-
- ValidatorWidget w;
- w.show();
-
- return app.exec();
-}
diff --git a/examples/widgets/widgets/validators/validators.pro b/examples/widgets/widgets/validators/validators.pro
deleted file mode 100644
index 029cf95aca..0000000000
--- a/examples/widgets/widgets/validators/validators.pro
+++ /dev/null
@@ -1,12 +0,0 @@
-QT += widgets
-requires(qtConfig(combobox))
-
-FORMS += validators.ui
-RESOURCES += validators.qrc
-
-SOURCES += main.cpp ledwidget.cpp localeselector.cpp validatorwidget.cpp
-HEADERS += ledwidget.h localeselector.h validatorwidget.h
-
-# install
-target.path = $$[QT_INSTALL_EXAMPLES]/widgets/widgets/validators
-INSTALLS += target
diff --git a/examples/widgets/widgets/validators/validators.qrc b/examples/widgets/widgets/validators/validators.qrc
deleted file mode 100644
index 94874317a8..0000000000
--- a/examples/widgets/widgets/validators/validators.qrc
+++ /dev/null
@@ -1,6 +0,0 @@
-<RCC>
- <qresource prefix="/" >
- <file>ledoff.png</file>
- <file>ledon.png</file>
- </qresource>
-</RCC>
diff --git a/examples/widgets/widgets/validators/validators.ui b/examples/widgets/widgets/validators/validators.ui
deleted file mode 100644
index cd984e6b97..0000000000
--- a/examples/widgets/widgets/validators/validators.ui
+++ /dev/null
@@ -1,468 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>ValidatorsForm</class>
- <widget class="QWidget" name="ValidatorsForm">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>526</width>
- <height>443</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Validators</string>
- </property>
- <layout class="QVBoxLayout">
- <property name="spacing">
- <number>6</number>
- </property>
- <property name="margin">
- <number>9</number>
- </property>
- <item>
- <layout class="QHBoxLayout">
- <property name="spacing">
- <number>6</number>
- </property>
- <property name="margin">
- <number>0</number>
- </property>
- <item>
- <widget class="LocaleSelector" name="localeSelector"/>
- </item>
- <item>
- <spacer>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QGroupBox" name="groupBox">
- <property name="title">
- <string>QIntValidator</string>
- </property>
- <layout class="QVBoxLayout">
- <property name="spacing">
- <number>6</number>
- </property>
- <property name="margin">
- <number>9</number>
- </property>
- <item>
- <layout class="QHBoxLayout">
- <property name="spacing">
- <number>6</number>
- </property>
- <property name="margin">
- <number>0</number>
- </property>
- <item>
- <layout class="QGridLayout">
- <property name="margin">
- <number>0</number>
- </property>
- <property name="spacing">
- <number>6</number>
- </property>
- <item row="0" column="0">
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Min:</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QSpinBox" name="minVal">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
- <horstretch>1</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimum">
- <number>-1000000</number>
- </property>
- <property name="maximum">
- <number>1000000</number>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>Max:</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QSpinBox" name="maxVal">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
- <horstretch>1</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimum">
- <number>-1000000</number>
- </property>
- <property name="maximum">
- <number>1000000</number>
- </property>
- <property name="value">
- <number>1000</number>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QFrame" name="frame">
- <property name="frameShape">
- <enum>QFrame::StyledPanel</enum>
- </property>
- <property name="frameShadow">
- <enum>QFrame::Sunken</enum>
- </property>
- <layout class="QVBoxLayout">
- <property name="spacing">
- <number>6</number>
- </property>
- <property name="margin">
- <number>9</number>
- </property>
- <item>
- <widget class="LEDWidget" name="ledWidget">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="pixmap">
- <pixmap resource="validators.qrc">:/ledoff.png</pixmap>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="label_7">
- <property name="text">
- <string>editingFinished()</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <spacer>
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Fixed</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QLineEdit" name="editor"/>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="groupBox_2">
- <property name="title">
- <string>QDoubleValidator</string>
- </property>
- <layout class="QVBoxLayout">
- <property name="spacing">
- <number>6</number>
- </property>
- <property name="margin">
- <number>9</number>
- </property>
- <item>
- <layout class="QHBoxLayout">
- <property name="spacing">
- <number>6</number>
- </property>
- <property name="margin">
- <number>0</number>
- </property>
- <item>
- <layout class="QGridLayout">
- <property name="margin">
- <number>0</number>
- </property>
- <property name="spacing">
- <number>6</number>
- </property>
- <item row="0" column="0">
- <widget class="QLabel" name="label_3">
- <property name="text">
- <string>Min:</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QDoubleSpinBox" name="doubleMinVal">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
- <horstretch>1</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimum">
- <double>-100000.000000000000000</double>
- </property>
- <property name="maximum">
- <double>100000.000000000000000</double>
- </property>
- <property name="value">
- <double>0.000000000000000</double>
- </property>
- </widget>
- </item>
- <item row="0" column="2">
- <widget class="QLabel" name="label_5">
- <property name="text">
- <string>Format:</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="0" column="3">
- <widget class="QComboBox" name="doubleFormat">
- <item>
- <property name="text">
- <string>Standard</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Scientific</string>
- </property>
- </item>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_4">
- <property name="text">
- <string>Max:</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QDoubleSpinBox" name="doubleMaxVal">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
- <horstretch>1</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimum">
- <double>-100000.000000000000000</double>
- </property>
- <property name="maximum">
- <double>100000.000000000000000</double>
- </property>
- <property name="value">
- <double>1000.000000000000000</double>
- </property>
- </widget>
- </item>
- <item row="1" column="2">
- <widget class="QLabel" name="label_6">
- <property name="text">
- <string>Decimals:</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="1" column="3">
- <widget class="QSpinBox" name="doubleDecimals">
- <property name="value">
- <number>2</number>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QFrame" name="frame_2">
- <property name="frameShape">
- <enum>QFrame::StyledPanel</enum>
- </property>
- <property name="frameShadow">
- <enum>QFrame::Sunken</enum>
- </property>
- <layout class="QVBoxLayout">
- <property name="spacing">
- <number>6</number>
- </property>
- <property name="margin">
- <number>9</number>
- </property>
- <item>
- <widget class="LEDWidget" name="doubleLedWidget">
- <property name="text">
- <string/>
- </property>
- <property name="pixmap">
- <pixmap resource="validators.qrc">:/ledoff.png</pixmap>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="label_8">
- <property name="text">
- <string>editingFinished()</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <spacer>
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Fixed</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QLineEdit" name="doubleEditor"/>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <spacer>
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>111</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <layout class="QHBoxLayout">
- <property name="spacing">
- <number>6</number>
- </property>
- <property name="margin">
- <number>0</number>
- </property>
- <item>
- <spacer>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QPushButton" name="pushButton">
- <property name="text">
- <string>Quit</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <customwidgets>
- <customwidget>
- <class>LEDWidget</class>
- <extends>QLabel</extends>
- <header>ledwidget.h</header>
- </customwidget>
- <customwidget>
- <class>LocaleSelector</class>
- <extends>QComboBox</extends>
- <header>localeselector.h</header>
- </customwidget>
- </customwidgets>
- <resources>
- <include location="validators.qrc"/>
- </resources>
- <connections>
- <connection>
- <sender>pushButton</sender>
- <signal>clicked()</signal>
- <receiver>ValidatorsForm</receiver>
- <slot>close()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>94</x>
- <y>274</y>
- </hint>
- <hint type="destinationlabel">
- <x>131</x>
- <y>260</y>
- </hint>
- </hints>
- </connection>
- </connections>
-</ui>
diff --git a/examples/widgets/widgets/validators/validatorwidget.cpp b/examples/widgets/widgets/validators/validatorwidget.cpp
deleted file mode 100644
index 504eec4fe7..0000000000
--- a/examples/widgets/widgets/validators/validatorwidget.cpp
+++ /dev/null
@@ -1,122 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 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 "validatorwidget.h"
-
-#include <QIntValidator>
-
-ValidatorWidget::ValidatorWidget(QWidget *parent)
- : QWidget(parent)
-{
- setupUi(this);
-
- connect(localeSelector, &LocaleSelector::localeSelected,
- this, &ValidatorWidget::setLocale);
- connect(localeSelector, &LocaleSelector::localeSelected,
- this, &ValidatorWidget::updateValidator);
- connect(localeSelector, &LocaleSelector::localeSelected,
- this, &ValidatorWidget::updateDoubleValidator);
-
- connect(minVal, &QSpinBox::editingFinished,
- this, &ValidatorWidget::updateValidator);
- connect(maxVal, &QSpinBox::editingFinished,
- this, &ValidatorWidget::updateValidator);
- connect(editor, &QLineEdit::editingFinished,
- ledWidget, &LEDWidget::flash);
-
- connect(doubleMaxVal, &QDoubleSpinBox::editingFinished,
- this, &ValidatorWidget::updateDoubleValidator);
- connect(doubleMinVal, &QDoubleSpinBox::editingFinished,
- this, &ValidatorWidget::updateDoubleValidator);
- connect(doubleDecimals, &QSpinBox::valueChanged,
- this, &ValidatorWidget::updateDoubleValidator);
- connect(doubleFormat, &QComboBox::activated,
- this, &ValidatorWidget::updateDoubleValidator);
- connect(doubleEditor, &QLineEdit::editingFinished,
- doubleLedWidget, &LEDWidget::flash);
-
- updateValidator();
- updateDoubleValidator();
-}
-
-void ValidatorWidget::updateValidator()
-{
- QIntValidator *v = new QIntValidator(minVal->value(), maxVal->value(), this);
- v->setLocale(locale());
- delete editor->validator();
- editor->setValidator(v);
-
- QString s = editor->text();
- int i = 0;
- if (v->validate(s, i) == QValidator::Invalid) {
- editor->clear();
- } else {
- editor->setText(s);
- }
-}
-
-void ValidatorWidget::updateDoubleValidator()
-{
- QDoubleValidator *v
- = new QDoubleValidator(doubleMinVal->value(), doubleMaxVal->value(),
- doubleDecimals->value(), this);
- v->setNotation(static_cast<QDoubleValidator::Notation>(doubleFormat->currentIndex()));
- v->setLocale(locale());
- delete doubleEditor->validator();
- doubleEditor->setValidator(v);
-
- QString s = doubleEditor->text();
- int i = 0;
- if (v->validate(s, i) == QValidator::Invalid) {
- doubleEditor->clear();
- } else {
- doubleEditor->setText(s);
- }
-}
diff --git a/examples/widgets/widgets/validators/validatorwidget.h b/examples/widgets/widgets/validators/validatorwidget.h
deleted file mode 100644
index bcc4a9b91e..0000000000
--- a/examples/widgets/widgets/validators/validatorwidget.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 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 <QWidget>
-
-#include "ui_validators.h"
-
-class ValidatorWidget : public QWidget, public Ui::ValidatorsForm
-{
- Q_OBJECT
-public:
- ValidatorWidget(QWidget *parent = nullptr);
-
-private slots:
- void updateValidator();
- void updateDoubleValidator();
-};