summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2014-02-02 18:30:52 +0100
committerPetr Mrázek <peterix@gmail.com>2014-02-02 18:30:52 +0100
commitddedd077b66f2bf45cd157d760eebdad15bcb289 (patch)
treef78c4a30a8e25f158577f962fb3f9a1bfb48411c
parent2cd9b0647640ee595113ceca128db1131bebc19a (diff)
downloadMultiMC-ddedd077b66f2bf45cd157d760eebdad15bcb289.tar
MultiMC-ddedd077b66f2bf45cd157d760eebdad15bcb289.tar.gz
MultiMC-ddedd077b66f2bf45cd157d760eebdad15bcb289.tar.lz
MultiMC-ddedd077b66f2bf45cd157d760eebdad15bcb289.tar.xz
MultiMC-ddedd077b66f2bf45cd157d760eebdad15bcb289.zip
Oh my.
-rw-r--r--GroupView.cpp40
-rw-r--r--GroupView.h15
2 files changed, 37 insertions, 18 deletions
diff --git a/GroupView.cpp b/GroupView.cpp
index b47cf93f..3296ccfb 100644
--- a/GroupView.cpp
+++ b/GroupView.cpp
@@ -727,19 +727,14 @@ QList<QPair<QRect, QModelIndex>> GroupView::draggablePaintPairs(const QModelInde
{
Q_ASSERT(r);
QRect &rect = *r;
- const QRect viewportRect = viewport()->rect();
QList<QPair<QRect, QModelIndex>> ret;
for (int i = 0; i < indices.count(); ++i)
{
const QModelIndex &index = indices.at(i);
const QRect current = geometryRect(index);
- //if (current.intersects(viewportRect))
- //{
- ret += qMakePair(current, index);
- rect |= current;
- //}
+ ret += qMakePair(current, index);
+ rect |= current;
}
- //rect &= viewportRect;
return ret;
}
@@ -876,3 +871,34 @@ QRegion GroupView::visualRegionForSelection(const QItemSelection &selection) con
}
return region;
}
+QModelIndex GroupView::moveCursor(QAbstractItemView::CursorAction cursorAction,
+ Qt::KeyboardModifiers modifiers)
+{
+ auto current = currentIndex();
+ if(!current.isValid())
+ {
+ qDebug() << "model row: invalid";
+ return current;
+ }
+ qDebug() << "model row: " << current.row();
+ auto cat = category(current);
+ int i = m_categories.indexOf(cat);
+ if(i >= 0)
+ {
+ // this is a pile of something foul
+ auto real_cat = m_categories[i];
+ int beginning_row = 0;
+ for(auto catt: m_categories)
+ {
+ if(catt == real_cat)
+ break;
+ beginning_row += catt->numRows();
+ }
+ qDebug() << "category: " << real_cat->text;
+ QPair<int, int> pos = categoryInternalPosition(current);
+ int row = beginning_row + pos.second;
+ qDebug() << "row: " << row;
+ qDebug() << "column: " << pos.first;
+ }
+ return current;
+}
diff --git a/GroupView.h b/GroupView.h
index 2c60f0e9..a7ed8e9d 100644
--- a/GroupView.h
+++ b/GroupView.h
@@ -30,10 +30,6 @@ public:
void setSelection(const QRect &rect,
const QItemSelectionModel::SelectionFlags commands) override;
- /*
- * BS
- */
-
virtual int horizontalOffset() const override
{
return horizontalScrollBar()->value();
@@ -50,22 +46,19 @@ public:
viewport()->scroll(dx, dy);
}
+ /*
+ * TODO!
+ */
virtual void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible) override
{
return;
}
virtual QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers)
- override
- {
- return QModelIndex();
- }
+ override;
virtual QRegion visualRegionForSelection(const QItemSelection &selection) const override;
- /*
- * End of BS
- */
protected
slots: