コード例 #1
0
ファイル: paletteeditoradvanced.cpp プロジェクト: maxxant/qt
QPalette PaletteEditorAdvanced::getPalette(bool *ok, const QPalette &init,
                                           QPalette::ColorRole backgroundRole, QWidget *parent)
{
    PaletteEditorAdvanced *dlg = new PaletteEditorAdvanced(parent);
    dlg->setupBackgroundRole(backgroundRole);

    if (init != QPalette())
        dlg->setPal(init);
    int resultCode = dlg->exec();

    QPalette result = init;
    if (resultCode == QDialog::Accepted)
        result = dlg->pal();

    if (ok)
        *ok = resultCode;

    delete dlg;
    return result;
}
コード例 #2
0
QPalette PaletteEditorAdvanced::getPalette( bool *ok, const QPalette &init,
					    BackgroundMode mode, QWidget* parent,
					    const char* name )
{
    PaletteEditorAdvanced* dlg = new PaletteEditorAdvanced( parent, name, TRUE );
    dlg->setupBackgroundMode( mode );

    if ( init != QPalette() )
        dlg->setPal( init );
    int resultCode = dlg->exec();

    QPalette result = init;
    if ( resultCode == QDialog::Accepted ) {
	if ( ok )
	    *ok = TRUE;
	result = dlg->pal();
    } else {
	if ( ok )
	    *ok = FALSE;
    }
    delete dlg;
    return result;
}