~ubuntu-branches/ubuntu/saucy/digikam/saucy

« back to all changes in this revision

Viewing changes to libs/widgets/common/kcategorizedview_p.h

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2010-12-21 23:19:11 UTC
  • mfrom: (1.2.33 upstream) (3.1.7 experimental)
  • Revision ID: james.westby@ubuntu.com-20101221231911-z9jip7s5aht1jqn9
Tags: 2:1.7.0-1ubuntu1
* Merge from Debian Experimental. Remaining Ubuntu changes:
  - Export .pot name and copy to plugins in debian/rules
  - Version build-depends on kipi-plugins-dev to ensure build is against the
    same version on all archs
* Drop debian/patches/kubuntu_01_linker.diff, incoporated upstream
* Remove patches directory and unused patches

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
class SparseModelIndexVector : public QVector<QModelIndex>
29
29
{
30
30
public:
31
 
    SparseModelIndexVector(int rowCount, QAbstractItemModel *model, int column)
 
31
    SparseModelIndexVector(int rowCount, QAbstractItemModel* model, int column)
32
32
        : QVector<QModelIndex>(rowCount), model(model), column(column)
33
33
    {
34
34
    }
35
35
 
36
 
    inline QModelIndex & operator[](int i)
 
36
    inline QModelIndex& operator[](int i)
37
37
    {
38
 
        QModelIndex &index = QVector<QModelIndex>::operator[](i);
 
38
        QModelIndex& index = QVector<QModelIndex>::operator[](i);
 
39
 
39
40
        if (!index.isValid())
 
41
        {
40
42
            index = model->index(i, column);
 
43
        }
 
44
 
41
45
        return index;
42
46
    }
43
47
private:
44
48
    // not to be used
45
 
    const QModelIndex & operator[](int i) const { return QVector<QModelIndex>::operator[](i); }
 
49
    const QModelIndex& operator[](int i) const
 
50
    {
 
51
        return QVector<QModelIndex>::operator[](i);
 
52
    }
46
53
 
47
 
    QAbstractItemModel *model;
 
54
    QAbstractItemModel* model;
48
55
    int                 column;
49
56
};
50
57
 
54
61
class KCategorizedView::Private
55
62
{
56
63
public:
57
 
    Private(KCategorizedView *listView);
 
64
    Private(KCategorizedView* listView);
58
65
    ~Private();
59
66
 
60
67
 
63
70
    /**
64
71
      * Returns the list of items that intersects with @p rect
65
72
      */
66
 
    const QModelIndexList &intersectionSet(const QRect &rect);
 
73
    const QModelIndexList& intersectionSet(const QRect& rect);
67
74
 
68
75
    /**
69
76
      * Gets the item rect in the viewport for @p index
70
77
      */
71
 
    QRect visualRectInViewport(const QModelIndex &index) const;
 
78
    QRect visualRectInViewport(const QModelIndex& index) const;
72
79
 
73
80
    /**
74
81
      * Returns the category rect in the viewport for @p category
75
82
      */
76
 
    QRect visualCategoryRectInViewport(const QString &category) const;
 
83
    QRect visualCategoryRectInViewport(const QString& category) const;
77
84
 
78
85
    /**
79
86
      * Caches and returns the rect that corresponds to @p index
80
87
      */
81
 
    const QRect &cacheIndex(const QModelIndex &index);
 
88
    const QRect& cacheIndex(const QModelIndex& index);
82
89
 
83
90
    /**
84
91
      * Caches and returns the rect that corresponds to @p category
85
92
      */
86
 
    const QRect &cacheCategory(const QString &category);
 
93
    const QRect& cacheCategory(const QString& category);
87
94
 
88
95
    /**
89
96
      * Returns the rect that corresponds to @p index
90
97
      * @note If the rect is not cached, it becomes cached
91
98
      */
92
 
    const QRect &cachedRectIndex(const QModelIndex &index);
 
99
    const QRect& cachedRectIndex(const QModelIndex& index);
93
100
 
94
101
    /**
95
102
      * Returns the rect that corresponds to @p category
96
103
      * @note If the rect is not cached, it becomes cached
97
104
      */
98
 
    const QRect &cachedRectCategory(const QString &category);
 
105
    const QRect& cachedRectCategory(const QString& category);
99
106
 
100
107
    /**
101
108
      * Returns the visual rect (taking in count x and y offsets) for @p index
102
109
      * @note If the rect is not cached, it becomes cached
103
110
      */
104
 
    QRect visualRect(const QModelIndex &index);
 
111
    QRect visualRect(const QModelIndex& index);
105
112
 
106
113
    /**
107
114
      * Returns the visual rect (taking in count x and y offsets) for @p category
108
115
      * @note If the rect is not cached, it becomes cached
109
116
      */
110
 
    QRect categoryVisualRect(const QString &category);
 
117
    QRect categoryVisualRect(const QString& category);
111
118
 
112
119
    /**
113
120
      * Returns the contents size of this view (topmost category to bottommost index + spacing)
119
126
      * @p index on the rect specified by @p option.rect, with
120
127
      * painter @p painter
121
128
      */
122
 
    void drawNewCategory(const QModelIndex &index,
 
129
    void drawNewCategory(const QModelIndex& index,
123
130
                         int sortRole,
124
 
                         const QStyleOption &option,
125
 
                         QPainter *painter);
 
131
                         const QStyleOption& option,
 
132
                         QPainter* painter);
126
133
 
127
134
    /**
128
135
      * This method will update scrollbars ranges. Called when our model changes
133
140
    /**
134
141
      * This method will draw dragged items in the painting operation
135
142
      */
136
 
    void drawDraggedItems(QPainter *painter);
 
143
    void drawDraggedItems(QPainter* painter);
137
144
 
138
145
    /**
139
146
      * This method will determine which rect needs to be updated because of a
145
152
      * This method will, starting from the index at begin in the given (sorted) modelIndex List,
146
153
      * find the last index having the same category as the index to begin with.
147
154
      */
148
 
    int categoryUpperBound(SparseModelIndexVector &modelIndexList, int begin, int averageSize = 0);
 
155
    int categoryUpperBound(SparseModelIndexVector& modelIndexList, int begin, int averageSize = 0);
149
156
 
150
157
    /**
151
158
      * Returns a QItemSelection for all items intersection rect.
152
159
      */
153
 
    QItemSelection selectionForRect(const QRect &rect);
 
160
    QItemSelection selectionForRect(const QRect& rect);
154
161
 
155
162
    // Attributes
156
163