Commit 59b44fa8 authored by Frédéric Larue's avatar Frédéric Larue
Browse files

Generation of colored icons improved.

parent 05f74cef
......@@ -122,7 +122,7 @@ void AlgorithmSelector::finalizeTools()
foreach( int categoryId, ToolCategory::categoriesId() )
if( !m_ToolsByCategory[categoryId].empty() )
{
QBoxLayout *l = new QVBoxLayout();
QVBoxLayout *l = new QVBoxLayout();
l->setAlignment( Qt::AlignHCenter );
l->setContentsMargins( 0, 0, 0, 0 );
l->setSpacing( 0 );
......@@ -132,9 +132,9 @@ void AlgorithmSelector::finalizeTools()
categoryButton->setIconSize( QSize(80,80) );
categoryButton->setFlat( true );
categoryButton->setMinimumSize( 80, 80 );
//categoryButton->setMaximumSize( 80, 80 );
categoryButton->setMaximumSize( 80, 80 );
categoryButton->setCheckable( true );
l->addWidget( categoryButton );
l->addWidget( categoryButton, 0, Qt::AlignHCenter );
m_CategoryButtonGroup->addButton( categoryButton, categoryId );
QLabel *categoryLabel = new QLabel( ToolCategory::categoryName(categoryId) );
......@@ -143,7 +143,7 @@ void AlgorithmSelector::finalizeTools()
categoryLabel->setFont( f );
categoryLabel->setAlignment( Qt::AlignHCenter );
//categoryLabel->setWordWrap( true );
l->addWidget( categoryLabel );
l->addWidget( categoryLabel, 0, Qt::AlignHCenter );
QWidget *categoryPannel = new QWidget();
categoryPannel->setLayout( l );
......
......@@ -31,17 +31,13 @@ void ToolCategory::declareCategory( int id, const QString& name, const QString &
// Update pixel color values.
QColor c = QApplication::palette().color( QPalette::Active, QPalette::BrightText );
QColor s = QApplication::palette().color( QPalette::Active, QPalette::Shadow );
int h = QApplication::palette().color( QPalette::Active, QPalette::Text ).hslHue();
for( int y=0; y<alphaMask.height(); ++y )
for( int x=0; x<alphaMask.width(); ++x )
{
float l = alphaMask.pixelColor(x,y).redF();
float a = alphaMask.pixelColor(x,y).alphaF();
QColor color( l*c.red () + (1.0f-l)*s.red (),
l*c.green() + (1.0f-l)*s.green(),
l*c.blue () + (1.0f-l)*s.blue (),
a*(l*c.alpha() + (1.0f-l)*s.alpha()) );
int l = alphaMask.pixelColor(x,y).lightness();
int a = alphaMask.pixelColor(x,y).alpha();
QColor color = QColor::fromHsl( h, 191, l, a );
icon.setPixelColor( x,y, color );
}
......@@ -55,5 +51,5 @@ void ToolCategory::declareCategory( int id, const QString& name, const QString &
s_CategoryById[id] = s_CategoryNames.size();
s_CategoryNames.append( name );
s_CategoryIcons.append( iconName/*iconFilePath*/ );
s_CategoryIcons.append( iconFilePath );
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment