diff options
Diffstat (limited to 'examples/tutorials/modelview')
38 files changed, 0 insertions, 1800 deletions
diff --git a/examples/tutorials/modelview/1_readonly/1_readonly.desktop b/examples/tutorials/modelview/1_readonly/1_readonly.desktop deleted file mode 100644 index 137f56eacd..0000000000 --- a/examples/tutorials/modelview/1_readonly/1_readonly.desktop +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Version=1.0 -Type=Application -Terminal=false -Name=1 Model View -Exec=/opt/usr/bin/1_readonly -Icon=1_readonly -X-Window-Icon= -X-HildonDesk-ShowInToolbar=true -X-Osso-Type=application/x-executable diff --git a/examples/tutorials/modelview/1_readonly/1_readonly.pro b/examples/tutorials/modelview/1_readonly/1_readonly.pro deleted file mode 100644 index d8b496030d..0000000000 --- a/examples/tutorials/modelview/1_readonly/1_readonly.pro +++ /dev/null @@ -1,19 +0,0 @@ -TARGET = mv_readonly - -TEMPLATE = app - -SOURCES += main.cpp \ - mymodel.cpp - -HEADERS += mymodel.h - - -# install -target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/modelview/1_readonly -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS 1_readonly.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/modelview/1_readonly -INSTALLS += target sources - -QT += widgets - -simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/tutorials/modelview/1_readonly/main.cpp b/examples/tutorials/modelview/1_readonly/main.cpp deleted file mode 100644 index 2b9a5c7a32..0000000000 --- a/examples/tutorials/modelview/1_readonly/main.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 Nokia Corporation and its Subsidiary(-ies) 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$ -** -****************************************************************************/ - -//! [Quoting ModelView Tutorial] -// main.cpp -#include <QtWidgets/QApplication> -#include <QtWidgets/QTableView> -#include "mymodel.h" - -int main(int argc, char *argv[]) -{ - QApplication a(argc, argv); - QTableView tableView; - MyModel myModel(0); - tableView.setModel( &myModel ); - tableView.show(); - return a.exec(); -} -//! [Quoting ModelView Tutorial] diff --git a/examples/tutorials/modelview/1_readonly/mymodel.cpp b/examples/tutorials/modelview/1_readonly/mymodel.cpp deleted file mode 100644 index 513c64d578..0000000000 --- a/examples/tutorials/modelview/1_readonly/mymodel.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 Nokia Corporation and its Subsidiary(-ies) 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$ -** -****************************************************************************/ - -//! [Quoting ModelView Tutorial] -// mymodel.cpp -#include "mymodel.h" - -MyModel::MyModel(QObject *parent) - :QAbstractTableModel(parent) -{ -} - -int MyModel::rowCount(const QModelIndex & /*parent*/) const -{ - return 2; -} - -int MyModel::columnCount(const QModelIndex & /*parent*/) const -{ - return 3; -} - -QVariant MyModel::data(const QModelIndex &index, int role) const -{ - if (role == Qt::DisplayRole) - { - return QString("Row%1, Column%2") - .arg(index.row() + 1) - .arg(index.column() +1); - } - return QVariant(); -} -//! [Quoting ModelView Tutorial] diff --git a/examples/tutorials/modelview/1_readonly/mymodel.h b/examples/tutorials/modelview/1_readonly/mymodel.h deleted file mode 100644 index b4ff23d9c7..0000000000 --- a/examples/tutorials/modelview/1_readonly/mymodel.h +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 Nokia Corporation and its Subsidiary(-ies) 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 MYMODEL_H -#define MYMODEL_H - -//! [Quoting ModelView Tutorial] -// mymodel.h -#include <QAbstractTableModel> - -class MyModel : public QAbstractTableModel -{ - Q_OBJECT -public: - MyModel(QObject *parent); - int rowCount(const QModelIndex &parent = QModelIndex()) const ; - int columnCount(const QModelIndex &parent = QModelIndex()) const; - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; -}; -//! [Quoting ModelView Tutorial] - -#endif // MYMODEL_H diff --git a/examples/tutorials/modelview/2_formatting/2_formatting.desktop b/examples/tutorials/modelview/2_formatting/2_formatting.desktop deleted file mode 100644 index a3950001ba..0000000000 --- a/examples/tutorials/modelview/2_formatting/2_formatting.desktop +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Version=1.0 -Type=Application -Terminal=false -Name=2 Model View -Exec=/opt/usr/bin/2_formatting -Icon=2_formatting -X-Window-Icon= -X-HildonDesk-ShowInToolbar=true -X-Osso-Type=application/x-executable diff --git a/examples/tutorials/modelview/2_formatting/2_formatting.pro b/examples/tutorials/modelview/2_formatting/2_formatting.pro deleted file mode 100644 index 2b567969de..0000000000 --- a/examples/tutorials/modelview/2_formatting/2_formatting.pro +++ /dev/null @@ -1,18 +0,0 @@ -TARGET = mv_formatting - -TEMPLATE = app - -SOURCES += main.cpp \ - mymodel.cpp - -HEADERS += mymodel.h - -# install -target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/modelview/2_formatting -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS 2_formatting.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/modelview/2_formatting -INSTALLS += target sources - -QT += widgets - -simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/tutorials/modelview/2_formatting/main.cpp b/examples/tutorials/modelview/2_formatting/main.cpp deleted file mode 100644 index 2b9a5c7a32..0000000000 --- a/examples/tutorials/modelview/2_formatting/main.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 Nokia Corporation and its Subsidiary(-ies) 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$ -** -****************************************************************************/ - -//! [Quoting ModelView Tutorial] -// main.cpp -#include <QtWidgets/QApplication> -#include <QtWidgets/QTableView> -#include "mymodel.h" - -int main(int argc, char *argv[]) -{ - QApplication a(argc, argv); - QTableView tableView; - MyModel myModel(0); - tableView.setModel( &myModel ); - tableView.show(); - return a.exec(); -} -//! [Quoting ModelView Tutorial] diff --git a/examples/tutorials/modelview/2_formatting/mymodel.cpp b/examples/tutorials/modelview/2_formatting/mymodel.cpp deleted file mode 100644 index 2ad4448e57..0000000000 --- a/examples/tutorials/modelview/2_formatting/mymodel.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 Nokia Corporation and its Subsidiary(-ies) 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 <QFont> -#include <QBrush> -#include "mymodel.h" -#include <QDebug> - -MyModel::MyModel(QObject *parent) - :QAbstractTableModel(parent) -{ -} - -int MyModel::rowCount(const QModelIndex & /*parent */) const -{ - return 2; -} - -int MyModel::columnCount(const QModelIndex & /*parent */) const -{ - return 3; -} - -//! [Quoting ModelView Tutorial] -// mymodel.cpp -QVariant MyModel::data(const QModelIndex &index, int role) const -{ - int row = index.row(); - int col = index.column(); - // generate a log message when this method gets called - qDebug() << QString("row %1, col%2, role %3") - .arg(row).arg(col).arg(role); - - switch(role){ - case Qt::DisplayRole: - if (row == 0 && col == 1) return QString("<--left"); - if (row == 1 && col == 1) return QString("right-->"); - - return QString("Row%1, Column%2") - .arg(row + 1) - .arg(col +1); - break; - case Qt::FontRole: - if (row == 0 && col == 0) //change font only for cell(0,0) - { - QFont boldFont; - boldFont.setBold(true); - return boldFont; - } - break; - case Qt::BackgroundRole: - - if (row == 1 && col == 2) //change background only for cell(1,2) - { - QBrush redBackground(Qt::red); - return redBackground; - } - break; - case Qt::TextAlignmentRole: - - if (row == 1 && col == 1) //change text alignment only for cell(1,1) - { - return Qt::AlignRight + Qt::AlignVCenter; - } - break; - case Qt::CheckStateRole: - - if (row == 1 && col == 0) //add a checkbox to cell(1,0) - { - return Qt::Checked; - } - } - return QVariant(); -} -//! [Quoting ModelView Tutorial] diff --git a/examples/tutorials/modelview/2_formatting/mymodel.h b/examples/tutorials/modelview/2_formatting/mymodel.h deleted file mode 100644 index d146f8c49d..0000000000 --- a/examples/tutorials/modelview/2_formatting/mymodel.h +++ /dev/null @@ -1,56 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 Nokia Corporation and its Subsidiary(-ies) 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 MYMODEL_H -#define MYMODEL_H - -#include <QAbstractTableModel> - -class MyModel : public QAbstractTableModel -{ - Q_OBJECT -public: - MyModel(QObject *parent); - int rowCount(const QModelIndex &parent = QModelIndex()) const ; - int columnCount(const QModelIndex &parent = QModelIndex()) const; - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; -}; - -#endif // MYMODEL_H diff --git a/examples/tutorials/modelview/3_changingmodel/3_changingmodel.desktop b/examples/tutorials/modelview/3_changingmodel/3_changingmodel.desktop deleted file mode 100644 index 3e053c94b1..0000000000 --- a/examples/tutorials/modelview/3_changingmodel/3_changingmodel.desktop +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Version=1.0 -Type=Application -Terminal=false -Name=3 Model View -Exec=/opt/usr/bin/3_changingmodel -Icon=3_changingmodel -X-Window-Icon= -X-HildonDesk-ShowInToolbar=true -X-Osso-Type=application/x-executable diff --git a/examples/tutorials/modelview/3_changingmodel/3_changingmodel.pro b/examples/tutorials/modelview/3_changingmodel/3_changingmodel.pro deleted file mode 100644 index 2649168f4d..0000000000 --- a/examples/tutorials/modelview/3_changingmodel/3_changingmodel.pro +++ /dev/null @@ -1,18 +0,0 @@ -TARGET = mv_changingmodel - -TEMPLATE = app - -SOURCES += main.cpp \ - mymodel.cpp - -HEADERS += mymodel.h - -# install -target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/modelview/3_changingmodel -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS 3_changingmodel.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/modelview/3_changingmodel -INSTALLS += target sources - -QT += widgets - -simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/tutorials/modelview/3_changingmodel/main.cpp b/examples/tutorials/modelview/3_changingmodel/main.cpp deleted file mode 100644 index 0a4f559170..0000000000 --- a/examples/tutorials/modelview/3_changingmodel/main.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 Nokia Corporation and its Subsidiary(-ies) 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/QApplication> -#include <QtWidgets/QTableView> -#include "mymodel.h" - -int main(int argc, char *argv[]) -{ - QApplication a(argc, argv); - QTableView tableView; - MyModel myModel(0); - tableView.setModel( &myModel ); - tableView.show(); - return a.exec(); -} diff --git a/examples/tutorials/modelview/3_changingmodel/mymodel.cpp b/examples/tutorials/modelview/3_changingmodel/mymodel.cpp deleted file mode 100644 index a446017344..0000000000 --- a/examples/tutorials/modelview/3_changingmodel/mymodel.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 Nokia Corporation and its Subsidiary(-ies) 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 <QBrush> -#include <QTime> -#include "mymodel.h" - -//! [quoting mymodel_a] -MyModel::MyModel(QObject *parent) - :QAbstractTableModel(parent) -{ -// selectedCell = 0; - timer = new QTimer(this); - timer->setInterval(1000); - connect(timer, SIGNAL(timeout()) , this, SLOT(timerHit())); - timer->start(); -} -//! [quoting mymodel_a] -//------------------------------------------------------- -int MyModel::rowCount(const QModelIndex & /*parent */) const -{ - return 2; -} - -//------------------------------------------------------- -int MyModel::columnCount(const QModelIndex & /*parent */) const -{ - return 3; -} - -//------------------------------------------------------- -//! [quoting mymodel_QVariant ] -QVariant MyModel::data(const QModelIndex &index, int role) const -{ - int row = index.row(); - int col = index.column(); - - if (role == Qt::DisplayRole) - { - if (row == 0 && col == 0) - { - return QTime::currentTime().toString(); - } - } - return QVariant(); -} -//! [quoting mymodel_QVariant ] -//------------------------------------------------------- -//! [quoting mymodel_b ] -void MyModel::timerHit() -{ - //we identify the top left cell - QModelIndex topLeft = createIndex(0,0); - //emit a signal to make the view reread identified data - emit dataChanged(topLeft, topLeft); -} -//! [quoting mymodel_b ] diff --git a/examples/tutorials/modelview/3_changingmodel/mymodel.h b/examples/tutorials/modelview/3_changingmodel/mymodel.h deleted file mode 100644 index 5bcf893e34..0000000000 --- a/examples/tutorials/modelview/3_changingmodel/mymodel.h +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 Nokia Corporation and its Subsidiary(-ies) 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 MYMODEL_H -#define MYMODEL_H - -#include <QAbstractTableModel> -#include <QTimer> - -class MyModel : public QAbstractTableModel -{ - Q_OBJECT -public: - MyModel(QObject *parent); - int rowCount(const QModelIndex &parent = QModelIndex()) const ; - int columnCount(const QModelIndex &parent = QModelIndex()) const; - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; - QTimer *timer; -private: - int selectedCell; -private slots: - void timerHit(); -}; - -#endif // MYMODEL_H diff --git a/examples/tutorials/modelview/4_headers/4_headers.desktop b/examples/tutorials/modelview/4_headers/4_headers.desktop deleted file mode 100644 index f17fe456f2..0000000000 --- a/examples/tutorials/modelview/4_headers/4_headers.desktop +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Version=1.0 -Type=Application -Terminal=false -Name=4 Model View -Exec=/opt/usr/bin/4_headers -Icon=4_headers -X-Window-Icon= -X-HildonDesk-ShowInToolbar=true -X-Osso-Type=application/x-executable diff --git a/examples/tutorials/modelview/4_headers/4_headers.pro b/examples/tutorials/modelview/4_headers/4_headers.pro deleted file mode 100644 index 308cb2878c..0000000000 --- a/examples/tutorials/modelview/4_headers/4_headers.pro +++ /dev/null @@ -1,18 +0,0 @@ -TARGET = mv_headers - -TEMPLATE = app - -SOURCES += main.cpp \ - mymodel.cpp - -HEADERS += mymodel.h - -# install -target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/modelview/4_headers -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS 4_headers.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/modelview/4_headers -INSTALLS += target sources - -QT += widgets - -simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/tutorials/modelview/4_headers/main.cpp b/examples/tutorials/modelview/4_headers/main.cpp deleted file mode 100644 index a3ce65e94f..0000000000 --- a/examples/tutorials/modelview/4_headers/main.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 Nokia Corporation and its Subsidiary(-ies) 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/QApplication> -#include <QtWidgets/QTableView> -#include "mymodel.h" - -int main(int argc, char *argv[]) -{ - QApplication a(argc, argv); - QTableView tableView; - MyModel myModel(0); - tableView.setModel( &myModel ); - tableView.show(); - return a.exec(); -}
\ No newline at end of file diff --git a/examples/tutorials/modelview/4_headers/mymodel.cpp b/examples/tutorials/modelview/4_headers/mymodel.cpp deleted file mode 100644 index 4a91f6c541..0000000000 --- a/examples/tutorials/modelview/4_headers/mymodel.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 Nokia Corporation and its Subsidiary(-ies) 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 "mymodel.h" - -MyModel::MyModel(QObject *parent) - :QAbstractTableModel(parent) -{ -} - -//------------------------------------------------------- -int MyModel::rowCount(const QModelIndex & /*parent*/) const -{ - return 2; -} - -//------------------------------------------------------- -int MyModel::columnCount(const QModelIndex & /*parent*/) const -{ - return 3; -} - -//------------------------------------------------------- -QVariant MyModel::data(const QModelIndex &index, int role) const -{ - if (role == Qt::DisplayRole) - { - return QString("Row%1, Column%2") - .arg(index.row() + 1) - .arg(index.column() +1); - } - return QVariant(); -} - -//! [quoting mymodel_c] -QVariant MyModel::headerData(int section, Qt::Orientation orientation, int role) const -{ - if (role == Qt::DisplayRole) - { - if (orientation == Qt::Horizontal) { - switch (section) - { - case 0: - return QString("first"); - case 1: - return QString("second"); - case 2: - return QString("third"); - } - } - } - return QVariant(); -} -//! [quoting mymodel_c] diff --git a/examples/tutorials/modelview/4_headers/mymodel.h b/examples/tutorials/modelview/4_headers/mymodel.h deleted file mode 100644 index fcc657035b..0000000000 --- a/examples/tutorials/modelview/4_headers/mymodel.h +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 Nokia Corporation and its Subsidiary(-ies) 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 MYMODEL_H -#define MYMODEL_H - -#include <QAbstractTableModel> - -class MyModel : public QAbstractTableModel -{ - Q_OBJECT -public: - MyModel(QObject *parent); - int rowCount(const QModelIndex &parent = QModelIndex()) const ; - int columnCount(const QModelIndex &parent = QModelIndex()) const; - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; - QVariant headerData(int section, Qt::Orientation orientation, int role) const; -}; - -#endif // MYMODEL_H diff --git a/examples/tutorials/modelview/5_edit/5_edit.desktop b/examples/tutorials/modelview/5_edit/5_edit.desktop deleted file mode 100644 index 4402c0a379..0000000000 --- a/examples/tutorials/modelview/5_edit/5_edit.desktop +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Version=1.0 -Type=Application -Terminal=false -Name=5 Model View -Exec=/opt/usr/bin/5_edit -Icon=5_edit -X-Window-Icon= -X-HildonDesk-ShowInToolbar=true -X-Osso-Type=application/x-executable diff --git a/examples/tutorials/modelview/5_edit/5_edit.pro b/examples/tutorials/modelview/5_edit/5_edit.pro deleted file mode 100644 index cd55a0b8f4..0000000000 --- a/examples/tutorials/modelview/5_edit/5_edit.pro +++ /dev/null @@ -1,20 +0,0 @@ -TARGET = mv_edit - -TEMPLATE = app - -SOURCES += main.cpp \ - mainwindow.cpp \ - mymodel.cpp - -HEADERS += mainwindow.h \ - mymodel.h - -# install -target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/modelview/5_edit -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS 5_edit.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/modelview/5_edit -INSTALLS += target sources - -QT += widgets - -simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/tutorials/modelview/5_edit/main.cpp b/examples/tutorials/modelview/5_edit/main.cpp deleted file mode 100644 index 0e10352554..0000000000 --- a/examples/tutorials/modelview/5_edit/main.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 Nokia Corporation and its Subsidiary(-ies) 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/QApplication> -#include "mainwindow.h" - -int main(int argc, char *argv[]) -{ - QApplication a(argc, argv); - MainWindow w; - w.show(); - return a.exec(); -} diff --git a/examples/tutorials/modelview/5_edit/mainwindow.cpp b/examples/tutorials/modelview/5_edit/mainwindow.cpp deleted file mode 100644 index e2e13562cf..0000000000 --- a/examples/tutorials/modelview/5_edit/mainwindow.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 Nokia Corporation and its Subsidiary(-ies) 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 <QTableView> -#include "mainwindow.h" -#include "mymodel.h" - -MainWindow::MainWindow(QWidget *parent) - : QMainWindow(parent) -{ - tableView = new QTableView(this); - setCentralWidget(tableView); - QAbstractTableModel *myModel = new MyModel(this); - tableView->setModel(myModel); - - //transfer changes to the model to the window title - connect(myModel, SIGNAL(editCompleted(const QString &)), this, SLOT(setWindowTitle(const QString &))); -} - -void MainWindow::showWindowTitle(const QString & title) -{ -setWindowTitle(title); -} diff --git a/examples/tutorials/modelview/5_edit/mainwindow.h b/examples/tutorials/modelview/5_edit/mainwindow.h deleted file mode 100644 index 2ab42289e1..0000000000 --- a/examples/tutorials/modelview/5_edit/mainwindow.h +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 Nokia Corporation and its Subsidiary(-ies) 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 MAINWINDOW_H -#define MAINWINDOW_H - -#include <QtWidgets/QMainWindow> - -QT_BEGIN_NAMESPACE // QT_BEGIN_NAMESPACE / QT_END_NAMESPACE are not needed in Qt user code -class QTableView; //forward declaration -QT_END_NAMESPACE - - -class MainWindow : public QMainWindow -{ - Q_OBJECT -private: - QTableView *tableView; -public: - MainWindow(QWidget *parent = 0); -public slots: - void showWindowTitle(const QString & title); -}; - -#endif // MAINWINDOW_H diff --git a/examples/tutorials/modelview/5_edit/mymodel.cpp b/examples/tutorials/modelview/5_edit/mymodel.cpp deleted file mode 100644 index 214a5b7cde..0000000000 --- a/examples/tutorials/modelview/5_edit/mymodel.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 Nokia Corporation and its Subsidiary(-ies) 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 "mymodel.h" - - -MyModel::MyModel(QObject *parent) - :QAbstractTableModel(parent) -{ -} - -//----------------------------------------------------------------- -int MyModel::rowCount(const QModelIndex & /*parent*/) const -{ - return ROWS; -} - -//----------------------------------------------------------------- -int MyModel::columnCount(const QModelIndex & /*parent*/) const -{ - return COLS; -} - -//----------------------------------------------------------------- -QVariant MyModel::data(const QModelIndex &index, int role) const -{ - if (role == Qt::DisplayRole) - { - return m_gridData[index.row()][index.column()]; - } - return QVariant(); -} - -//----------------------------------------------------------------- -//! [quoting mymodel_e] -bool MyModel::setData(const QModelIndex & index, const QVariant & value, int role) -{ - if (role == Qt::EditRole) - { - //save value from editor to member m_gridData - m_gridData[index.row()][index.column()] = value.toString(); - //for presentation purposes only: build and emit a joined string - QString result; - for(int row= 0; row < ROWS; row++) - { - for(int col= 0; col < COLS; col++) - { - result += m_gridData[row][col] + " "; - } - } - emit editCompleted( result ); - } - return true; -} -//! [quoting mymodel_e] - -//----------------------------------------------------------------- -//! [quoting mymodel_f] -Qt::ItemFlags MyModel::flags(const QModelIndex & /*index*/) const -{ - return Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled ; -} -//! [quoting mymodel_f] diff --git a/examples/tutorials/modelview/5_edit/mymodel.h b/examples/tutorials/modelview/5_edit/mymodel.h deleted file mode 100644 index 63ed4b8d46..0000000000 --- a/examples/tutorials/modelview/5_edit/mymodel.h +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 Nokia Corporation and its Subsidiary(-ies) 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 MYMODEL_H -#define MYMODEL_H - -//! [Quoting ModelView Tutorial] -// mymodel.h -#include <QAbstractTableModel> -#include <QString> - -const int COLS= 3; -const int ROWS= 2; - - -class MyModel : public QAbstractTableModel -{ - Q_OBJECT -public: - MyModel(QObject *parent); - int rowCount(const QModelIndex &parent = QModelIndex()) const ; - int columnCount(const QModelIndex &parent = QModelIndex()) const; - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; - bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole); - Qt::ItemFlags flags(const QModelIndex & index) const ; -private: - QString m_gridData[ROWS][COLS]; //holds text entered into QTableView -signals: - void editCompleted(const QString &); -}; -//! [Quoting ModelView Tutorial] - -#endif // MYMODEL_H diff --git a/examples/tutorials/modelview/6_treeview/6_treeview.desktop b/examples/tutorials/modelview/6_treeview/6_treeview.desktop deleted file mode 100644 index e0b872bf9c..0000000000 --- a/examples/tutorials/modelview/6_treeview/6_treeview.desktop +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Version=1.0 -Type=Application -Terminal=false -Name=6 Model View -Exec=/opt/usr/bin/6_treeview -Icon=6_treeview -X-Window-Icon= -X-HildonDesk-ShowInToolbar=true -X-Osso-Type=application/x-executable diff --git a/examples/tutorials/modelview/6_treeview/6_treeview.pro b/examples/tutorials/modelview/6_treeview/6_treeview.pro deleted file mode 100644 index 21ea5d9552..0000000000 --- a/examples/tutorials/modelview/6_treeview/6_treeview.pro +++ /dev/null @@ -1,15 +0,0 @@ -TARGET = mv_tree -TEMPLATE = app -SOURCES += main.cpp \ - mainwindow.cpp -HEADERS += mainwindow.h - -# install -target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/modelview/6_treeview -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS 6_treeview.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/modelview/6_treeview -INSTALLS += target sources - -QT += widgets - -simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/tutorials/modelview/6_treeview/main.cpp b/examples/tutorials/modelview/6_treeview/main.cpp deleted file mode 100644 index 0e10352554..0000000000 --- a/examples/tutorials/modelview/6_treeview/main.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 Nokia Corporation and its Subsidiary(-ies) 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/QApplication> -#include "mainwindow.h" - -int main(int argc, char *argv[]) -{ - QApplication a(argc, argv); - MainWindow w; - w.show(); - return a.exec(); -} diff --git a/examples/tutorials/modelview/6_treeview/mainwindow.cpp b/examples/tutorials/modelview/6_treeview/mainwindow.cpp deleted file mode 100644 index aea18c11d6..0000000000 --- a/examples/tutorials/modelview/6_treeview/mainwindow.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 Nokia Corporation and its Subsidiary(-ies) 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$ -** -****************************************************************************/ - -//! [Quoting ModelView Tutorial] -// modelview.cpp -#include <QTreeView> -#include <QStandardItemModel> -#include <QStandardItem> -#include "mainwindow.h" - - -const int ROWS = 2; -const int COLUMNS = 3; - -MainWindow::MainWindow(QWidget *parent) - : QMainWindow(parent) -{ - treeView = new QTreeView(this); - setCentralWidget(treeView); - standardModel = new QStandardItemModel ; - - QList<QStandardItem *> preparedRow =prepareRow("first", "second", "third"); - QStandardItem *item = standardModel->invisibleRootItem(); - // adding a row to the invisible root item produces a root element - item->appendRow(preparedRow); - - QList<QStandardItem *> secondRow =prepareRow("111", "222", "333"); - // adding a row to an item starts a subtree - preparedRow.first()->appendRow(secondRow); - - treeView->setModel(standardModel); - treeView->expandAll(); -} - -QList<QStandardItem *> MainWindow::prepareRow(const QString &first, - const QString &second, - const QString &third) -{ - QList<QStandardItem *> rowItems; - rowItems << new QStandardItem(first); - rowItems << new QStandardItem(second); - rowItems << new QStandardItem(third); - return rowItems; -} -//! [Quoting ModelView Tutorial] diff --git a/examples/tutorials/modelview/6_treeview/mainwindow.h b/examples/tutorials/modelview/6_treeview/mainwindow.h deleted file mode 100644 index aab299ca6f..0000000000 --- a/examples/tutorials/modelview/6_treeview/mainwindow.h +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 Nokia Corporation and its Subsidiary(-ies) 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 MAINWINDOW_H -#define MAINWINDOW_H - -#include <QtWidgets/QMainWindow> - -QT_BEGIN_NAMESPACE // QT_BEGIN_NAMESPACE / QT_END_NAMESPACE are not needed in Qt user code -class QTreeView; //forward declarations -class QStandardItemModel; -class QStandardItem; -QT_END_NAMESPACE - - -class MainWindow : public QMainWindow -{ - Q_OBJECT -private: - QTreeView *treeView; - QStandardItemModel *standardModel; - QList<QStandardItem *> prepareRow( const QString &first, - const QString &second, - const QString &third ); -public: - MainWindow(QWidget *parent = 0); -}; - -#endif // MAINWINDOW_H diff --git a/examples/tutorials/modelview/7_selections/7_selections.desktop b/examples/tutorials/modelview/7_selections/7_selections.desktop deleted file mode 100644 index afba38361f..0000000000 --- a/examples/tutorials/modelview/7_selections/7_selections.desktop +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Version=1.0 -Type=Application -Terminal=false -Name=7 Model View -Exec=/opt/usr/bin/7_selections -Icon=7_selections -X-Window-Icon= -X-HildonDesk-ShowInToolbar=true -X-Osso-Type=application/x-executable diff --git a/examples/tutorials/modelview/7_selections/7_selections.pro b/examples/tutorials/modelview/7_selections/7_selections.pro deleted file mode 100644 index c1e4b1553d..0000000000 --- a/examples/tutorials/modelview/7_selections/7_selections.pro +++ /dev/null @@ -1,15 +0,0 @@ -TARGET = mv_selections -TEMPLATE = app -SOURCES += main.cpp \ - mainwindow.cpp -HEADERS += mainwindow.h - -# install -target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/modelview/7_selections -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS 7_selections.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/modelview/7_selections -INSTALLS += target sources - -QT += widgets - -simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/tutorials/modelview/7_selections/main.cpp b/examples/tutorials/modelview/7_selections/main.cpp deleted file mode 100644 index 0e10352554..0000000000 --- a/examples/tutorials/modelview/7_selections/main.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 Nokia Corporation and its Subsidiary(-ies) 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/QApplication> -#include "mainwindow.h" - -int main(int argc, char *argv[]) -{ - QApplication a(argc, argv); - MainWindow w; - w.show(); - return a.exec(); -} diff --git a/examples/tutorials/modelview/7_selections/mainwindow.cpp b/examples/tutorials/modelview/7_selections/mainwindow.cpp deleted file mode 100644 index 99ecaf9da6..0000000000 --- a/examples/tutorials/modelview/7_selections/mainwindow.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 Nokia Corporation and its Subsidiary(-ies) 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$ -** -****************************************************************************/ - -//! [quoting modelview_a] -#include <QTreeView> -#include <QStandardItemModel> -#include <QItemSelectionModel> -#include "mainwindow.h" - -MainWindow::MainWindow(QWidget *parent) - : QMainWindow(parent) -{ - treeView = new QTreeView(this); - setCentralWidget(treeView); - standardModel = new QStandardItemModel ; - QStandardItem *rootNode = standardModel->invisibleRootItem(); - - - //defining a couple of items - QStandardItem *americaItem = new QStandardItem("America"); - QStandardItem *mexicoItem = new QStandardItem("Canada"); - QStandardItem *usaItem = new QStandardItem("USA"); - QStandardItem *bostonItem = new QStandardItem("Boston"); - QStandardItem *europeItem = new QStandardItem("Europe"); - QStandardItem *italyItem = new QStandardItem("Italy"); - QStandardItem *romeItem = new QStandardItem("Rome"); - QStandardItem *veronaItem = new QStandardItem("Verona"); - - //building up the hierarchy - rootNode-> appendRow(americaItem); - rootNode-> appendRow(europeItem); - americaItem-> appendRow(mexicoItem); - americaItem-> appendRow(usaItem); - usaItem-> appendRow(bostonItem); - europeItem-> appendRow(italyItem); - italyItem-> appendRow(romeItem); - italyItem-> appendRow(veronaItem); - - //register the model - treeView->setModel(standardModel); - treeView->expandAll(); - - //selection changes shall trigger a slot - QItemSelectionModel *selectionModel= treeView->selectionModel(); - connect(selectionModel, SIGNAL(selectionChanged (const QItemSelection &, const QItemSelection &)), - this, SLOT(selectionChangedSlot(const QItemSelection &, const QItemSelection &))); -} -//! [quoting modelview_a] - -//------------------------------------------------------------------------------------ - -//! [quoting modelview_b] -void MainWindow::selectionChangedSlot(const QItemSelection & /*newSelection*/, const QItemSelection & /*oldSelection*/) -{ - //get the text of the selected item - const QModelIndex index = treeView->selectionModel()->currentIndex(); - QString selectedText = index.data(Qt::DisplayRole).toString(); - //find out the hierarchy level of the selected item - int hierarchyLevel=1; - QModelIndex seekRoot = index; - while(seekRoot.parent() != QModelIndex()) - { - seekRoot = seekRoot.parent(); - hierarchyLevel++; - } - QString showString = QString("%1, Level %2").arg(selectedText) - .arg(hierarchyLevel); - setWindowTitle(showString); -} -//! [quoting modelview_b] - - diff --git a/examples/tutorials/modelview/7_selections/mainwindow.h b/examples/tutorials/modelview/7_selections/mainwindow.h deleted file mode 100644 index 076d56d179..0000000000 --- a/examples/tutorials/modelview/7_selections/mainwindow.h +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 Nokia Corporation and its Subsidiary(-ies) 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 MAINWINDOW_H -#define MAINWINDOW_H - -#include <QtWidgets/QMainWindow> - -QT_BEGIN_NAMESPACE // QT_BEGIN_NAMESPACE / QT_END_NAMESPACE are not needed in Qt user code -class QTreeView; //forward declarations -class QStandardItemModel; -class QItemSelection; -QT_END_NAMESPACE - - -class MainWindow : public QMainWindow -{ - Q_OBJECT -private: - QTreeView *treeView; - QStandardItemModel *standardModel; -private slots: - void selectionChangedSlot(const QItemSelection & newSelection, const QItemSelection & oldSelection); -public: - MainWindow(QWidget *parent = 0); -}; - -#endif // MAINWINDOW_H diff --git a/examples/tutorials/modelview/modelview.pro b/examples/tutorials/modelview/modelview.pro deleted file mode 100644 index 4a7e4a344e..0000000000 --- a/examples/tutorials/modelview/modelview.pro +++ /dev/null @@ -1,16 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS = 1_readonly \ - 2_formatting \ - 3_changingmodel \ - 4_headers \ - 5_edit \ - 6_treeview \ - 7_selections - -# install -target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/modelview -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS modelview.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/tutorials/modelview -INSTALLS += target sources - -QT += widgets |