-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Fix track color library inline editing #2517
Conversation
@@ -723,6 +723,10 @@ QVariant BaseSqlTableModel::data(const QModelIndex& index, int role) const { | |||
// role | |||
switch (role) { | |||
case Qt::ToolTipRole: | |||
if (column == fieldIndex(ColumnCache::COLUMN_LIBRARYTABLE_COLOR)) { |
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.
Wouldn't QVariant() work be more appropriate here?
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.
This works for me:
const auto color = mixxx::RgbColor::optional(value);
if (color) {
value = mixxx::toQColor(color).name();
} else {
value = QString();
}
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.
Maybe add a reusable, free function to rgbcolor.h
:
QString nullableName(mixxx::RgbColor::optional_t color);
Please note that QColor().name() seems to return "#000000", i.e. black although undefined/invalid/null. So we should test this new function to prevent regressions if someone thinks the check is redundant!
Not sure about the naming, but at least it is concise and easy to remember.
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.
Do you want me to do this as part of this PR?
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.
Hold on. Let's first merge this PR and I will publish a separate PR then.
6059399
to
6a20ac2
Compare
6a20ac2
to
78a7855
Compare
@Holzhaus GitHub doesn't offer me the option to open a PR for you repo: |
value = QString(); | ||
} | ||
} | ||
[[fallthrough]]; |
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.
This causes unfortunately a warning.
Please use M_FALLTHROUGH_INTENDED
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.
Fixed in #2518
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.
Fixes the issue reported here: #2470 (comment)