mirror of https://github.com/qt/qtcharts.git
Property for QDateTimeAxis::format and a QML demo for axes
This commit is contained in:
parent
7b591ccd5d
commit
32de3be17d
|
@ -12,7 +12,8 @@ SUBDIRS += piechartcustomization \
|
|||
qmlf1legends \
|
||||
qmlcustomizations \
|
||||
qmlcustommodel \
|
||||
chartinteractions
|
||||
chartinteractions \
|
||||
qmlaxes
|
||||
|
||||
contains(QT_CONFIG, opengl) {
|
||||
SUBDIRS += chartthemes \
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 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 Commercial Charts Add-on.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE$
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial 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 <QtGui/QApplication>
|
||||
#include <QDeclarativeEngine>
|
||||
#include "qmlapplicationviewer.h"
|
||||
|
||||
Q_DECL_EXPORT int main(int argc, char *argv[])
|
||||
{
|
||||
QScopedPointer<QApplication> app(createApplication(argc, argv));
|
||||
QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create());
|
||||
|
||||
viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
|
||||
viewer->setSource(QUrl("qrc:/qml/qmlaxes/loader.qml"));
|
||||
viewer->setRenderHint(QPainter::Antialiasing, true);
|
||||
viewer->showExpanded();
|
||||
|
||||
return app->exec();
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 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 Commercial Charts Add-on.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE$
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial 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
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
|
||||
//![1]
|
||||
ChartView {
|
||||
title: "Two Series, Common Axes"
|
||||
anchors.fill: parent
|
||||
legend.visible: false
|
||||
|
||||
ValueAxis {
|
||||
id: axisX
|
||||
min: 0
|
||||
max: 10
|
||||
tickCount: 5
|
||||
}
|
||||
|
||||
ValueAxis {
|
||||
id: axisY
|
||||
min: -0.5
|
||||
max: 1.5
|
||||
}
|
||||
|
||||
LineSeries {
|
||||
id: series1
|
||||
axisX: axisX
|
||||
axisY: axisY
|
||||
}
|
||||
|
||||
ScatterSeries {
|
||||
id: series2
|
||||
axisX: axisX
|
||||
axisY: axisY
|
||||
}
|
||||
}
|
||||
|
||||
// Add data dynamically to the series
|
||||
Component.onCompleted: {
|
||||
for (var i = 0; i <= 10; i++) {
|
||||
series1.append(i, Math.random());
|
||||
series2.append(i, Math.random());
|
||||
}
|
||||
}
|
||||
//![1]
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 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 Commercial Charts Add-on.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE$
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial 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
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
|
||||
//![1]
|
||||
ChartView {
|
||||
title: "Accurate Historical Data"
|
||||
anchors.fill: parent
|
||||
legend.visible: false
|
||||
|
||||
LineSeries {
|
||||
axisX: DateTimeAxis {
|
||||
format: "yyyy MMM"
|
||||
tickCount: 5
|
||||
}
|
||||
axisY: ValueAxis {
|
||||
min: 0
|
||||
max: 150
|
||||
}
|
||||
|
||||
// Please note that month in JavaScript months are zero based, so 2 means March
|
||||
XYPoint { x: toMsecsSinceEpoch(new Date(1950, 2, 15)); y: 5 }
|
||||
XYPoint { x: toMsecsSinceEpoch(new Date(1970, 0, 1)); y: 50 }
|
||||
XYPoint { x: toMsecsSinceEpoch(new Date(1987, 12, 31)); y: 102 }
|
||||
XYPoint { x: toMsecsSinceEpoch(new Date(1998, 7, 1)); y: 100 }
|
||||
XYPoint { x: toMsecsSinceEpoch(new Date(2012, 8, 2)); y: 110 }
|
||||
}
|
||||
}
|
||||
|
||||
// DateTimeAxis is based on QDateTimes so we must convert our JavaScript dates to
|
||||
// milliseconds since epoch to make them match the DateTimeAxis values
|
||||
function toMsecsSinceEpoch(date) {
|
||||
var msecs = date.getTime();
|
||||
return msecs;
|
||||
}
|
||||
//![1]
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 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 Commercial Charts Add-on.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE$
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial 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
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
|
||||
//![1]
|
||||
ChartView {
|
||||
title: "Numerical Data for Dummies"
|
||||
anchors.fill: parent
|
||||
legend.visible: false
|
||||
|
||||
LineSeries {
|
||||
axisY: CategoryAxis {
|
||||
min: 0
|
||||
max: 30
|
||||
CategoryRange {
|
||||
label: "critical"
|
||||
endValue: 2
|
||||
}
|
||||
CategoryRange {
|
||||
label: "low"
|
||||
endValue: 4
|
||||
}
|
||||
CategoryRange {
|
||||
label: "normal"
|
||||
endValue: 7
|
||||
}
|
||||
CategoryRange {
|
||||
label: "high"
|
||||
endValue: 15
|
||||
}
|
||||
CategoryRange {
|
||||
label: "extremely high"
|
||||
endValue: 30
|
||||
}
|
||||
}
|
||||
|
||||
XYPoint { x: 0; y: 4.3 }
|
||||
XYPoint { x: 1; y: 4.1 }
|
||||
XYPoint { x: 2; y: 4.7 }
|
||||
XYPoint { x: 3; y: 3.9 }
|
||||
XYPoint { x: 4; y: 5.2 }
|
||||
}
|
||||
}
|
||||
//![1]
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 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 Commercial Charts Add-on.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE$
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial 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")
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,90 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 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 Commercial Charts Add-on.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE$
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial 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
|
||||
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
property int viewNumber: 1
|
||||
property int viewCount: 3
|
||||
|
||||
Loader {
|
||||
id: loader
|
||||
anchors.fill: parent
|
||||
source: "View" + viewNumber + ".qml";
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: infoText
|
||||
anchors.centerIn: parent
|
||||
width: parent.width
|
||||
height: 40
|
||||
color: "black"
|
||||
Text {
|
||||
color: "white"
|
||||
anchors.centerIn: parent
|
||||
text: "Use left and right arrow keys to navigate"
|
||||
}
|
||||
|
||||
Behavior on opacity {
|
||||
NumberAnimation { duration: 400 }
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
focus: true
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
if (infoText.opacity > 0) {
|
||||
infoText.opacity = 0.0;
|
||||
} else {
|
||||
nextView();
|
||||
}
|
||||
}
|
||||
Keys.onPressed: {
|
||||
if (infoText.opacity > 0) {
|
||||
infoText.opacity = 0.0;
|
||||
} else {
|
||||
if (event.key == Qt.Key_Left) {
|
||||
previousView();
|
||||
} else {
|
||||
nextView();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function nextView() {
|
||||
var i = viewNumber + 1;
|
||||
if (i > viewCount)
|
||||
viewNumber = 1;
|
||||
else
|
||||
viewNumber = i;
|
||||
}
|
||||
|
||||
function previousView() {
|
||||
var i = viewNumber - 1;
|
||||
if (i <= 0)
|
||||
viewNumber = viewCount;
|
||||
else
|
||||
viewNumber = i;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,200 @@
|
|||
// checksum 0x78c version 0x60010
|
||||
/*
|
||||
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 <QtCore/QDir>
|
||||
#include <QtCore/QFileInfo>
|
||||
#include <QtDeclarative/QDeclarativeComponent>
|
||||
#include <QtDeclarative/QDeclarativeEngine>
|
||||
#include <QtDeclarative/QDeclarativeContext>
|
||||
#include <QtGui/QApplication>
|
||||
|
||||
#include <qplatformdefs.h> // MEEGO_EDITION_HARMATTAN
|
||||
|
||||
#ifdef HARMATTAN_BOOSTER
|
||||
#include <MDeclarativeCache>
|
||||
#endif
|
||||
|
||||
#if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800
|
||||
|
||||
#include <qt_private/qdeclarativedebughelper_p.h>
|
||||
|
||||
#if !defined(NO_JSDEBUGGER)
|
||||
#include <jsdebuggeragent.h>
|
||||
#endif
|
||||
#if !defined(NO_QMLOBSERVER)
|
||||
#include <qdeclarativeviewobserver.h>
|
||||
#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
|
||||
{
|
||||
QmlApplicationViewerPrivate(QDeclarativeView *view_) : view(view_) {}
|
||||
|
||||
QString mainQmlFile;
|
||||
QDeclarativeView *view;
|
||||
friend class QmlApplicationViewer;
|
||||
QString adjustPath(const QString &path);
|
||||
};
|
||||
|
||||
QString QmlApplicationViewerPrivate::adjustPath(const QString &path)
|
||||
{
|
||||
#ifdef Q_OS_UNIX
|
||||
#ifdef Q_OS_MAC
|
||||
if (!QDir::isAbsolutePath(path))
|
||||
return QCoreApplication::applicationDirPath()
|
||||
+ QLatin1String("/../Resources/") + path;
|
||||
#else
|
||||
QString pathInInstallDir;
|
||||
const QString applicationDirPath = QCoreApplication::applicationDirPath();
|
||||
pathInInstallDir = QString::fromAscii("%1/../%2").arg(applicationDirPath, path);
|
||||
|
||||
if (QFileInfo(pathInInstallDir).exists())
|
||||
return pathInInstallDir;
|
||||
#endif
|
||||
#endif
|
||||
return path;
|
||||
}
|
||||
|
||||
QmlApplicationViewer::QmlApplicationViewer(QWidget *parent)
|
||||
: QDeclarativeView(parent)
|
||||
, d(new QmlApplicationViewerPrivate(this))
|
||||
{
|
||||
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(d->view->engine());
|
||||
#endif
|
||||
#if !defined(NO_QMLOBSERVER)
|
||||
new QmlJSDebugger::QDeclarativeViewObserver(d->view, d->view);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
QmlApplicationViewer::QmlApplicationViewer(QDeclarativeView *view, QWidget *parent)
|
||||
: QDeclarativeView(parent)
|
||||
, d(new QmlApplicationViewerPrivate(view))
|
||||
{
|
||||
connect(view->engine(), SIGNAL(quit()), view, SLOT(close()));
|
||||
view->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(d->view->engine());
|
||||
#endif
|
||||
#if !defined(NO_QMLOBSERVER)
|
||||
new QmlJSDebugger::QDeclarativeViewObserver(d->view, d->view);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
QmlApplicationViewer::~QmlApplicationViewer()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
QmlApplicationViewer *QmlApplicationViewer::create()
|
||||
{
|
||||
#ifdef HARMATTAN_BOOSTER
|
||||
return new QmlApplicationViewer(MDeclarativeCache::qDeclarativeView(), 0);
|
||||
#else
|
||||
return new QmlApplicationViewer();
|
||||
#endif
|
||||
}
|
||||
|
||||
void QmlApplicationViewer::setMainQmlFile(const QString &file)
|
||||
{
|
||||
d->mainQmlFile = d->adjustPath(file);
|
||||
d->view->setSource(QUrl::fromLocalFile(d->mainQmlFile));
|
||||
}
|
||||
|
||||
void QmlApplicationViewer::addImportPath(const QString &path)
|
||||
{
|
||||
d->view->engine()->addImportPath(d->adjustPath(path));
|
||||
}
|
||||
|
||||
void QmlApplicationViewer::setOrientation(ScreenOrientation orientation)
|
||||
{
|
||||
#if defined(Q_OS_SYMBIAN)
|
||||
// If the version of Qt on the device is < 4.7.2, that attribute won't work
|
||||
if (orientation != ScreenOrientationAuto) {
|
||||
const QStringList v = QString::fromAscii(qVersion()).split(QLatin1Char('.'));
|
||||
if (v.count() == 3 && (v.at(0).toInt() << 16 | v.at(1).toInt() << 8 | v.at(2).toInt()) < 0x040702) {
|
||||
qWarning("Screen orientation locking only supported with Qt 4.7.2 and above");
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif // Q_OS_SYMBIAN
|
||||
|
||||
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<Qt::WidgetAttribute>(128);
|
||||
break;
|
||||
case ScreenOrientationLockLandscape:
|
||||
attribute = static_cast<Qt::WidgetAttribute>(129);
|
||||
break;
|
||||
default:
|
||||
case ScreenOrientationAuto:
|
||||
attribute = static_cast<Qt::WidgetAttribute>(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);
|
||||
}
|
||||
|
||||
void QmlApplicationViewer::showExpanded()
|
||||
{
|
||||
#if defined(Q_OS_SYMBIAN) || defined(MEEGO_EDITION_HARMATTAN) || defined(Q_WS_SIMULATOR)
|
||||
d->view->showFullScreen();
|
||||
#elif defined(Q_WS_MAEMO_5)
|
||||
d->view->showMaximized();
|
||||
#else
|
||||
d->view->show();
|
||||
#endif
|
||||
}
|
||||
|
||||
QApplication *createApplication(int &argc, char **argv)
|
||||
{
|
||||
#ifdef HARMATTAN_BOOSTER
|
||||
return MDeclarativeCache::qApplication(argc, argv);
|
||||
#else
|
||||
return new QApplication(argc, argv);
|
||||
#endif
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
// checksum 0x82ed version 0x60010
|
||||
/*
|
||||
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 <QtDeclarative/QDeclarativeView>
|
||||
|
||||
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 Symbian and Fremantle.
|
||||
void setOrientation(ScreenOrientation orientation);
|
||||
|
||||
void showExpanded();
|
||||
|
||||
private:
|
||||
explicit QmlApplicationViewer(QDeclarativeView *view, QWidget *parent);
|
||||
class QmlApplicationViewerPrivate *d;
|
||||
};
|
||||
|
||||
QApplication *createApplication(int &argc, char **argv);
|
||||
|
||||
#endif // QMLAPPLICATIONVIEWER_H
|
|
@ -0,0 +1,13 @@
|
|||
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
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
!include( ../demos.pri ) {
|
||||
error( "Couldn't find the demos.pri file!" )
|
||||
}
|
||||
|
||||
RESOURCES += resources.qrc
|
||||
SOURCES += main.cpp
|
||||
|
||||
include(qmlapplicationviewer/qmlapplicationviewer.pri)
|
|
@ -0,0 +1,9 @@
|
|||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>qml/qmlaxes/loader.qml</file>
|
||||
<file>qml/qmlaxes/main.qml</file>
|
||||
<file>qml/qmlaxes/View1.qml</file>
|
||||
<file>qml/qmlaxes/View2.qml</file>
|
||||
<file>qml/qmlaxes/View3.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
|
@ -18,6 +18,7 @@
|
|||
<li><a href="demos-nesteddonuts.html">Nested donuts chart</a></li>
|
||||
<li><a href="demos-piechartcustomization.html">Pie chart customization</a></li>
|
||||
<li><a href="demos-qmlchart.html">Qml Basic Charts</a></li>
|
||||
<li><a href="demos-qmlaxes.html">Qml Axes</a></li>
|
||||
<li><a href="demos-qmlcustomizations.html">Qml Customizations</a></li>
|
||||
<li><a href="demos-qmlcustommodel.html">Qml Custom Model</a></li>
|
||||
<li><a href="demos-qmlf1legends.html">Qml F1 Legends</a></li>
|
||||
|
|
|
@ -72,6 +72,7 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE
|
|||
/*!
|
||||
\qmlclass DateTimeAxis QDateTimeAxis
|
||||
\brief The DateTimeAxis element is used for manipulating chart's axes
|
||||
\inherits AbstractAxis
|
||||
|
||||
The labels can be configured by setting an appropriate DateTime format.
|
||||
Note that any date before 4714 BCE or after about 1.4 million CE may not be accurately stored.
|
||||
|
@ -129,10 +130,30 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE
|
|||
*/
|
||||
|
||||
/*!
|
||||
\qmlproperty int ValuesAxis::tickCount
|
||||
\qmlproperty int DateTimeAxis::tickCount
|
||||
The number of tick marks for the axis.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\property QDateTimeAxis::format
|
||||
The format string that is used when creating label for the axis out of a QDateTime object.
|
||||
Check QDateTime documentation for information on how the string should be defined.
|
||||
*/
|
||||
/*!
|
||||
\qmlproperty string DateTimeAxis::format
|
||||
The format string that is used when creating label for the axis out of a QDateTime object.
|
||||
Check QDateTime documentation for information on how the string should be defined.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QDateTimeAxis::formatChanged(QString format)
|
||||
Axis emits signal when \a format of the axis has changed.
|
||||
*/
|
||||
/*!
|
||||
\qmlsignal DateTimeAxis::onFormatChanged(string format)
|
||||
Axis emits signal when \a format of the axis has changed.
|
||||
*/
|
||||
|
||||
/*!
|
||||
Constructs an axis object which is a child of \a parent.
|
||||
*/
|
||||
|
@ -213,22 +234,15 @@ void QDateTimeAxis::setRange(QDateTime min, QDateTime max)
|
|||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets \a format string that is used when creating label for the axis out of the QDateTime object.
|
||||
Check QDateTime documentation for information on how the string should be defined.
|
||||
\sa format()
|
||||
*/
|
||||
void QDateTimeAxis::setFormat(QString format)
|
||||
{
|
||||
Q_D(QDateTimeAxis);
|
||||
d->m_format = format;
|
||||
if (d->m_format != format) {
|
||||
d->m_format = format;
|
||||
emit formatChanged(format);
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the format string that is used when creating label for the axis out of the QDateTime object.
|
||||
Check QDateTime documentation for information on how the string should be defined.
|
||||
\sa setFormat()
|
||||
*/
|
||||
QString QDateTimeAxis::format() const
|
||||
{
|
||||
Q_D(const QDateTimeAxis);
|
||||
|
|
|
@ -35,6 +35,7 @@ class QTCOMMERCIALCHART_EXPORT QDateTimeAxis : public QAbstractAxis
|
|||
Q_PROPERTY(int tickCount READ tickCount WRITE setTickCount)
|
||||
Q_PROPERTY(QDateTime min READ min WRITE setMin NOTIFY minChanged)
|
||||
Q_PROPERTY(QDateTime max READ max WRITE setMax NOTIFY maxChanged)
|
||||
Q_PROPERTY(QString format READ format WRITE setFormat NOTIFY formatChanged)
|
||||
|
||||
public:
|
||||
explicit QDateTimeAxis(QObject *parent = 0);
|
||||
|
@ -64,6 +65,7 @@ Q_SIGNALS:
|
|||
void minChanged(QDateTime min);
|
||||
void maxChanged(QDateTime max);
|
||||
void rangeChanged(QDateTime min, QDateTime max);
|
||||
void formatChanged(QString format);
|
||||
|
||||
private:
|
||||
Q_DECLARE_PRIVATE(QDateTimeAxis)
|
||||
|
|
Loading…
Reference in New Issue