Mercurial > octave
diff libgui/src/color-picker.cc @ 24011:9107bae20480
style fixes for some GUI source files
* color-picker.cc, color-picker.h, documentation-dock-widget.cc,
documentation-dock-widget.h, external-editor-interface.cc,
external-editor-interface.h, find-files-dialog.cc,
find-files-dialog.h, find-files-model.cc, find-files-model.h,
history-dock-widget.cc, history-dock-widget.h, settings-dialog.cc,
settings-dialog.h, terminal-dock-widget.cc, thread-manager.cc,
thread-manager.h: Use m_ prefix for member variables, order
functions consistently in header and source files, and follow more
Octave coding conventions.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 06 Sep 2017 09:25:46 -0400 |
parents | 855122b993da |
children | 2bee24503a13 |
line wrap: on
line diff
--- a/libgui/src/color-picker.cc Tue Sep 05 17:24:13 2017 -0700 +++ b/libgui/src/color-picker.cc Wed Sep 06 09:25:46 2017 -0400 @@ -32,29 +32,32 @@ #include "color-picker.h" // constuctor with initial color as parameter -color_picker::color_picker (QColor old_color, QWidget *p) : QPushButton (p) +color_picker::color_picker (QColor old_color, QWidget *p) + : QPushButton (p) { - _color = old_color; + m_color = old_color; setFlat (true); setFocusPolicy (Qt::NoFocus); // no focus, would changes the color update_button (); - connect (this, SIGNAL (clicked ()), SLOT (select_color ())); + connect (this, SIGNAL (clicked (void)), SLOT (select_color (void))); } // slot for bitton clicked: selct a new color using QColorDialog void -color_picker::select_color () +color_picker::select_color (void) { - QColor new_color = QColorDialog::getColor (_color); - if (new_color.isValid () && new_color != _color) + QColor new_color = QColorDialog::getColor (m_color); + + if (new_color.isValid () && new_color != m_color) { - _color = new_color; + m_color = new_color; update_button (); } } // draw the button with the actual color (using a stylesheet) -void color_picker::update_button () +void +color_picker::update_button (void) { // Is this the right place to look for a "foreground" color that would // provide a reasonable border for the color swatches? @@ -63,10 +66,9 @@ 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 (QString ("background-color: %1; border: 1px solid %2;") + .arg (m_color.name ()) + .arg (bordercolor)); - setStyleSheet (css); repaint (); }