Пример #1
0
QgsColorSwatchGrid::QgsColorSwatchGrid( QgsColorScheme *scheme, const QString &context, QWidget *parent )
  : QWidget( parent )
  , mScheme( scheme )
  , mContext( context )
  , mDrawBoxDepressed( false )
  , mCurrentHoverBox( -1 )
  , mFocused( false )
  , mCurrentFocusBox( 0 )
  , mPressedOnWidget( false )
{
  //need to receive all mouse over events
  setMouseTracking( true );

  setFocusPolicy( Qt::StrongFocus );
  setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );

  mLabelHeight = Qgis::UI_SCALE_FACTOR * fontMetrics().height();
  mLabelMargin = Qgis::UI_SCALE_FACTOR * fontMetrics().width( QStringLiteral( "." ) );

  mSwatchSize = Qgis::UI_SCALE_FACTOR * fontMetrics().width( QStringLiteral( "X" ) ) * 1.75;
  mSwatchOutlineSize = std::max( fontMetrics().width( QStringLiteral( "." ) ) * 0.4, 1.0 );

  mSwatchSpacing = mSwatchSize * 0.3;
  mSwatchMargin = mLabelMargin;

  //calculate widget width
  mWidth = NUMBER_COLORS_PER_ROW * mSwatchSize + ( NUMBER_COLORS_PER_ROW - 1 ) * mSwatchSpacing + mSwatchMargin + mSwatchMargin;

  refreshColors();
}
Пример #2
0
QgsColorSwatchGrid::QgsColorSwatchGrid( QgsColorScheme* scheme, const QString& context, QWidget *parent )
    : QWidget( parent )
    , mScheme( scheme )
    , mContext( context )
    , mDrawBoxDepressed( false )
    , mCurrentHoverBox( -1 )
    , mFocused( false )
    , mCurrentFocusBox( 0 )
    , mPressedOnWidget( false )
{
  //need to receive all mouse over events
  setMouseTracking( true );

  setFocusPolicy( Qt::StrongFocus );
  setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );

  //calculate widget width
  mWidth = NUMBER_COLORS_PER_ROW * SWATCH_SIZE + ( NUMBER_COLORS_PER_ROW - 1 ) * SWATCH_SPACING + LEFT_MARGIN + RIGHT_MARGIN;

  refreshColors();
}
Пример #3
0
void QgsColorSwatchGrid::setBaseColor( const QColor &baseColor )
{
  mBaseColor = baseColor;
  refreshColors();
}
Пример #4
0
void QgsColorSwatchGrid::setContext( const QString &context )
{
  mContext = context;
  refreshColors();
}
Пример #5
0
void ProcessorGraph::changeListenerCallback(ChangeBroadcaster* source)
{
    refreshColors();

}