-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New option in the context menu for using the value as filter #1182
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
Conversation
…cell as filter in this column. This allows quick filtering by selected values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this PR. This is a very good idea and a pretty good and simple implementation 👍 I've found just one minor issue. I hope I can explain it well enough 😉
src/ExtendedTableWidget.cpp
Outdated
if (!index.isValid() || !selectionModel()->hasSelection()) | ||
return; | ||
|
||
m_tableHeader->setFilter(index.column(), "=" + model()->data(index).toString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One minor thing here: you should probably use the Qt::EditRole
in the data()
call here. We use that to get the actual, unmodified cell data instead of what is shown to the user. Without this, 1) a low 'Symbol limit in cell' option can mean that we're filtering for the truncated string, 2) filtering for a BLOB value would literally filter for 'BLOB' which doesn't seem right either, and 3) filtering for NULL values wouldn't work if the 'NULL fields Text' option is set to something other than 'NULL'.
When changing to Qt::EditRole
you'll need to check for isNull()
though and filter for '=NULL' if that's true. Currently this works sort of automatically but only as long as the null text is set to 'NULL' in the settings.
…get internal cell data and check for the NULL special case.
@MKleusberg I hope I have addressed your requests. Thanks for the feedback. |
Yes, that's perfect 😄 Thanks again for your PR. It's very much appreciated 😄 If you ever feel like coding some more, you're welcome to do so. If I can somehow help you with that, just email me or open a half-finished PR. |
Thank you. In fact I'm working on updating the Spanish translation so you can expect at least one more :-) |
Awesome 😄 Good luck with that 😉 |
…ed table name is actually a view (#1196) * Added an option in the context menu for using the currently selected cell as filter in this column. This allows quick filtering by selected values. * Changes to pull request #1182 requested by @MKleusberg: get internal cell data and check for the NULL special case. * Updated Spanish translation. Reviewed translation following guidelines the KDE Spanish Translation Team: https://es.l10n.kde.org/ Warnings raised by linguist have been solved. * Fixed crashed when editing the display format and the currently browsed table name is actually a view. Now it is checked the object type before the cast. This avoids the crash and the field name is obtained for each case.
Added an option in the context menu of the extended table widget for using the currently selected cell value as filter for this column. This allows quick filtering by visible values.