qchartaxiscategories.cpp
96 lines
| 2.2 KiB
| text/x-c
|
CppLexer
|
r794 | /**************************************************************************** | ||
** | ||||
** 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$ | ||||
** | ||||
****************************************************************************/ | ||||
|
r445 | #include "qchartaxiscategories.h" | ||
|
r963 | #include "qchartaxiscategories_p.h" | ||
|
r445 | |||
QTCOMMERCIALCHART_BEGIN_NAMESPACE | ||||
|
r963 | QChartAxisCategories::QChartAxisCategories(): | ||
d_ptr(new QChartAxisCategoriesPrivate(this)) | ||||
|
r445 | { | ||
} | ||||
QChartAxisCategories::~QChartAxisCategories() | ||||
{ | ||||
|
r963 | |||
|
r445 | } | ||
|
r759 | void QChartAxisCategories::insert(const QBarCategories &categories) | ||
|
r701 | { | ||
int i=1; | ||||
|
r759 | foreach (QString string , categories) { | ||
|
r963 | d_ptr->m_map.insert(i,string); | ||
|
r701 | i++; | ||
} | ||||
|
r963 | emit d_ptr->updated(); | ||
|
r701 | } | ||
|
r445 | void QChartAxisCategories::insert(qreal value,QString label) | ||
{ | ||||
|
r963 | d_ptr->m_map.insert(value,label); | ||
emit d_ptr->updated(); | ||||
|
r445 | } | ||
|
r706 | |||
|
r445 | void QChartAxisCategories::remove(qreal value) | ||
{ | ||||
|
r963 | d_ptr->m_map.remove(value); | ||
emit d_ptr->updated(); | ||||
|
r445 | } | ||
|
r706 | |||
|
r445 | void QChartAxisCategories::clear() | ||
{ | ||||
|
r963 | d_ptr->m_map.clear(); | ||
emit d_ptr->updated(); | ||||
|
r445 | } | ||
|
r706 | |||
|
r445 | int QChartAxisCategories::count() | ||
{ | ||||
|
r963 | return d_ptr->m_map.count(); | ||
|
r445 | } | ||
|
r706 | QList<qreal> QChartAxisCategories::values() const | ||
{ | ||||
|
r963 | return d_ptr->m_map.keys(); | ||
|
r706 | } | ||
|
r497 | QString QChartAxisCategories::label(qreal value) const | ||
{ | ||||
|
r963 | return d_ptr->m_map.value(value); | ||
} | ||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||||
QChartAxisCategoriesPrivate::QChartAxisCategoriesPrivate(QChartAxisCategories *q): | ||||
q_ptr(q) | ||||
{ | ||||
} | ||||
QChartAxisCategoriesPrivate::~QChartAxisCategoriesPrivate() | ||||
{ | ||||
|
r497 | } | ||
|
r445 | #include "moc_qchartaxiscategories.cpp" | ||
|
r963 | #include "moc_qchartaxiscategories_p.cpp" | ||
|
r445 | |||
QTCOMMERCIALCHART_END_NAMESPACE | ||||