~ubuntu-branches/ubuntu/vivid/lightdm-kde/vivid

« back to all changes in this revision

Viewing changes to greeter/extrarowproxymodel.h

  • Committer: Package Import Robot
  • Author(s): Michal Zajac
  • Date: 2012-07-22 19:44:44 UTC
  • mfrom: (1.1.3)
  • Revision ID: package-import@ubuntu.com-20120722194444-aaueaylu3ddnqcth
Tags: 0.2.1-0ubuntu1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
#include <QHash>
24
24
#include <QVector>
25
25
#include <QWeakPointer>
 
26
#include <QStandardItemModel>
26
27
 
27
28
/**
28
29
 * A proxy model which makes it possible to append extra rows at the end
33
34
public:
34
35
    ExtraRowProxyModel(QObject *parent = 0);
35
36
 
36
 
    /**
37
 
     * Append a row, returns a row id
38
 
     */
39
 
    int appendRow();
40
 
 
41
 
    void setRowData(int id, int column, const QVariant &value, int role);
42
 
    void setRowText(int id, int column, const QVariant &value);
43
 
 
44
37
    int rowCount(const QModelIndex &parent = QModelIndex()) const; // reimp
45
38
    QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; // reimp
46
39
 
47
40
    void setSourceModel(QAbstractItemModel* model);
48
41
 
 
42
    /** Returns a pointer to the extra row model, which can be edited as appropriate*/
 
43
    QStandardItemModel* extraRowModel() const;
 
44
 
49
45
private slots:
50
46
    void onSourceRowsInserted(const QModelIndex &parent,int start,int end);
51
47
    void onSourceRowsRemoved(const QModelIndex &parent,int start,int end);
52
48
    void onSourceDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
53
49
 
 
50
    void onExtraRowsInserted(const QModelIndex &parent,int start,int end);
 
51
    void onExtraRowsRemoved(const QModelIndex &parent,int start,int end);
 
52
    void onExtraDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
 
53
 
 
54
 
54
55
private:
55
56
    typedef QHash<int, QVariant> Item; //role, item.
56
57
    typedef QHash<int, Item> Row; //column, item
57
58
    typedef QVector<Row> Rows;
58
59
 
 
60
    int sourceRowCount() const;
 
61
 
59
62
    QWeakPointer<QAbstractItemModel> m_model;
 
63
    QStandardItemModel *m_extraRowModel;
60
64
    Rows m_rows;
61
65
};
62
66