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

Fix track color library inline editing #2517

Merged
merged 2 commits into from
Feb 26, 2020

Conversation

Holzhaus
Copy link
Member

Fixes the issue reported here: #2470 (comment)

@Holzhaus Holzhaus added this to the 2.3.0 milestone Feb 25, 2020
@Holzhaus Holzhaus changed the title Track Color Fix Fix track color library inline editing Feb 25, 2020
@@ -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)) {
Copy link
Contributor

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?

Copy link
Contributor

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();
}

Copy link
Contributor

@uklotzde uklotzde Feb 25, 2020

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.

Copy link
Member Author

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?

Copy link
Contributor

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.

@uklotzde
Copy link
Contributor

@Holzhaus GitHub doesn't offer me the option to open a PR for you repo:

https://github.com/uklotzde/mixxx/tree/trackcolor-fix

@uklotzde uklotzde merged commit 978d7e8 into mixxxdj:master Feb 26, 2020
value = QString();
}
}
[[fallthrough]];
Copy link
Member

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Fixed in #2518

Copy link
Member

Choose a reason for hiding this comment

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

Thank you.

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

Successfully merging this pull request may close these issues.

3 participants