20 #include <QAbstractButton>
23 static void updateColorButton( QAbstractButton* button, QColor color )
27 button->setIcon( QIcon( p ) );
35 : QDialog( parent ), mRamp( ramp )
40 QSize iconSize( 50, 16 );
41 cboSchemeName->setIconSize( iconSize );
44 foreach ( QString schemeName, schemes )
50 cboSchemeName->addItem( icon, schemeName );
53 cboSchemeName->setCurrentIndex( cboSchemeName->findText( ramp->
schemeName() ) );
55 cboColors->setCurrentIndex( cboColors->findText( QString::number( ramp->
colors() ) ) );
57 connect( cboSchemeName, SIGNAL( currentIndexChanged(
int ) ),
this, SLOT(
setSchemeName() ) );
58 connect( cboColors, SIGNAL( currentIndexChanged(
int ) ),
this, SLOT(
setColors() ) );
65 QString oldVariant = cboColors->currentText();
68 QString schemeName = cboSchemeName->currentText();
70 foreach (
int variant, variants )
72 cboColors->addItem( QString::number( variant ) );
76 int idx = cboColors->findText( oldVariant );
80 idx = cboColors->count() - 1;
82 cboColors->setCurrentIndex( idx );
87 QSize
size( 300, 40 );
102 int num = cboColors->currentText().toInt();