Skip to content
Permalink
Browse files

[ux] Show the color values in tooltip

  • Loading branch information
NathanW2 committed Jun 21, 2016
1 parent be1244d commit 82e2add045625f5f5466f44793c3704af4e5941f
Showing with 19 additions and 0 deletions.
  1. +18 −0 src/gui/qgscolorbuttonv2.cpp
  2. +1 −0 src/gui/qgscolorbuttonv2.h
@@ -161,6 +161,24 @@ void QgsColorButtonV2::setToNull()
setColor( QColor() );
}

bool QgsColorButtonV2::event( QEvent *e )
{
if ( e->type() == QEvent::ToolTip )
{
QString name = this->color().name();
int hue = this->color().hue();
int value = this->color().value();
int saturation = this->color().saturation();
QString info = QString( "HEX: %1 \n"
"RGB: %2 \n"
"HSV: %3,%4,%4" ).arg( name )
.arg( QgsSymbolLayerV2Utils::encodeColor( this->color() ) )
.arg( hue ).arg( value ).arg( saturation );
setToolTip( info );
}
return QToolButton::event( e );
}

void QgsColorButtonV2::setToNoColor()
{
if ( mAllowAlpha )
@@ -318,6 +318,7 @@ class GUI_EXPORT QgsColorButtonV2 : public QToolButton

protected:

bool event( QEvent *e ) override;
void changeEvent( QEvent* e ) override;
void showEvent( QShowEvent* e ) override;
void resizeEvent( QResizeEvent *event ) override;

0 comments on commit 82e2add

Please sign in to comment.
You can’t perform that action at this time.