diff options
author | Petr Mrázek <peterix@gmail.com> | 2013-03-25 20:58:45 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2013-03-25 20:58:45 +0100 |
commit | d2eef6974be6c9d65f0108bb86fc94e141330c76 (patch) | |
tree | 91d9cef053a18ef2a81f58f436bc00e092369e32 /libgroupview/src | |
parent | 37852d47a7e5c3d65a0cfa127ced477b33eca269 (diff) | |
download | MultiMC-d2eef6974be6c9d65f0108bb86fc94e141330c76.tar MultiMC-d2eef6974be6c9d65f0108bb86fc94e141330c76.tar.gz MultiMC-d2eef6974be6c9d65f0108bb86fc94e141330c76.tar.lz MultiMC-d2eef6974be6c9d65f0108bb86fc94e141330c76.tar.xz MultiMC-d2eef6974be6c9d65f0108bb86fc94e141330c76.zip |
Mystery meat layout hack to get things aligned
Diffstat (limited to 'libgroupview/src')
-rw-r--r-- | libgroupview/src/kcategorizedview.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libgroupview/src/kcategorizedview.cpp b/libgroupview/src/kcategorizedview.cpp index 19f9a0af..4da4271f 100644 --- a/libgroupview/src/kcategorizedview.cpp +++ b/libgroupview/src/kcategorizedview.cpp @@ -452,7 +452,8 @@ void KCategorizedView::Private::leftToRightVisualRect ( const QModelIndex &index { const int relativeRow = index.row() - firstIndexRow; const QSize itemSize = q->sizeHintForIndex ( index ); - const int maxItemsPerRow = qMax ( ( viewportWidth() - q->spacing() ) / ( itemSize.width() + q->spacing() ), 1 ); + //HACK: Why is the -2 needed? + const int maxItemsPerRow = qMax ( ( viewportWidth() - q->spacing() - 2 ) / ( itemSize.width() + q->spacing() ), 1 ); if ( q->layoutDirection() == Qt::LeftToRight ) { item.topLeft.rx() = ( relativeRow % maxItemsPerRow ) * itemSize.width() + blockPos.x() + categoryDrawer->leftMargin(); @@ -1314,7 +1315,8 @@ QModelIndex KCategorizedView::moveCursor ( CursorAction cursorAction, const QSize itemSize = d->hasGrid() ? gridSize() : sizeHintForIndex ( current ); const Private::Block &block = d->blocks[d->categoryForIndex ( current )]; - const int maxItemsPerRow = qMax ( ( d->viewportWidth() - spacing() ) / ( itemSize.width() + spacing() ), 1 ); + //HACK: Why is the -2 needed? + const int maxItemsPerRow = qMax ( ( d->viewportWidth() - spacing() - 2 ) / ( itemSize.width() + spacing() ), 1 ); const bool canMove = current.row() + maxItemsPerRow < block.firstIndex.row() + block.items.count(); @@ -1354,7 +1356,8 @@ QModelIndex KCategorizedView::moveCursor ( CursorAction cursorAction, const QSize itemSize = d->hasGrid() ? gridSize() : sizeHintForIndex ( current ); const Private::Block &block = d->blocks[d->categoryForIndex ( current )]; - const int maxItemsPerRow = qMax ( ( d->viewportWidth() - spacing() ) / ( itemSize.width() + spacing() ), 1 ); + //HACK: Why is the -2 needed? + const int maxItemsPerRow = qMax ( ( d->viewportWidth() - spacing() - 2 ) / ( itemSize.width() + spacing() ), 1 ); const bool canMove = current.row() - maxItemsPerRow >= block.firstIndex.row(); if ( canMove ) |