Comment 19 for bug 992811

Revision history for this message
RJ Skerry-Ryan (rryan) wrote :

I've been thinking a little bit about this lately and I think that subclassing QAbstractButton is the wrong way to go since it's unlikely we will be able to get the style sheet support right. In general we should move away from the old way of doing widgets in Mixxx where we override paint events and do anything related to palettes since this leads to inconsistencies in the UI.

Everything should be styleable with style sheets. I think the icons for all our delegates in the library shouldn't even be hardcoded.

For example, this works if you uncomment the hardcoding of the preview button's pause image and make the check-state of the preview button reflect whether the track is the current previewed track.

#LibraryPreviewButton {
  background-color: red;
  border: 0;
}

#LibraryPreviewButton:checked {
  image: url(skin:/style/checked.png);
}

#LibraryPreviewButton:!checked {
  image: url(skin:/style/unchecked.png);
}

#LibraryPreviewButton:checked:hover {
  image: url(skin:/style/unchecked.png);
}

#LibraryPreviewButton:!checked:hover {
  image: url(skin:/style/checked.png);
}

This is much more configurable since the skin designer can set the graphics and even do things like set a custom border on hover so that you know it's a button. (since border:0 makes there be no outline of a button around it).

I think that for 2-state buttons like the BPM lock and the preview button a QPushButton that is checkable is good enough.