<div dir="ltr"><div><div><div><div>Hi,<br><br></div>Matthias Kuhn and I reworked the QgsColorButton class and refactored it use across the project. The following is an overview of its new features, a poll on how to move forward, and a note about a Mac issue.<br>
<br></div>Features:<br></div>* Now one class based off of QPushButton, with two variants: one with an icon when there is text (normal OS style), and one purely stylesheet-based when there is no text (we refer to it as a color 'well'). Comparison of the two variants [0].<br>
<br></div><div>* Code for using the button is much simpler, since the color chooser dialog is now part of the QgsColorButton class.<br></div><div><br></div>* Whenever the color of the button has an alpha < 255 there is a checkerboard background with the color overlaid, to indicate to the user that the color has a transparency value. There is currently no graphical indication that the button's color chooser dialog *offers* transparency editing (I have figured out how to add this as a small badge, though).<br>
<div><div><div><div><br></div><div>* When the option is checked in Options, a live-updating color chooser dialog is used and interim color choices update the button. This means any signal/slot connection to the button's color change will also update, creating a live preview. Try this with items in Composer (arrow, frame, background) and when creating/editing a gradient. Some buttons shouldn't have live updates, so there's a setter function to turn it off per button (default for live updating is on).<br clear="all">
</div><div><div><div><br>[0] <a href="http://drive.dakotacarto.com/qgis/color-button_comparison.png">http://drive.dakotacarto.com/qgis/color-button_comparison.png</a><br><br></div><div>Poll:<br></div><div>Do you think there should be just color wells, just buttons with icons, or a mix of both (current situation)? IMHO they should all be wells.<br>
</div><div><br></div><div>Mac 'triple-modal' issue:<br></div><div>On Mac there is an issue when using the native color dialog with what I call 'triple-modal' dialogs: where one modal dialog opens another modal dialog, which offers opening the modal color chooser. When this happens, upon closing the color chooser, then the topmost modal dialog, the first modal dialog becomes completely unresponsive (basically like there is still another modal dialog open on top of it, but there isn't). It does not happen when there is only one modal dialog and then the modal color chooser on top.<br>
<br>This is a known Qt Mac issue with 4.8 and 5.0 (and maybe 4.7). I worked around it by making all instances of base dialogs that present the issue show as Qt::WindowModal, i.e. as sheet dialogs. This means there should be no more Qt-style color choosers (only Mac native ones). Please let me know if you notice any non-native color choosers popping up or any more 'triple-modal' issues.<br>
</div><div><br></div><div>Regards,<br></div><div><br>Larry</div>
</div></div></div></div></div></div>