Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use columns for file name, directory, and state when files are shown as a list in TreeViews. Resolves Dense layout issue #547 #632

Closed
wants to merge 2 commits into from

Conversation

gh-devnull
Copy link
Contributor

The new list view looks like this:
image

…as a list in TreeViews. Resolves Dense layout issue Murmele#547
@gh-devnull gh-devnull mentioned this pull request Aug 31, 2023
Comment on lines -13 to -43
// Draw >.
if (mDrawArrow && index.model()->hasChildren(index)) {
painter->save();
painter->setRenderHint(QPainter::Antialiasing, true);

QColor color = opt.palette.color(QPalette::Active, QPalette::BrightText);
if (opt.state & QStyle::State_Selected)
color =
!opt.showDecorationSelected
? opt.palette.color(QPalette::Active, QPalette::WindowText)
: opt.palette.color(QPalette::Active, QPalette::HighlightedText);

painter->setPen(color);
painter->setBrush(color);

int x = opt.rect.x() + opt.rect.width() - 3;
int y = opt.rect.y() + (opt.rect.height() / 2);

QPainterPath path;
path.moveTo(x, y);
path.lineTo(x - 5, y - 3);
path.lineTo(x - 5, y + 3);
path.closeSubpath();
painter->drawPath(path);

painter->restore();

// Adjust rect to exclude the arrow.
opt.rect.adjust(0, 0, -11, 0);
}

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine, can be removed because it will be set always to false in the DoubleTreeWidget

Comment on lines -163 to -169
TreeProxy *treewrapperStaged = new TreeProxy(true, this);
treewrapperStaged->setSourceModel(mDiffTreeModel);
stagedFiles->setModel(treewrapperStaged);
stagedFiles->setHeaderHidden(true);
ViewDelegate *stagedDelegate = new ViewDelegate();
stagedDelegate->setDrawArrow(false);
stagedFiles->setItemDelegateForColumn(0, stagedDelegate);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fine

Comment on lines -195 to -201
TreeProxy *treewrapperUnstaged = new TreeProxy(false, this);
treewrapperUnstaged->setSourceModel(mDiffTreeModel);
unstagedFiles->setModel(treewrapperUnstaged);
unstagedFiles->setHeaderHidden(true);
ViewDelegate *unstagedDelegate = new ViewDelegate();
unstagedDelegate->setDrawArrow(false);
unstagedFiles->setItemDelegateForColumn(0, unstagedDelegate);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fine

Comment on lines -26 to -27
TreeProxy::TreeProxy(bool staged, QObject *parent)
: QSortFilterProxyModel(parent), mStaged(staged) {}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fine

Comment on lines +51 to +53
connect(RepoView::parentView(this)->repo().notifier(),
&git::RepositoryNotifier::referenceUpdated, this,
&TreeView::updateView);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need this explicitly? An update comes from the DoubleTreewidget

@Murmele
Copy link
Owner

Murmele commented Nov 12, 2023

In your build single column listview is anymore possible, It would be nice to have this possibility

@Murmele
Copy link
Owner

Murmele commented Nov 12, 2023

image

Something is not working yet

src/ui/ViewDelegate.cpp Show resolved Hide resolved
@Murmele
Copy link
Owner

Murmele commented Nov 12, 2023

closed in favour of #664

@Murmele Murmele closed this Nov 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants