Skip to content

QskTreeView - #310

Open
rick-vogel wants to merge 5 commits into
uwerat:masterfrom
rick-vogel:qsktreeview
Open

QskTreeView#310
rick-vogel wants to merge 5 commits into
uwerat:masterfrom
rick-vogel:qsktreeview

Conversation

@rick-vogel

@rick-vogel rick-vogel commented Apr 28, 2023

Copy link
Copy Markdown
Collaborator

Relates to #309

image

Tree View

  • use existing scene graph node recycling
  • at least one row can be selected
  • alternating row colors
  • specific row color
  • specific cell text

The core change for the styling are these functions:

./src/controls/QskListView.h

virtual QskAspect::Subcontrol rowSubControl( int row ) const noexcept;
virtual QskAspect::Subcontrol cellSubControl( int row, int col ) const noexcept;
virtual QskAspect::Subcontrol textSubControl( int row, int col ) const noexcept;

@rick-vogel
rick-vogel requested a review from uwerat April 28, 2023 08:49
Comment thread CMakeLists.txt
HOMEPAGE_URL "https://github.com/uwerat/qskinny"
VERSION 0.8.0)

if(MSVC)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

  • move/remove before merging


qreal TreeBox::rowOffset( int row ) const
{
return ( row % 4 ) * 10;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

In a real scenerio the user must provide usefull offsets for a valid tree structure

{
return Cell;
}
return row % 2 == 0 ? Cell : QskAspect::NoSubcontrol;

@rick-vogel rick-vogel Apr 28, 2023

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@uwerat this is somewhat for keeping compatible, since in the previous implementation alternating color meant colored box node, no box node, colored box node, ...


QskSkinStateChanger stateChanger( listView );
stateChanger.setStates( listView->skinStates() | QskListView::Selected );
boxNode = updateBoxNode( listView, boxNode, boxRect, subControl );

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

this call to updateBoxNodecan fail such that it returns nullptr e.g. when the box color/gradient hint is transparent or the rectangle is empty

@uwerat maybe naming these functions to updateOrCreateBoxNode would help the communicate their behavior. Especially since we give the function a node pointer ( that can be nullptr ) and get a pointer back. Is a passed in non-null pointer always the returned pointer?

}

const auto margins = listView->paddingHint( QskListView::Cell );
const auto subControl = listView->rowSubControl(0);

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

  • this must be fixed / handled per column

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant