From 2fda4cda22994466e3e1da028a7edeca657b4e7d Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Mon, 30 Mar 2020 12:10:22 +0200 Subject: Remove the regexp example Change-Id: I113a8f4c8ba401443aab2347211b3782e99c9cf4 Reviewed-by: Samuel Gaist --- examples/widgets/doc/src/regexp.qdoc | 38 ----- examples/widgets/tools/.prev_CMakeLists.txt | 18 +++ examples/widgets/tools/CMakeLists.txt | 1 - examples/widgets/tools/regexp/CMakeLists.txt | 32 ---- examples/widgets/tools/regexp/main.cpp | 61 -------- examples/widgets/tools/regexp/regexp.pro | 10 -- examples/widgets/tools/regexp/regexpdialog.cpp | 198 ------------------------- examples/widgets/tools/regexp/regexpdialog.h | 95 ------------ examples/widgets/tools/tools.pro | 1 - 9 files changed, 18 insertions(+), 436 deletions(-) delete mode 100644 examples/widgets/doc/src/regexp.qdoc create mode 100644 examples/widgets/tools/.prev_CMakeLists.txt delete mode 100644 examples/widgets/tools/regexp/CMakeLists.txt delete mode 100644 examples/widgets/tools/regexp/main.cpp delete mode 100644 examples/widgets/tools/regexp/regexp.pro delete mode 100644 examples/widgets/tools/regexp/regexpdialog.cpp delete mode 100644 examples/widgets/tools/regexp/regexpdialog.h (limited to 'examples/widgets') diff --git a/examples/widgets/doc/src/regexp.qdoc b/examples/widgets/doc/src/regexp.qdoc deleted file mode 100644 index f8e95c72a4..0000000000 --- a/examples/widgets/doc/src/regexp.qdoc +++ /dev/null @@ -1,38 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \example tools/regexp - \title Regular Expressions Example - \ingroup examples-widgets-tools - - \brief The Regular Expressions (RegExp) example shows how regular expressions in Qt are - applied to text by providing an environment in which new regular expressions can be - created and tested on custom text strings. - - \image regexp-example.png -*/ diff --git a/examples/widgets/tools/.prev_CMakeLists.txt b/examples/widgets/tools/.prev_CMakeLists.txt new file mode 100644 index 0000000000..d2fe6aa5ca --- /dev/null +++ b/examples/widgets/tools/.prev_CMakeLists.txt @@ -0,0 +1,18 @@ +# Generated from tools.pro. + +add_subdirectory(codecs) +add_subdirectory(completer) +add_subdirectory(customcompleter) +add_subdirectory(regularexpression) +add_subdirectory(settingseditor) +add_subdirectory(styleplugin) +add_subdirectory(treemodelcompleter) +add_subdirectory(undo) +add_subdirectory(undoframework) +if(QT_FEATURE_library) + add_subdirectory(echoplugin) + add_subdirectory(plugandpaint) +endif() +if(QT_FEATURE_translation) + add_subdirectory(i18n) +endif() diff --git a/examples/widgets/tools/CMakeLists.txt b/examples/widgets/tools/CMakeLists.txt index 042f751b0f..3346cafe09 100644 --- a/examples/widgets/tools/CMakeLists.txt +++ b/examples/widgets/tools/CMakeLists.txt @@ -6,7 +6,6 @@ add_subdirectory(customcompleter) if(QT_FEATURE_translation) # special case add_subdirectory(i18n) endif() -add_subdirectory(regexp) add_subdirectory(regularexpression) add_subdirectory(settingseditor) add_subdirectory(styleplugin) diff --git a/examples/widgets/tools/regexp/CMakeLists.txt b/examples/widgets/tools/regexp/CMakeLists.txt deleted file mode 100644 index 7c0ca31c39..0000000000 --- a/examples/widgets/tools/regexp/CMakeLists.txt +++ /dev/null @@ -1,32 +0,0 @@ -# Generated from regexp.pro. - -cmake_minimum_required(VERSION 3.14) -project(regexp 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/tools/regexp") - -find_package(Qt6 COMPONENTS Core) -find_package(Qt6 COMPONENTS Gui) -find_package(Qt6 COMPONENTS Widgets) - -add_qt_gui_executable(regexp - main.cpp - regexpdialog.cpp regexpdialog.h -) -target_link_libraries(regexp PUBLIC - Qt::Core - Qt::Gui - Qt::Widgets -) - -install(TARGETS regexp - RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" - BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" - LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" -) diff --git a/examples/widgets/tools/regexp/main.cpp b/examples/widgets/tools/regexp/main.cpp deleted file mode 100644 index cbab3c326e..0000000000 --- a/examples/widgets/tools/regexp/main.cpp +++ /dev/null @@ -1,61 +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 - -#include "regexpdialog.h" - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - RegExpDialog dialog; - dialog.show(); - return app.exec(); -} diff --git a/examples/widgets/tools/regexp/regexp.pro b/examples/widgets/tools/regexp/regexp.pro deleted file mode 100644 index a4c2971c25..0000000000 --- a/examples/widgets/tools/regexp/regexp.pro +++ /dev/null @@ -1,10 +0,0 @@ -QT += widgets -requires(qtConfig(combobox)) - -HEADERS = regexpdialog.h -SOURCES = regexpdialog.cpp \ - main.cpp - -# install -target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tools/regexp -INSTALLS += target diff --git a/examples/widgets/tools/regexp/regexpdialog.cpp b/examples/widgets/tools/regexp/regexpdialog.cpp deleted file mode 100644 index e70bb7a530..0000000000 --- a/examples/widgets/tools/regexp/regexpdialog.cpp +++ /dev/null @@ -1,198 +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 - -#include "regexpdialog.h" - -RegExpDialog::RegExpDialog(QWidget *parent) - : QDialog(parent) -{ - patternComboBox = new QComboBox; - patternComboBox->setEditable(true); - patternComboBox->setSizePolicy(QSizePolicy::Expanding, - QSizePolicy::Preferred); - - patternLabel = new QLabel(tr("&Pattern:")); - patternLabel->setBuddy(patternComboBox); - - escapedPatternLineEdit = new QLineEdit; - escapedPatternLineEdit->setReadOnly(true); - QPalette palette = escapedPatternLineEdit->palette(); - palette.setBrush(QPalette::Base, - palette.brush(QPalette::Disabled, QPalette::Base)); - escapedPatternLineEdit->setPalette(palette); - - escapedPatternLabel = new QLabel(tr("&Escaped Pattern:")); - escapedPatternLabel->setBuddy(escapedPatternLineEdit); - - syntaxComboBox = new QComboBox; - syntaxComboBox->addItem(tr("Regular expression v1"), QRegExp::RegExp); - syntaxComboBox->addItem(tr("Regular expression v2"), QRegExp::RegExp2); - syntaxComboBox->addItem(tr("Wildcard"), QRegExp::Wildcard); - syntaxComboBox->addItem(tr("Fixed string"), QRegExp::FixedString); - syntaxComboBox->addItem(tr("W3C Xml Schema 1.1"), QRegExp::W3CXmlSchema11); - - syntaxLabel = new QLabel(tr("&Pattern Syntax:")); - syntaxLabel->setBuddy(syntaxComboBox); - - textComboBox = new QComboBox; - textComboBox->setEditable(true); - textComboBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); - - textLabel = new QLabel(tr("&Text:")); - textLabel->setBuddy(textComboBox); - - caseSensitiveCheckBox = new QCheckBox(tr("Case &Sensitive")); - caseSensitiveCheckBox->setChecked(true); - minimalCheckBox = new QCheckBox(tr("&Minimal")); - - indexLabel = new QLabel(tr("Index of Match:")); - indexEdit = new QLineEdit; - indexEdit->setReadOnly(true); - - matchedLengthLabel = new QLabel(tr("Matched Length:")); - matchedLengthEdit = new QLineEdit; - matchedLengthEdit->setReadOnly(true); - - for (int i = 0; i < MaxCaptures; ++i) { - captureLabels[i] = new QLabel(tr("Capture %1:").arg(i)); - captureEdits[i] = new QLineEdit; - captureEdits[i]->setReadOnly(true); - } - captureLabels[0]->setText(tr("Match:")); - - QHBoxLayout *checkBoxLayout = new QHBoxLayout; - checkBoxLayout->addWidget(caseSensitiveCheckBox); - checkBoxLayout->addWidget(minimalCheckBox); - checkBoxLayout->addStretch(1); - - QGridLayout *mainLayout = new QGridLayout; - mainLayout->addWidget(patternLabel, 0, 0); - mainLayout->addWidget(patternComboBox, 0, 1); - mainLayout->addWidget(escapedPatternLabel, 1, 0); - mainLayout->addWidget(escapedPatternLineEdit, 1, 1); - mainLayout->addWidget(syntaxLabel, 2, 0); - mainLayout->addWidget(syntaxComboBox, 2, 1); - mainLayout->addLayout(checkBoxLayout, 3, 0, 1, 2); - mainLayout->addWidget(textLabel, 4, 0); - mainLayout->addWidget(textComboBox, 4, 1); - mainLayout->addWidget(indexLabel, 5, 0); - mainLayout->addWidget(indexEdit, 5, 1); - mainLayout->addWidget(matchedLengthLabel, 6, 0); - mainLayout->addWidget(matchedLengthEdit, 6, 1); - - for (int j = 0; j < MaxCaptures; ++j) { - mainLayout->addWidget(captureLabels[j], 7 + j, 0); - mainLayout->addWidget(captureEdits[j], 7 + j, 1); - } - setLayout(mainLayout); - - connect(patternComboBox, &QComboBox::editTextChanged, - this, &RegExpDialog::refresh); - connect(textComboBox, &QComboBox::editTextChanged, - this, &RegExpDialog::refresh); - connect(caseSensitiveCheckBox, &QAbstractButton::toggled, - this, &RegExpDialog::refresh); - connect(minimalCheckBox, &QAbstractButton::toggled, this, &RegExpDialog::refresh); - connect(syntaxComboBox, &QComboBox::currentIndexChanged, - this, &RegExpDialog::refresh); - - patternComboBox->addItem(tr("[A-Za-z_]+([A-Za-z_0-9]*)")); - textComboBox->addItem(tr("(10 + delta4) * 32")); - - setWindowTitle(tr("RegExp")); - setFixedHeight(sizeHint().height()); - refresh(); -} - -void RegExpDialog::refresh() -{ - setUpdatesEnabled(false); - - QString pattern = patternComboBox->currentText(); - QString text = textComboBox->currentText(); - - QString escaped = pattern; - escaped.replace("\\", "\\\\"); - escaped.replace("\"", "\\\""); - escaped.prepend('"'); - escaped.append('"'); - escapedPatternLineEdit->setText(escaped); - - QRegExp rx(pattern); - Qt::CaseSensitivity cs = Qt::CaseInsensitive; - if (caseSensitiveCheckBox->isChecked()) - cs = Qt::CaseSensitive; - rx.setCaseSensitivity(cs); - rx.setMinimal(minimalCheckBox->isChecked()); - QRegExp::PatternSyntax syntax = QRegExp::PatternSyntax( - syntaxComboBox->itemData(syntaxComboBox->currentIndex()).toInt()); - rx.setPatternSyntax(syntax); - - QPalette palette = patternComboBox->palette(); - if (rx.isValid()) { - palette.setColor(QPalette::Text, - textComboBox->palette().color(QPalette::Text)); - } else { - palette.setColor(QPalette::Text, Qt::red); - } - patternComboBox->setPalette(palette); - - indexEdit->setText(QString::number(rx.indexIn(text))); - matchedLengthEdit->setText(QString::number(rx.matchedLength())); - for (int i = 0; i < MaxCaptures; ++i) { - captureLabels[i]->setEnabled(i <= rx.captureCount()); - captureEdits[i]->setEnabled(i <= rx.captureCount()); - captureEdits[i]->setText(rx.cap(i)); - } - - setUpdatesEnabled(true); -} diff --git a/examples/widgets/tools/regexp/regexpdialog.h b/examples/widgets/tools/regexp/regexpdialog.h deleted file mode 100644 index 2f701a7228..0000000000 --- a/examples/widgets/tools/regexp/regexpdialog.h +++ /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$ -** -****************************************************************************/ - -#ifndef REGEXPDIALOG_H -#define REGEXPDIALOG_H - -#include - -QT_BEGIN_NAMESPACE -class QCheckBox; -class QComboBox; -class QLabel; -class QLineEdit; -QT_END_NAMESPACE - -class RegExpDialog : public QDialog -{ - Q_OBJECT - -public: - RegExpDialog(QWidget *parent = nullptr); - -private slots: - void refresh(); - -private: - QLabel *patternLabel; - QLabel *escapedPatternLabel; - QLabel *syntaxLabel; - QLabel *textLabel; - QComboBox *patternComboBox; - QLineEdit *escapedPatternLineEdit; - QComboBox *textComboBox; - QCheckBox *caseSensitiveCheckBox; - QCheckBox *minimalCheckBox; - QComboBox *syntaxComboBox; - - QLabel *indexLabel; - QLabel *matchedLengthLabel; - QLineEdit *indexEdit; - QLineEdit *matchedLengthEdit; - - enum { MaxCaptures = 6 }; - QLabel *captureLabels[MaxCaptures]; - QLineEdit *captureEdits[MaxCaptures]; -}; - -#endif diff --git a/examples/widgets/tools/tools.pro b/examples/widgets/tools/tools.pro index dd8401567b..0e572a632b 100644 --- a/examples/widgets/tools/tools.pro +++ b/examples/widgets/tools/tools.pro @@ -6,7 +6,6 @@ SUBDIRS = \ echoplugin \ i18n \ plugandpaint \ - regexp \ regularexpression \ settingseditor \ styleplugin \ -- cgit v1.2.3