Merge branch 'master' into editbubble

This commit is contained in:
Sebastian Kügler 2011-11-25 19:04:41 +01:00
commit a82d043931
3 changed files with 30 additions and 1 deletions

View File

@ -123,6 +123,18 @@ void SortFilterModel::setSortOrder(const Qt::SortOrder order)
sort(0, order);
}
QVariantHash SortFilterModel::get(int row) const
{
QModelIndex idx = index(row, 0);
QVariantHash hash;
QHash<int, QByteArray>::const_iterator i;
for (i = roleNames().constBegin(); i != roleNames().constEnd(); ++i) {
hash[i.value()] = data(idx, i.key());
}
return hash;
}
@ -423,6 +435,19 @@ int DataModel::columnCount(const QModelIndex &parent) const
return 1;
}
QVariantHash DataModel::get(int row) const
{
QModelIndex idx = index(row, 0);
QVariantHash hash;
QHash<int, QByteArray>::const_iterator i;
for (i = roleNames().constBegin(); i != roleNames().constEnd(); ++i) {
hash[i.value()] = data(idx, i.key());
}
return hash;
}
int DataModel::roleNameToId(const QString &name)
{
if (!m_roleIds.contains(name)) {

View File

@ -68,6 +68,8 @@ public:
int count() const {return QSortFilterProxyModel::rowCount();}
Q_INVOKABLE QVariantHash get(int i) const;
Q_SIGNALS:
void countChanged();
@ -124,6 +126,8 @@ public:
int count() const {return countItems();}
Q_INVOKABLE QVariantHash get(int i) const;
protected:
void setItems(const QString &sourceName, const QVariantList &list);
inline int countItems() const;

View File

@ -190,7 +190,7 @@ Item {
MouseArea {
id: dragArea
anchors.fill: parent
enabled: scrollbar.enabled
//enabled: scrollbar.enabled
drag {
target: handle
axis: Drag.YAxis