~ubuntu-branches/ubuntu/precise/koffice/precise

« back to all changes in this revision

Viewing changes to kchart/shape/KDChartModel.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2010-09-21 15:36:35 UTC
  • mfrom: (1.4.1 upstream) (60.2.11 maverick)
  • Revision ID: james.westby@ubuntu.com-20100921153635-6tejqkiro2u21ydi
Tags: 1:2.2.2-0ubuntu3
Add kubuntu_03_fix-crash-on-closing-sqlite-connection-2.2.2.diff and
kubuntu_04_support-large-memo-values-for-msaccess-2.2.2.diff as
recommended by upstream http://kexi-
project.org/wiki/wikiview/index.php@Kexi2.2_Patches.html#sqlite_stab
ility

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* This file is part of the KDE project
2
2
 
3
3
   Copyright 2008 Johannes Simon <johannes.simon@gmail.com>
 
4
   Copyright (C) 2010 Carlos Licea <carlos@kdab.com>
 
5
   Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
 
6
     Contact: Suresh Chande suresh.chande@nokia.com
4
7
 
5
8
   This library is free software; you can redistribute it and/or
6
9
   modify it under the terms of the GNU Library General Public
31
34
 
32
35
namespace KChart {
33
36
 
 
37
/**
 
38
 * Takes a list of DataSet's and compiles them into a
 
39
 * QAbstractItemModel for use with KDChart.
 
40
 *
 
41
 * Data sets in this model are aligned column-wise. Each column
 
42
 * occupies dimension() columns. For example, for an X/Y chart,
 
43
 * the data of this model would be structured as follows:
 
44
 *
 
45
 *             Brush 0       Brush 1
 
46
 *             Pen 0         Pen 1
 
47
 *             Label 0       Label 1
 
48
 * -----------|------|------|------|------|
 
49
 * Category 1 | x0,0 | y0,0 | x1,0 | x1,0 |
 
50
 * -----------|------|------|------|------|
 
51
 * Category 2 | x0,1 | y0,1 | x1,1 | x1,1 |
 
52
 * -----------|------|------|------|------|
 
53
 * Category 3 | x0,2 | y0,2 | x1,2 | x1,2 |
 
54
 * -----------|------|------|------|------|
 
55
 *
 
56
 */
 
57
 
34
58
class CHARTSHAPELIB_EXPORT KDChartModel : public QAbstractItemModel
35
59
{
36
60
    Q_OBJECT
38
62
public:
39
63
    KDChartModel( QObject *parent = 0 );
40
64
    ~KDChartModel();
 
65
 
 
66
    enum DataRole {
 
67
        XDataRole,
 
68
        YDataRole,
 
69
        ZDataRole,
 
70
        LabelDataRole,
 
71
        CategoryDataRole,
 
72
        CustomDataRole,
 
73
        BrushDataRole,
 
74
        PenDataRole,
 
75
        PieAttributesRole
 
76
    };
41
77
    
 
78
    /**
 
79
     * Specifies in what direction a data set 'points'. More specifically,
 
80
     * if the data direction is Qt::Vertical, a data set occupies one
 
81
     * column (in case only one data dimension is being used).
 
82
     */
42
83
    void setDataDirection( Qt::Orientation direction );
 
84
    /**
 
85
     * See \a setDataDirection
 
86
     */
43
87
    Qt::Orientation dataDirection() const;
 
88
    /**
 
89
     * Returns the opposite of dataDirection().
 
90
     */
 
91
    Qt::Orientation categoryDirection() const;
44
92
 
45
93
public slots:
46
94
    QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const;
47
95
    QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;
48
96
 
49
 
    void dataChanged( const QModelIndex& topLeft, const QModelIndex& bottomRight );
50
 
    void dataSetSizeChanged( DataSet *dataSet, int newSize );
51
97
    void slotColumnsInserted( const QModelIndex& parent, int start, int end );
52
98
    
53
99
    QModelIndex index( int row, int column, const QModelIndex &parent = QModelIndex() ) const;
62
108
    void addDataSet( DataSet *dataSet, bool silent = false );
63
109
    void removeDataSet( DataSet *dataSet, bool silent = false );
64
110
    QList<DataSet*> dataSets() const;
 
111
 
 
112
    void dataSetChanged( DataSet *dataSet );
 
113
    void dataSetChanged( DataSet *dataSet, DataRole role, int first, int last = -1 );
 
114
    void dataSetSizeChanged( DataSet *dataSet, int newSize );
65
115
    
66
116
    void emitReset();
67
117