diff options
author | Jan Dalheimer <jan@dalheimer.de> | 2013-12-27 00:03:24 +0100 |
---|---|---|
committer | Jan Dalheimer <jan@dalheimer.de> | 2013-12-27 00:03:24 +0100 |
commit | 01092206783f74ce14f31d328cdac025fd90fe16 (patch) | |
tree | 13b12448c36a82381e3ebbad5b53de4fa7cb55e2 | |
parent | f8d835cd22de89bc130ff0413228cfea0ebfd8ac (diff) | |
download | MultiMC-01092206783f74ce14f31d328cdac025fd90fe16.tar MultiMC-01092206783f74ce14f31d328cdac025fd90fe16.tar.gz MultiMC-01092206783f74ce14f31d328cdac025fd90fe16.tar.lz MultiMC-01092206783f74ce14f31d328cdac025fd90fe16.tar.xz MultiMC-01092206783f74ce14f31d328cdac025fd90fe16.zip |
Take the spacing into account
-rw-r--r-- | CategorizedView.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/CategorizedView.cpp b/CategorizedView.cpp index 6164cde6..c134220f 100644 --- a/CategorizedView.cpp +++ b/CategorizedView.cpp @@ -97,6 +97,7 @@ CategorizedView::CategorizedView(QWidget *parent) setWordWrap(true); setDragDropMode(QListView::InternalMove); setAcceptDrops(true); + setSpacing(10); m_cachedCategoryToIndexMapping.setMaxCost(50); m_cachedVisualRects.setMaxCost(50); @@ -308,7 +309,7 @@ int CategorizedView::categoryTop(const CategorizedView::Category *category) cons int CategorizedView::itemsPerRow() const { - return qFloor((qreal)contentWidth() / (qreal)itemSize().width()); + return qFloor((qreal)(contentWidth()) / (qreal)(itemWidth() + spacing())); } int CategorizedView::contentWidth() const { @@ -740,7 +741,7 @@ QRect CategorizedView::visualRect(const QModelIndex &index) const QRect *out = new QRect; out->setTop(categoryTop(cat) + cat->headerHeight() + 5 + y * size.height()); - out->setLeft(x * size.width()); + out->setLeft(spacing() + x * itemWidth() + x * spacing()); out->setSize(size); m_cachedVisualRects.insert(index, out); |