diff options
| author | Mikaël Capelle <capelle.mikael@gmail.com> | 2020-12-30 00:41:37 +0100 |
|---|---|---|
| committer | Mikaël Capelle <capelle.mikael@gmail.com> | 2021-01-02 15:38:16 +0100 |
| commit | f906229a914d62d62f8a322375b4693ced2f8f32 (patch) | |
| tree | e0f35191f084f23770f595da6f659233a60900b6 /src/modlistview.cpp | |
| parent | 41467d8e217da31cdd99c6dde76429d97b99cb7a (diff) | |
Fix indent when grouping by category/nexus id.
Diffstat (limited to 'src/modlistview.cpp')
| -rw-r--r-- | src/modlistview.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/modlistview.cpp b/src/modlistview.cpp index bda7ac4d..9d0335b3 100644 --- a/src/modlistview.cpp +++ b/src/modlistview.cpp @@ -46,17 +46,17 @@ public: class ModListStyledItemDelegated : public QStyledItemDelegate
{
- QTreeView* m_view;
+ ModListView* m_view;
public:
- ModListStyledItemDelegated(QTreeView* view) :
+ ModListStyledItemDelegated(ModListView* view) :
QStyledItemDelegate(view), m_view(view) { }
using QStyledItemDelegate::QStyledItemDelegate;
void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const override {
QStyleOptionViewItem opt(option);
- if (index.column() == 0) {
+ if (index.column() == 0 && m_view->hasCollapsibleSeparators()) {
if (!index.model()->hasChildren(index) && index.parent().isValid()) {
auto parentIndex = index.parent().data(ModList::IndexRole).toInt();
if (ModInfo::getByIndex(parentIndex)->isSeparator()) {
@@ -665,10 +665,12 @@ void ModListView::setup(OrganizerCore& core, Ui::MainWindow* mwui) QRect ModListView::visualRect(const QModelIndex& index) const
{
QRect rect = QTreeView::visualRect(index);
- if (index.isValid() && !index.model()->hasChildren(index) && index.parent().isValid()) {
- auto parentIndex = index.parent().data(ModList::IndexRole).toInt();
- if (ModInfo::getByIndex(parentIndex)->isSeparator()) {
- rect.adjust(-indentation(), 0, 0, 0);
+ if (hasCollapsibleSeparators()) {
+ if (index.isValid() && !index.model()->hasChildren(index) && index.parent().isValid()) {
+ auto parentIndex = index.parent().data(ModList::IndexRole).toInt();
+ if (ModInfo::getByIndex(parentIndex)->isSeparator()) {
+ rect.adjust(-indentation(), 0, 0, 0);
+ }
}
}
return rect;
|
