From 7768c3fc60b8b4ace9f0e83c3b5e713363ccd9f7 2013-10-02 06:29:41 From: Titta Heikkala Date: 2013-10-02 06:29:41 Subject: [PATCH] Remove qmlcustommodel demo Qml Custom Model demo removed for now. If there's need for similar demo in the future a better one should be created. Task-number: QTRD-1928 Change-Id: I1766dfca4e2a7358f47c40f0e0b7258768c16b22 Reviewed-by: Miikka Heikkinen --- diff --git a/demos/qmlcustommodel/customtablemodel.cpp b/demos/qmlcustommodel/customtablemodel.cpp deleted file mode 100644 index d67dc90..0000000 --- a/demos/qmlcustommodel/customtablemodel.cpp +++ /dev/null @@ -1,136 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the Qt Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "customtablemodel.h" -#include -#include -#include -#include - -CustomTableModel::CustomTableModel(QObject *parent) : - QAbstractTableModel(parent), - m_columnCount(0), - m_rowCount(0) -{ -} - -int CustomTableModel::rowCount(const QModelIndex &parent) const -{ - Q_UNUSED(parent) - return m_data.count(); -} - -int CustomTableModel::columnCount(const QModelIndex &parent) const -{ - Q_UNUSED(parent) - return m_columnCount; -} - -QVariant CustomTableModel::headerData(int section, Qt::Orientation orientation, int role) const -{ - if (role != Qt::DisplayRole) - return QVariant(); - - if (orientation == Qt::Vertical) { - if (m_verticalHeaders.count() > section) - return m_verticalHeaders[section]; - else - return QAbstractTableModel::headerData(section, orientation, role); - } else { - return QAbstractTableModel::headerData(section, orientation, role); - } -} - -bool CustomTableModel::setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role) -{ - if (orientation == Qt::Vertical) { - while (m_verticalHeaders.count() <= section) - m_verticalHeaders.append(QVariant()); - m_verticalHeaders.replace(section, value); - } else { - return QAbstractTableModel::setHeaderData(section, orientation, value, role); - } - emit headerDataChanged(orientation, section, section); - return true; -} - -QVariant CustomTableModel::data(const QModelIndex &index, int role) const -{ - if (role == Qt::DisplayRole) { - return m_data[index.row()]->at(index.column()); - } else if (role == Qt::EditRole) { - return m_data[index.row()]->at(index.column()); - } - return QVariant(); -} - -bool CustomTableModel::setData(const QModelIndex &index, const QVariant &value, int role) -{ - if (index.isValid() && role == Qt::EditRole) { - m_data[index.row()]->replace(index.column(), value); - emit dataChanged(index, index); - return true; - } - return false; -} - -QVariant CustomTableModel::at(int row, int column) -{ - return data(index(row, column)); -} - -void CustomTableModel::insertColumn(int column, const QModelIndex &parent) -{ - beginInsertColumns(parent, column, column); - m_columnCount++; - endInsertColumns(); -} - -void CustomTableModel::insertRow(int row, const QModelIndex &parent) -{ - beginInsertRows(parent, row, row); - QVector* dataVec = new QVector(m_columnCount); - m_data.insert(row, dataVec); - endInsertRows(); -} - -bool CustomTableModel::removeRow(int row, const QModelIndex &parent) -{ - return QAbstractTableModel::removeRow(row, parent); -} - -bool CustomTableModel::removeRows(int row, int count, const QModelIndex &parent) -{ - beginRemoveRows(parent, row, row + count - 1); - bool removed(false); - for (int i(row); i < (row + count); i++) { - m_data.removeAt(i); - removed = true; - } - endRemoveRows(); - return removed; -} - -Qt::ItemFlags CustomTableModel::flags(const QModelIndex &index) const -{ - return QAbstractItemModel::flags(index) | Qt::ItemIsEditable; -} - -#include "moc_customtablemodel.cpp" diff --git a/demos/qmlcustommodel/customtablemodel.h b/demos/qmlcustommodel/customtablemodel.h deleted file mode 100644 index 3aa8366..0000000 --- a/demos/qmlcustommodel/customtablemodel.h +++ /dev/null @@ -1,56 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the Qt Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef CUSTOMTABLEMODEL_H -#define CUSTOMTABLEMODEL_H - -#include -#include - -class CustomTableModel : public QAbstractTableModel -{ - Q_OBJECT - Q_PROPERTY(int rowCount READ rowCount) - Q_PROPERTY(int columnCount READ columnCount) - -public: - explicit CustomTableModel(QObject *parent = 0); - - int rowCount(const QModelIndex &parent = QModelIndex()) const; - int columnCount(const QModelIndex &parent = QModelIndex()) const; - QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; - bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role = Qt::EditRole); - 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; - void insertColumn(int column, const QModelIndex &parent = QModelIndex()); - void insertRow(int row, const QModelIndex &parent = QModelIndex()); - Q_INVOKABLE bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()); - Q_INVOKABLE bool removeRow(int row, const QModelIndex &parent = QModelIndex()); - Q_INVOKABLE QVariant at(int row, int column); - -private: - QList * > m_data; - QList m_verticalHeaders; - int m_columnCount; - int m_rowCount; -}; - -#endif // CUSTOMTABLEMODEL_H diff --git a/demos/qmlcustommodel/declarativemodel.cpp b/demos/qmlcustommodel/declarativemodel.cpp deleted file mode 100644 index e7795e0..0000000 --- a/demos/qmlcustommodel/declarativemodel.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the Qt Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "declarativemodel.h" -#include -#include -#include - -////////////// Table model element /////////////////// - -DeclarativeTableModelElement::DeclarativeTableModelElement(QObject *parent) - : QObject(parent) -{ -} - -QVariantList DeclarativeTableModelElement::values() -{ - return m_values; -} - -void DeclarativeTableModelElement::setValues(QVariantList values) -{ - m_values = values; -} - -////////////// Table model /////////////////// - -DeclarativeTableModel::DeclarativeTableModel(QObject *parent) : - CustomTableModel(parent) -{ -} - -void DeclarativeTableModel::classBegin() -{ -} - -void DeclarativeTableModel::componentComplete() -{ - foreach (QObject *child, children()) { - if (qobject_cast(child)) { - DeclarativeTableModelElement *element = qobject_cast(child); - append(element->values()); - } - } -} - -void DeclarativeTableModel::setVerticalHeaders(QStringList headers) -{ - for (int i(0); i < headers.count(); i++) - setHeaderData(i, Qt::Vertical, headers.at(i)); -} - -QStringList DeclarativeTableModel::verticalHeaders() -{ - return QStringList(); -} - -QDeclarativeListProperty DeclarativeTableModel::modelChildren() -{ - return QDeclarativeListProperty(this, 0, &DeclarativeTableModel::appendModelChild); -} - -void DeclarativeTableModel::appendModelChild(QDeclarativeListProperty *list, - QObject *child) -{ - // children are added in componentComplete instead - Q_UNUSED(list) - Q_UNUSED(child) -} - -void DeclarativeTableModel::append(QVariantList values) -{ -// qDebug() << "DeclarativeTableModel::append:" << values; - - while (columnCount() < values.count()) - insertColumn(columnCount()); - - insertRow(rowCount()); - - QModelIndex beginIndex = QModelIndex(); - QModelIndex endIndex = QModelIndex(); - for (int i(0); i < values.count(); i++) { - QModelIndex modelIndex = createIndex(rowCount() - 1, i); - if (i == 0) - beginIndex = modelIndex; - if (i == (values.count() - 1)) - endIndex = modelIndex; - setData(modelIndex, values.at(i)); - } - dataChanged(beginIndex, endIndex); -} - -#include "moc_declarativemodel.cpp" diff --git a/demos/qmlcustommodel/declarativemodel.h b/demos/qmlcustommodel/declarativemodel.h deleted file mode 100644 index 4c671d0..0000000 --- a/demos/qmlcustommodel/declarativemodel.h +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the Qt Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef DECLARATIVEMODEL_H -#define DECLARATIVEMODEL_H - -#include "customtablemodel.h" -#include -#include -#include - -class DeclarativeTableModelElement : public QObject -{ - Q_OBJECT - Q_PROPERTY(QVariantList values READ values WRITE setValues) - -public: - explicit DeclarativeTableModelElement(QObject *parent = 0); - QVariantList values(); - void setValues(QVariantList values); -private: - QVariantList m_values; -}; - -class DeclarativeTableModel : public CustomTableModel, public QDeclarativeParserStatus -{ - Q_OBJECT - Q_INTERFACES(QDeclarativeParserStatus) - Q_PROPERTY(QDeclarativeListProperty modelChildren READ modelChildren) - Q_PROPERTY(QStringList verticalHeaders READ verticalHeaders WRITE setVerticalHeaders) - Q_CLASSINFO("DefaultProperty", "modelChildren") - -public: - explicit DeclarativeTableModel(QObject *parent = 0); - QDeclarativeListProperty modelChildren(); - void setVerticalHeaders(QStringList headers); - QStringList verticalHeaders(); - -public: // from QDeclarativeParserStatus - void classBegin(); - void componentComplete(); - -public Q_SLOTS: - void append(QVariantList slices); - static void appendModelChild(QDeclarativeListProperty *list, - QObject *element); -}; - -#endif // DECLARATIVEMODEL_H diff --git a/demos/qmlcustommodel/main.cpp b/demos/qmlcustommodel/main.cpp deleted file mode 100644 index e274f4e..0000000 --- a/demos/qmlcustommodel/main.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the Qt Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include -#include -#include "declarativemodel.h" -#include "customtablemodel.h" -#include "qmlapplicationviewer.h" - -const char *uri = "QmlCustomModel"; - -Q_DECL_EXPORT int main(int argc, char *argv[]) -{ - QScopedPointer app(createApplication(argc, argv)); - QScopedPointer viewer(QmlApplicationViewer::create()); -#ifdef Q_OS_ANDROID - viewer->addImportPath(QString::fromLatin1("assets:/imports")); - viewer->engine()->addPluginPath(QString::fromLatin1("%1/../%2").arg(QDir::homePath(), QString::fromLatin1("lib"))); -#else - viewer->addImportPath(QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), QString::fromLatin1("imports"))); -#endif - - // @uri QmlCustomModel - qmlRegisterUncreatableType(uri, 1, 0, "AbstractItemModel", - QLatin1String("Trying to create uncreatable: AbstractItemModel.")); - qmlRegisterType(uri, 1, 0, "CustomModel"); - qmlRegisterType(uri, 1, 0, "CustomModelElement"); - - // // viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto); - viewer->setSource(QUrl("qrc:/qml/qmlcustommodel/loader.qml")); - viewer->setRenderHint(QPainter::Antialiasing, true); - viewer->showExpanded(); - - return app->exec(); -} diff --git a/demos/qmlcustommodel/qml/qmlcustommodel/loader.qml b/demos/qmlcustommodel/qml/qmlcustommodel/loader.qml deleted file mode 100644 index e035fca..0000000 --- a/demos/qmlcustommodel/qml/qmlcustommodel/loader.qml +++ /dev/null @@ -1,37 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the Qt Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 - -Item { - id: container - width: 400 - height: 300 - Component.onCompleted: { - var co = Qt.createComponent("main.qml") - if (co.status == Component.Ready) { - var o = co.createObject(container) - } else { - console.log(co.errorString()) - console.log("QtCommercial.Chart 1.1 not available") - console.log("Please use correct QML_IMPORT_PATH export") - } - } -} diff --git a/demos/qmlcustommodel/qml/qmlcustommodel/main.qml b/demos/qmlcustommodel/qml/qmlcustommodel/main.qml deleted file mode 100644 index 6858477..0000000 --- a/demos/qmlcustommodel/qml/qmlcustommodel/main.qml +++ /dev/null @@ -1,183 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the Qt Enterprise Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 1.0 -import QtCommercial.Chart 1.1 -import QmlCustomModel 1.0 - -Rectangle { - anchors.fill: parent - - //![1] - ChartView { - id: chartView - title: "Top-5 car brand shares in Finland" - anchors.fill: parent - animationOptions: ChartView.SeriesAnimations - - BarCategoriesAxis { - id: categoriesAxis - categories: ["2007", "2008", "2009", "2010", "2011", "2012", "2013", "2014" ] - min: "2007" - max: "2014" - titleText: "Year" - } - - ValueAxis { - id: valueAxis - min: 0 - max: 60 - titleText: "Sales count [ku]" - } - // ... - //![1] - - //![2] - CustomModel { - id: customModel - verticalHeaders: ["Manufacturer", "Volkswagen", "Toyota", "Ford", "Skoda", "Volvo", "Others"] - CustomModelElement { values: [0, "Manufacturer", 0, 1, 2, 3, 4] } - CustomModelElement { values: [1, "Volkswagen", 10.3, 12.0, 12.8, 13.0, 13.8] } - CustomModelElement { values: [2, "Toyota", 13.8, 13.5, 16.2, 13.7, 10.7] } - CustomModelElement { values: [3, "Ford", 6.4, 7.1, 8.9, 8.2, 8.6] } - CustomModelElement { values: [4, "Skoda", 4.7, 5.8, 6.9, 8.3, 8.2] } - CustomModelElement { values: [5, "Volvo", 7.1, 6.7, 6.5, 6.3, 7.0] } - CustomModelElement { values: [6, "Others", 57.7, 54.9, 48.7, 50.5, 51.7] } - } - //![2] - - //![5] - BarSeries { - id: myBarSeries - name: "Others" - axisX: categoriesAxis - axisY: valueAxis - barWidth: 0.9 - visible: false - HBarModelMapper { - model: customModel - firstBarSetRow: 6 - lastBarSetRow: 6 - firstColumn: 2 - } - } - //![5] - - //![4] - LineSeries { - id: lineSeries1 - name: "Volkswagen" - axisX: categoriesAxis - axisY: valueAxis - visible: false - HXYModelMapper { - model: customModel - xRow: 0 - yRow: 1 - firstColumn: 2 - } - } - //![4] - - LineSeries { - id: lineSeries2 - name: "Toyota" - axisX: categoriesAxis - axisY: valueAxis - visible: false - HXYModelMapper { - model: customModel - xRow: 0 - yRow: 2 - firstColumn: 2 - } - } - - LineSeries { - id: lineSeries3 - name: "Ford" - axisX: categoriesAxis - axisY: valueAxis - visible: false - HXYModelMapper { - model: customModel - xRow: 0 - yRow: 3 - firstColumn: 2 - } - } - - LineSeries { - id: lineSeries4 - name: "Skoda" - axisX: categoriesAxis - axisY: valueAxis - visible: false - HXYModelMapper { - model: customModel - xRow: 0 - yRow: 4 - firstColumn: 2 - } - } - - LineSeries { - id: lineSeries5 - name: "Volvo" - axisX: categoriesAxis - axisY: valueAxis - visible: false - HXYModelMapper { - model: customModel - xRow: 0 - yRow: 5 - firstColumn: 2 - } - } - - //![3] - PieSeries { - id: pieSeries - size: 0.4 - horizontalPosition: 0.85 - verticalPosition: 0.4 - onClicked: { - // Show the selection by exploding the slice - slice.exploded = !slice.exploded; - - // Update the line series to show the yearly data for this slice - for (var i = 0; i < chartView.count; i++) { - if (chartView.series(i).name == slice.label) { - chartView.series(i).visible = slice.exploded; - } - } - } - - } - VPieModelMapper { - model: customModel - series: pieSeries - labelsColumn: 1 - valuesColumn: 2 - firstRow: 1 - } - //![3] - } -} diff --git a/demos/qmlcustommodel/qmlapplicationviewer/qmlapplicationviewer.cpp b/demos/qmlcustommodel/qmlapplicationviewer/qmlapplicationviewer.cpp deleted file mode 100644 index cb22705..0000000 --- a/demos/qmlcustommodel/qmlapplicationviewer/qmlapplicationviewer.cpp +++ /dev/null @@ -1,177 +0,0 @@ -// checksum 0xaa72 version 0x90018 -/* - This file was generated by the Qt Quick Application wizard of Qt Creator. - QmlApplicationViewer is a convenience class containing mobile device specific - code such as screen orientation handling. Also QML paths and debugging are - handled here. - It is recommended not to modify this file, since newer versions of Qt Creator - may offer an updated version of it. -*/ - -#include "qmlapplicationviewer.h" - -#include -#include -#include -#include -#include -#include - -#include // MEEGO_EDITION_HARMATTAN - -#ifdef HARMATTAN_BOOSTER -#include -#endif - -#if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800 - -#include - -#if !defined(NO_JSDEBUGGER) -#include -#endif -#if !defined(NO_QMLOBSERVER) -#include -#endif - -// Enable debugging before any QDeclarativeEngine is created -struct QmlJsDebuggingEnabler -{ - QmlJsDebuggingEnabler() - { - QDeclarativeDebugHelper::enableDebugging(); - } -}; - -// Execute code in constructor before first QDeclarativeEngine is instantiated -static QmlJsDebuggingEnabler enableDebuggingHelper; - -#endif // QMLJSDEBUGGER - -class QmlApplicationViewerPrivate -{ - QString mainQmlFile; - friend class QmlApplicationViewer; - static QString adjustPath(const QString &path); -}; - -QString QmlApplicationViewerPrivate::adjustPath(const QString &path) -{ -#ifdef Q_OS_MAC - if (!QDir::isAbsolutePath(path)) - return QString::fromLatin1("%1/../Resources/%2") - .arg(QCoreApplication::applicationDirPath(), path); -#elif defined(Q_OS_BLACKBERRY) - if (!QDir::isAbsolutePath(path)) - return QString::fromLatin1("app/native/%1").arg(path); -#elif !defined(Q_OS_ANDROID) - QString pathInInstallDir = - QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path); - if (QFileInfo(pathInInstallDir).exists()) - return pathInInstallDir; - pathInInstallDir = - QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), path); - if (QFileInfo(pathInInstallDir).exists()) - return pathInInstallDir; -#endif - return path; -} - -QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) - : QDeclarativeView(parent) - , d(new QmlApplicationViewerPrivate()) -{ - connect(engine(), SIGNAL(quit()), SLOT(close())); - setResizeMode(QDeclarativeView::SizeRootObjectToView); - - // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in -#if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800 -#if !defined(NO_JSDEBUGGER) - new QmlJSDebugger::JSDebuggerAgent(engine()); -#endif -#if !defined(NO_QMLOBSERVER) - new QmlJSDebugger::QDeclarativeViewObserver(this, this); -#endif -#endif -} - -QmlApplicationViewer::~QmlApplicationViewer() -{ - delete d; -} - -QmlApplicationViewer *QmlApplicationViewer::create() -{ - return new QmlApplicationViewer(); -} - -void QmlApplicationViewer::setMainQmlFile(const QString &file) -{ - d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); -#ifdef Q_OS_ANDROID - setSource(QUrl(QLatin1String("assets:/")+d->mainQmlFile)); -#else - setSource(QUrl::fromLocalFile(d->mainQmlFile)); -#endif -} - -void QmlApplicationViewer::addImportPath(const QString &path) -{ - engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); -} - -void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) -{ -#if QT_VERSION < 0x050000 - Qt::WidgetAttribute attribute; - switch (orientation) { -#if QT_VERSION < 0x040702 - // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes - case ScreenOrientationLockPortrait: - attribute = static_cast(128); - break; - case ScreenOrientationLockLandscape: - attribute = static_cast(129); - break; - default: - case ScreenOrientationAuto: - attribute = static_cast(130); - break; -#else // QT_VERSION < 0x040702 - case ScreenOrientationLockPortrait: - attribute = Qt::WA_LockPortraitOrientation; - break; - case ScreenOrientationLockLandscape: - attribute = Qt::WA_LockLandscapeOrientation; - break; - default: - case ScreenOrientationAuto: - attribute = Qt::WA_AutoOrientation; - break; -#endif // QT_VERSION < 0x040702 - }; - setAttribute(attribute, true); -#else // QT_VERSION < 0x050000 - Q_UNUSED(orientation) -#endif // QT_VERSION < 0x050000 -} - -void QmlApplicationViewer::showExpanded() -{ -#if defined(MEEGO_EDITION_HARMATTAN) || defined(Q_WS_SIMULATOR) - showFullScreen(); -#elif defined(Q_WS_MAEMO_5) || defined(Q_OS_QNX) - showMaximized(); -#else - show(); -#endif -} - -QApplication *createApplication(int &argc, char **argv) -{ -#ifdef HARMATTAN_BOOSTER - return MDeclarativeCache::qApplication(argc, argv); -#else - return new QApplication(argc, argv); -#endif -} diff --git a/demos/qmlcustommodel/qmlapplicationviewer/qmlapplicationviewer.h b/demos/qmlcustommodel/qmlapplicationviewer/qmlapplicationviewer.h deleted file mode 100644 index adcb232..0000000 --- a/demos/qmlcustommodel/qmlapplicationviewer/qmlapplicationviewer.h +++ /dev/null @@ -1,46 +0,0 @@ -// checksum 0xc67a version 0x90018 -/* - This file was generated by the Qt Quick Application wizard of Qt Creator. - QmlApplicationViewer is a convenience class containing mobile device specific - code such as screen orientation handling. Also QML paths and debugging are - handled here. - It is recommended not to modify this file, since newer versions of Qt Creator - may offer an updated version of it. -*/ - -#ifndef QMLAPPLICATIONVIEWER_H -#define QMLAPPLICATIONVIEWER_H - -#include - -class QmlApplicationViewer : public QDeclarativeView -{ - Q_OBJECT - -public: - enum ScreenOrientation { - ScreenOrientationLockPortrait, - ScreenOrientationLockLandscape, - ScreenOrientationAuto - }; - - explicit QmlApplicationViewer(QWidget *parent = 0); - virtual ~QmlApplicationViewer(); - - static QmlApplicationViewer *create(); - - void setMainQmlFile(const QString &file); - void addImportPath(const QString &path); - - // Note that this will only have an effect on Fremantle. - void setOrientation(ScreenOrientation orientation); - - void showExpanded(); - -private: - class QmlApplicationViewerPrivate *d; -}; - -QApplication *createApplication(int &argc, char **argv); - -#endif // QMLAPPLICATIONVIEWER_H diff --git a/demos/qmlcustommodel/qmlapplicationviewer/qmlapplicationviewer.pri b/demos/qmlcustommodel/qmlapplicationviewer/qmlapplicationviewer.pri deleted file mode 100644 index 567c6dc..0000000 --- a/demos/qmlcustommodel/qmlapplicationviewer/qmlapplicationviewer.pri +++ /dev/null @@ -1,13 +0,0 @@ -QT += declarative - -SOURCES += $$PWD/qmlapplicationviewer.cpp -HEADERS += $$PWD/qmlapplicationviewer.h -INCLUDEPATH += $$PWD - -# Include JS debugger library if QMLJSDEBUGGER_PATH is set -!isEmpty(QMLJSDEBUGGER_PATH) { - include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) -} else { - DEFINES -= QMLJSDEBUGGER -} - diff --git a/demos/qmlcustommodel/qmlchart.svg b/demos/qmlcustommodel/qmlchart.svg deleted file mode 100644 index 566acfa..0000000 --- a/demos/qmlcustommodel/qmlchart.svg +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - diff --git a/demos/qmlcustommodel/qmlcustommodel.pro b/demos/qmlcustommodel/qmlcustommodel.pro deleted file mode 100644 index 0bfe97a..0000000 --- a/demos/qmlcustommodel/qmlcustommodel.pro +++ /dev/null @@ -1,13 +0,0 @@ -!include( ../demos.pri ) { - error( "Couldn't find the demos.pri file!" ) -} - -RESOURCES += resources.qrc -SOURCES += main.cpp\ - customtablemodel.cpp \ - declarativemodel.cpp -HEADERS += customtablemodel.h \ - declarativemodel.h -OTHER_FILES += qml/qmlcustommodel/* - -include(qmlapplicationviewer/qmlapplicationviewer.pri) diff --git a/demos/qmlcustommodel/resources.qrc b/demos/qmlcustommodel/resources.qrc deleted file mode 100644 index 7effbf4..0000000 --- a/demos/qmlcustommodel/resources.qrc +++ /dev/null @@ -1,6 +0,0 @@ - - - qml/qmlcustommodel/loader.qml - qml/qmlcustommodel/main.qml - - diff --git a/doc/src/demos-qmlcustommodel.qdoc b/doc/src/demos-qmlcustommodel.qdoc deleted file mode 100644 index 2ba671c..0000000 --- a/doc/src/demos-qmlcustommodel.qdoc +++ /dev/null @@ -1,29 +0,0 @@ -/*! - \example demos/qmlcustommodel - \title QML Custom Model - \subtitle - - This example shows how to use your own QAbstractItemModel derived data model as a data source for a ChartView. - \image demos_qmlcustommodel.png - - First we create a ChartView: - \snippet ../demos/qmlcustommodel/qml/qmlcustommodel/main.qml 1 - - Then our data model that contains the shares of the top 5 car manufacturers in Finland for the last 5 years. The model - could be constructed from various sources depending on the use case, but here we use static data for the sake of - simplicity. Check customtablemodel.cpp, declarativemodel.cpp, and plugin.cpp to see how to make your own - QAbstractItemModel accessible on QML. - \snippet ../demos/qmlcustommodel/qml/qmlcustommodel/main.qml 2 - - Then we create several series as children for the same ChartView. First a pie series that illustrates the shares of - the car manufacturers in Finland in 2011: - \snippet ../demos/qmlcustommodel/qml/qmlcustommodel/main.qml 3 - - And one line series for each manufacturer presenting the share between 2007-2011, for example for Volkswagen. - The series is not visible by default. It is made visible when the user clicks on the Volkswagen slice - on the pie series: - \snippet ../demos/qmlcustommodel/qml/qmlcustommodel/main.qml 4 - - And finally a bar series that shows the share for all the other manufacturers between 2007-2011: - \snippet ../demos/qmlcustommodel/qml/qmlcustommodel/main.qml 5 -*/ diff --git a/doc/src/demos.qdoc b/doc/src/demos.qdoc index 453f4c9..38c310f 100644 --- a/doc/src/demos.qdoc +++ b/doc/src/demos.qdoc @@ -41,11 +41,11 @@ Qml Customizations - Qml Custom Model + Qml Custom Legend Qml Customizations - Qml Custom Model + Qml Custom Legend Qml F1 Legends @@ -57,24 +57,18 @@ Qml Weather - Qml Custom Legend - - - Qml Weather - Qml Custom Legend - - Qml Polar Chart - Qt Quick 2 Basic Charts + Qml Weather Qml Polar Chart - Qt Quick 2 Basic Charts + Qt Quick 2 Basic Charts Qt Quick 2 Oscilloscope + Qt Quick 2 Basic Charts Qt Quick 2 Oscilloscope diff --git a/src/barchart/qhbarmodelmapper.cpp b/src/barchart/qhbarmodelmapper.cpp index c5d4c09..ccc8d19 100644 --- a/src/barchart/qhbarmodelmapper.cpp +++ b/src/barchart/qhbarmodelmapper.cpp @@ -74,9 +74,9 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE */ /*! \qmlproperty SomeModel HBarModelMapper::model - The QAbstractItemModel based model that is used by the mapper. You need to implement the model and expose it to - QML as shown in \l {QML Custom Model} demo application. Note: the model has to support adding/removing rows/columns - and modifying the data of the cells. + The QAbstractItemModel based model that is used by the mapper. You need to implement the model + and expose it to QML. Note: the model has to support adding/removing rows/columns and modifying + the data of the cells. */ /*! diff --git a/src/barchart/qvbarmodelmapper.cpp b/src/barchart/qvbarmodelmapper.cpp index 19eea3b..4cd98ea 100644 --- a/src/barchart/qvbarmodelmapper.cpp +++ b/src/barchart/qvbarmodelmapper.cpp @@ -75,9 +75,9 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE */ /*! \qmlproperty SomeModel VBarModelMapper::model - The QAbstractItemModel based model that is used by the mapper. You need to implement the model and expose it to - QML as shown in \l {QML Custom Model} demo application. Note: the model has to support adding/removing rows/columns - and modifying the data of the cells. + The QAbstractItemModel based model that is used by the mapper. You need to implement the model + and expose it to QML. Note: the model has to support adding/removing rows/columns and modifying + the data of the cells. */ /*! diff --git a/src/piechart/qhpiemodelmapper.cpp b/src/piechart/qhpiemodelmapper.cpp index ea0f435..9cdb2cf 100644 --- a/src/piechart/qhpiemodelmapper.cpp +++ b/src/piechart/qhpiemodelmapper.cpp @@ -72,9 +72,9 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE */ /*! \qmlproperty SomeModel HPieModelMapper::model - The QAbstractItemModel based model that is used by the mapper. You need to implement the model and expose it to - QML as shown in \l {QML Custom Model} demo application. Note: the model has to support adding/removing rows/columns - and modifying the data of the cells. + The QAbstractItemModel based model that is used by the mapper. You need to implement the model + and expose it to QML. Note: the model has to support adding/removing rows/columns and modifying + the data of the cells. */ /*! diff --git a/src/piechart/qvpiemodelmapper.cpp b/src/piechart/qvpiemodelmapper.cpp index 96a55be..38eecd1 100644 --- a/src/piechart/qvpiemodelmapper.cpp +++ b/src/piechart/qvpiemodelmapper.cpp @@ -71,9 +71,9 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE */ /*! \qmlproperty SomeModel VPieModelMapper::model - The QAbstractItemModel based model that is used by the mapper. You need to implement the model and expose it to - QML as shown in \l {QML Custom Model} demo application. Note: the model has to support adding/removing rows/columns - and modifying the data of the cells. + The QAbstractItemModel based model that is used by the mapper. You need to implement the model + and expose it to QML. Note: the model has to support adding/removing rows/columns and modifying + the data of the cells. */ /*! diff --git a/src/xychart/qhxymodelmapper.cpp b/src/xychart/qhxymodelmapper.cpp index 60bf3a3..30201e7 100644 --- a/src/xychart/qhxymodelmapper.cpp +++ b/src/xychart/qhxymodelmapper.cpp @@ -58,9 +58,9 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE */ /*! \qmlproperty SomeModel HXYModelMapper::model - The QAbstractItemModel based model that is used by the mapper. You need to implement the model and expose it to - QML as shown in \l {QML Custom Model} demo application. Note: the model has to support adding/removing rows/columns - and modifying the data of the cells. + The QAbstractItemModel based model that is used by the mapper. You need to implement the model + and expose it to QML. Note: the model has to support adding/removing rows/columns and modifying + the data of the cells. */ /*! diff --git a/src/xychart/qvxymodelmapper.cpp b/src/xychart/qvxymodelmapper.cpp index 91d055f..af5149e 100644 --- a/src/xychart/qvxymodelmapper.cpp +++ b/src/xychart/qvxymodelmapper.cpp @@ -58,9 +58,9 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE */ /*! \qmlproperty SomeModel VXYModelMapper::model - The QAbstractItemModel based model that is used by the mapper. You need to implement the model and expose it to - QML as shown in \l {QML Custom Model} demo application. Note: the model has to support adding/removing rows/columns - and modifying the data of the cells. + The QAbstractItemModel based model that is used by the mapper. You need to implement the model + and expose it to QML. Note: the model has to support adding/removing rows/columns and modifying + the data of the cells. */ /*!