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

Proto Model Header Data Mutation #167

Merged
merged 4 commits into from Aug 28, 2020
Merged

Conversation

RobertBColton
Copy link
Contributor

@RobertBColton RobertBColton commented Aug 28, 2020

This is an alternative to #166 that adds the ability to mutate the header data returned by the base proto model. I use it to give the column headers of the path editor's points list special icons. I hid the vertical header of the path points list table too because we don't actually want it and it started showing row numbers now that my implementation allows the base QAbstractItemModel::headerData to return the section number as a string for Qt::DisplayRole role. We can also use this later to translate the column headers displaying field names for i18n.

I was also thinking that this could be static and fundies did mention I could just use the proto type name so that messages still get unique header data. However, I don't know what other kind of dynamic crap we might want to do so I decided not to make it static yet. Static doesn't exactly work with things like sorting and other transformations of the data.

Copy link
Contributor

@fundies fundies left a comment

Choose a reason for hiding this comment

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

Perhaps its better to just store the string in the QVariant as I think those can be cast to icon or pixmap or whatever with QVariant.as<QIcon>()

@RobertBColton RobertBColton merged commit f2f3ba7 into master Aug 28, 2020
@RobertBColton RobertBColton deleted the message-model-header-mutation branch August 28, 2020 21:54
@RobertBColton
Copy link
Contributor Author

I didn't do that fundies because I want to be able to set the tooltip and stuff too. In the room layers view I'm just going to show eyeball icon for layer visiblity with a "Visible" tooltip.

This was referenced Sep 5, 2020
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.

None yet

2 participants