Mercurial > hg > octave-shane
changeset 16621:2df11dd7a589
draw border around color picker swatches
* color-picker.cc (color_picker::update_button): Add 1px solid border
with text color to the css for the button.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 06 May 2013 06:06:43 -0400 |
parents | 818eef7b2618 |
children | 38fef1e833ea |
files | libgui/src/color-picker.cc |
diffstat | 1 files changed, 11 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/color-picker.cc +++ b/libgui/src/color-picker.cc @@ -49,8 +49,17 @@ // draw the button with the actual color (using a stylesheet) void color_picker::update_button () { - QString css = QString("background-color: %1; border: none;" ) - .arg(_color.name()); + // Is this the right place to look for a "foreground" color that would + // provide a reasonable border for the color swatches? + QWidget *p = parentWidget (); + + QString bordercolor + = p ? p->palette().text().color().name() : QString ("#000000"); + + QString css = QString("background-color: %1; border: 1px solid %2;") + .arg(_color.name()) + .arg(bordercolor); + setStyleSheet(css); repaint (); }