コード例 #1
0
void PaletteEditorAdvanced::onCentral( int item )
{
    QColor c;

    switch(selectedPalette) {
    case 0:
    default:
	c = editPalette.active().color( centralFromItem(item) );
	break;
    case 1:
	c = editPalette.inactive().color( centralFromItem(item) );
	break;
    case 2:
	c =  editPalette.disabled().color( centralFromItem(item) );
	break;
    }

    buttonCentral->setColor(c);
}
コード例 #2
0
void PaletteEditorAdvanced::mapToDisabledCentralRole( const QColor& c )
{
    QColorGroup cg = editPalette.disabled();
    cg.setColor( centralFromItem(comboCentral->currentItem()), c );
    editPalette.setDisabled( cg );

    buildDisabledEffect();

    setPreviewPalette( editPalette );
}
コード例 #3
0
void PaletteEditorAdvanced::mapToInactiveCentralRole( const QColor& c )
{
    QColorGroup cg = editPalette.inactive();
    cg.setColor( centralFromItem(comboCentral->currentItem()), c );
    editPalette.setInactive( cg );

    buildInactiveEffect();

    setPreviewPalette( editPalette );
}
コード例 #4
0
void PaletteEditorAdvanced::mapToInactivePixmapRole( const QPixmap& pm )
{
    QColorGroup::ColorRole role = centralFromItem(comboCentral->currentItem());
    QColorGroup cg = editPalette.inactive();
    if (  !pm.isNull()  )
	cg.setBrush( role, QBrush( cg.color( role ), pm ) );
    else
	cg.setBrush( role, QBrush( cg.color( role ) ) );
    editPalette.setInactive( cg );

    setPreviewPalette( editPalette );
}
コード例 #5
0
void PaletteEditor::buildPalette()
{
    int i;
    QColorGroup cg;
    QColor btn = buttonMainColor->color();
    QColor back = buttonMainColor2->color();
    QPalette automake( btn, back );

    for (i = 0; i<9; i++)
        cg.setColor( centralFromItem(i), automake.active().color( centralFromItem(i) ) );

    editPalette.setActive( cg );
    buildActiveEffect();

    cg = editPalette.inactive();

    QPalette temp( editPalette.active().color( QColorGroup::Button ),
                   editPalette.active().color( QColorGroup::Background ) );

    for (i = 0; i<9; i++)
        cg.setColor( centralFromItem(i), temp.inactive().color( centralFromItem(i) ) );

    editPalette.setInactive( cg );
    buildInactiveEffect();

    cg = editPalette.disabled();

    for (i = 0; i<9; i++)
        cg.setColor( centralFromItem(i), temp.disabled().color( centralFromItem(i) ) );

    editPalette.setDisabled( cg );
    buildDisabledEffect();

    updateStyledButtons();
}
コード例 #6
0
void PaletteEditorAdvanced::updateStyledButtons()
{
    QColor central, effect;
    QPixmap *pm = 0;
    switch (selectedPalette) {
    case 0:
    default:
	central = editPalette.active().color( centralFromItem( comboCentral->currentItem() ) );
	effect = editPalette.active().color( effectFromItem( comboEffect->currentItem() ) );
	pm = editPalette.active().brush( centralFromItem( comboCentral->currentItem() ) ).pixmap();
	break;
    case 1:
	central = editPalette.inactive().color( centralFromItem( comboCentral->currentItem() ) );
	effect = editPalette.inactive().color( effectFromItem( comboEffect->currentItem() ) );
	pm = editPalette.inactive().brush( centralFromItem( comboCentral->currentItem() ) ).pixmap();
	break;
    case 2:
	central = editPalette.disabled().color( centralFromItem( comboCentral->currentItem() ) );
	effect = editPalette.disabled().color( effectFromItem( comboEffect->currentItem() ) );
	pm = editPalette.disabled().brush( centralFromItem( comboCentral->currentItem() ) ).pixmap();
	break;
    }

    buttonCentral->setColor(central);
    buttonEffect->setColor(effect);
    if ( pm && !pm->isNull() )
	buttonPixmap->setPixmap( *pm );
    else
	buttonPixmap->setPixmap(QPixmap());
}
コード例 #7
0
void PaletteEditorAdvanced::onCentral( int item )
{
    QPixmap* p = 0;
    QColor c;

    switch(selectedPalette) {
    case 0:
    default:
	c = editPalette.active().color( centralFromItem(item) );
	p = editPalette.active().brush( centralFromItem(item) ).pixmap();
	break;
    case 1:
	c = editPalette.inactive().color( centralFromItem(item) );
	p = editPalette.inactive().brush( centralFromItem(item) ).pixmap();
	break;
    case 2:
	c =  editPalette.disabled().color( centralFromItem(item) );
	p = editPalette.disabled().brush( centralFromItem(item) ).pixmap();
	break;
    }

    buttonCentral->setColor(c);

    if (p)
	buttonPixmap->setPixmap( *p );
    else
	buttonPixmap->setPixmap( QPixmap() );
}
コード例 #8
0
void PaletteEditorAdvanced::updateColorButtons()
{
    QColor central, effect;
    switch (selectedPalette) {
    case 0:
    default:
	central = editPalette.active().color( centralFromItem( comboCentral->currentItem() ) );
	effect = editPalette.active().color( effectFromItem( comboEffect->currentItem() ) );
	break;
    case 1:
	central = editPalette.inactive().color( centralFromItem( comboCentral->currentItem() ) );
	effect = editPalette.inactive().color( effectFromItem( comboEffect->currentItem() ) );
	break;
    case 2:
	central = editPalette.disabled().color( centralFromItem( comboCentral->currentItem() ) );
	effect = editPalette.disabled().color( effectFromItem( comboEffect->currentItem() ) );
	break;
    }

    buttonCentral->setColor(central);
    buttonEffect->setColor(effect);
}
コード例 #9
0
void PaletteEditorAdvanced::mapToActiveCentralRole( const QColor& c )
{
    QColorGroup cg = editPalette.active();
    cg.setColor( centralFromItem(comboCentral->currentItem()), c );
    editPalette.setActive( cg );

    buildActiveEffect();
    if(checkBuildInactive->isChecked())
	buildInactive();
    if(checkBuildDisabled->isChecked())
	buildDisabled();

    setPreviewPalette( editPalette );
}
コード例 #10
0
void PaletteEditorAdvanced::mapToActivePixmapRole( const QPixmap& pm )
{
    QColorGroup::ColorRole role = centralFromItem(comboCentral->currentItem());
    QColorGroup cg = editPalette.active();
    if (  !pm.isNull()  )
	cg.setBrush( role, QBrush( cg.color( role ), pm ) );
    else
	cg.setBrush( role, QBrush( cg.color( role ) ) );
    editPalette.setActive( cg );


    buildActiveEffect();
    if(checkBuildInactive->isChecked())
	buildInactive();
    if(checkBuildDisabled->isChecked())
	buildDisabled();

    setPreviewPalette( editPalette );
}