Oh my.
This commit is contained in:
parent
2cd9b06476
commit
ddedd077b6
@ -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;
|
||||
}
|
||||
|
15
GroupView.h
15
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:
|
||||
|
Loading…
Reference in New Issue
Block a user