void PropertyPanel::setTitleColors() { QPalette palette = titleFrame->palette(); palette.setActive( highlightColorGroup( palette.active() ) ); palette.setInactive( highlightColorGroup( palette.inactive() ) ); palette.setDisabled( highlightColorGroup( palette.disabled() ) ); titleFrame->setPalette( palette ); }
/*! Reimplementation from QStyle */ void MetalStyle::polish( QApplication *app) { oldPalette = app->palette(); // we simply create a nice QColorGroup with a couple of fancy // pixmaps here and apply to it all widgets QFont f("times", app->font().pointSize() ); f.setBold( TRUE ); f.setItalic( TRUE ); app->setFont( f, TRUE, "QMenuBar"); app->setFont( f, TRUE, "QPopupMenu"); // QPixmap button( stonedark_xpm ); QColor gold("#B9B9A5A54040"); //same as topgrad below QPixmap button( 1, 1 ); button.fill( gold ); QPixmap background(marble_xpm); QPixmap dark( 1, 1 ); dark.fill( red.dark() ); QPixmap mid( stone1_xpm ); QPixmap light( stone1_xpm );//1, 1 ); light.fill( green ); QPalette op = app->palette(); QColor backCol( 227,227,227 ); // QPalette op(white); QColorGroup active (op.active().foreground(), QBrush(op.active().button(),button), QBrush(op.active().light(), light), QBrush(op.active().dark(), dark), QBrush(op.active().mid(), mid), op.active().text(), Qt::white, op.active().base(),// QColor(236,182,120), QBrush(backCol, background) ); active.setColor( QColorGroup::ButtonText, Qt::white ); active.setColor( QColorGroup::Shadow, Qt::black ); QColorGroup disabled (op.disabled().foreground(), QBrush(op.disabled().button(),button), QBrush(op.disabled().light(), light), op.disabled().dark(), QBrush(op.disabled().mid(), mid), op.disabled().text(), Qt::white, op.disabled().base(),// QColor(236,182,120), QBrush(backCol, background) ); QPalette newPalette( active, disabled, active ); app->setPalette( newPalette, TRUE ); }
void PaletteEditorAdvanced::setPreviewPalette( const QPalette& pal ) { QColorGroup cg; switch (selectedPalette) { case 0: default: cg = pal.active(); break; case 1: cg = pal.inactive(); break; case 2: cg = pal.disabled(); break; } previewPalette.setActive( cg ); previewPalette.setInactive( cg ); previewPalette.setDisabled( cg ); }
void PaletteEditor::setPreviewPalette( const QPalette& pal ) { QColorGroup cg; switch (paletteCombo->currentItem()) { case 0: default: cg = pal.active(); break; case 1: cg = pal.inactive(); break; case 2: cg = pal.disabled(); break; } previewPalette.setActive( cg ); previewPalette.setInactive( cg ); previewPalette.setDisabled( cg ); previewFrame->setPreviewPalette(previewPalette); }
void FreshStyle::drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw, int tab, QMenuItem* mi, const QPalette& pal, bool act, bool enabled, int x, int y, int w, int h) { #ifndef QT_NO_MENUDATA const QColorGroup & g = pal.active(); bool dis = !enabled; QColorGroup itemg = dis ? pal.disabled() : pal.active(); if ( checkable ) maxpmw = QMAX( maxpmw, 8 ); // space for the checkmarks int checkcol = maxpmw; if ( mi && mi->isSeparator() ) { // draw separator p->setPen( g.dark() ); p->drawLine( x, y, x+w, y ); p->setPen( g.light() ); p->drawLine( x, y+1, x+w, y+1 ); return; } QBrush fill = act? g.brush( QColorGroup::Highlight ) : g.brush( QColorGroup::Button ); p->fillRect( x, y, w, h, fill); if ( !mi ) return; if ( mi->isChecked() ) { if ( act && !dis ) { qDrawShadePanel( p, x, y, checkcol, h, g, TRUE, 1, &g.brush( QColorGroup::Button ) ); } else { qDrawShadePanel( p, x, y, checkcol, h, g, TRUE, 1, &g.brush( QColorGroup::Midlight ) ); } } else if ( !act ) { p->fillRect(x, y, checkcol , h, g.brush( QColorGroup::Button )); } if ( mi->iconSet() ) { // draw iconset QIconSet::Mode mode = dis ? QIconSet::Disabled : QIconSet::Normal; if (act && !dis ) mode = QIconSet::Active; QPixmap pixmap; if ( mode == QIconSet::Disabled ) pixmap = mi->iconSet()->pixmap( QIconSet::Automatic, mode ); else pixmap = mi->iconSet()->pixmap(); int pixw = pixmap.width(); int pixh = pixmap.height(); if ( act && !dis ) { if ( !mi->isChecked() ) qDrawShadePanel( p, x, y, checkcol, h, g, FALSE, 1, &g.brush( QColorGroup::Button ) ); } QRect cr( x, y, checkcol, h ); QRect pmr( 0, 0, pixw, pixh ); pmr.moveCenter( cr.center() ); p->setPen( itemg.text() ); p->drawPixmap( pmr.topLeft(), pixmap ); QBrush fill = act? g.brush( QColorGroup::Highlight ) : g.brush( QColorGroup::Button ); p->fillRect( x+checkcol + 1, y, w - checkcol - 1, h, fill); } else if ( checkable ) { // just "checking"... int mw = checkcol + motifItemFrame; int mh = h - 2*motifItemFrame; if ( mi->isChecked() ) { drawCheckMark( p, x + motifItemFrame + 2, y+motifItemFrame, mw, mh, itemg, act, dis ); } } p->setPen( act ? g.highlightedText() : g.buttonText() ); QColor discol; if ( dis ) { discol = itemg.text(); p->setPen( discol ); } int xm = motifItemFrame + checkcol + motifItemHMargin; if ( mi->custom() ) { int m = motifItemVMargin; p->save(); if ( dis && !act ) { p->setPen( g.light() ); mi->custom()->paint( p, itemg, act, enabled, x+xm+1, y+m+1, w-xm-tab+1, h-2*m ); p->setPen( discol ); } mi->custom()->paint( p, itemg, act, enabled, x+xm, y+m, w-xm-tab+1, h-2*m ); p->restore(); } QString s = mi->text(); if ( !s.isNull() ) { // draw text int t = s.find( '\t' ); int m = motifItemVMargin; const int text_flags = AlignVCenter|ShowPrefix | DontClip | SingleLine; if ( t >= 0 ) { // draw tab text if ( dis && !act ) { p->setPen( g.light() ); p->drawText( x+w-tab-windowsRightBorder-motifItemHMargin-motifItemFrame+1, y+m+1, tab, h-2*m, text_flags, s.mid( t+1 )); p->setPen( discol ); } p->drawText( x+w-tab-windowsRightBorder-motifItemHMargin-motifItemFrame, y+m, tab, h-2*m, text_flags, s.mid( t+1 ) ); } if ( dis && !act ) { p->setPen( g.light() ); p->drawText( x+xm+1, y+m+1, w-xm+1, h-2*m, text_flags, s, t ); p->setPen( discol ); } p->drawText( x+xm, y+m, w-xm-tab+1, h-2*m, text_flags, s, t ); } else if ( mi->pixmap() ) { // draw pixmap QPixmap *pixmap = mi->pixmap(); if ( pixmap->depth() == 1 ) p->setBackgroundMode( OpaqueMode ); p->drawPixmap( x+xm, y+motifItemFrame, *pixmap ); if ( pixmap->depth() == 1 ) p->setBackgroundMode( TransparentMode ); } if ( mi->popup() ) { // draw sub menu arrow int dim = (h-2*motifItemFrame) / 2; if ( act ) { if ( !dis ) discol = white; QColorGroup g2( discol, g.highlight(), white, white, dis ? discol : white, discol, white ); drawArrow( p, RightArrow, FALSE, x+w - motifArrowHMargin - motifItemFrame - dim, y+h/2-dim/2, dim, dim, g2, TRUE ); } else { drawArrow( p, RightArrow, FALSE, x+w - motifArrowHMargin - motifItemFrame - dim, y+h/2-dim/2, dim, dim, g, mi->isEnabled() ); } } #endif }
ViewReadLinetree3::ViewReadLinetree3( bool open, QWidget* parent, const char* name, bool modal, WFlags fl ) : QDialog( parent, name, modal, fl ), __open(open) { if ( !name ) setName( "ViewReadLinetree3" ); resize( 500, 250 ); if(open)setCaption( tr( "Read Linetree" ) ); else setCaption( tr( "Save Linetree" ) ); buttonLig = new QToolButton( this, "buttonLig" ); buttonLig->setGeometry( QRect( 450, 10, 40, 21 ) ); buttonLig->setText( tr( "..." ) ); QObject::connect( buttonLig,SIGNAL(clicked()),this,SLOT(SelectLigFile())); QLabel * labelDta = new QLabel( this, "labelDta" ); labelDta->setGeometry( QRect( 10, 60, 61, 20 ) ); labelDta->setText( tr( "Dta File" ) ); buttonDta = new QToolButton( this, "buttonDta" ); buttonDta->setGeometry( QRect( 450, 60, 40, 21 ) ); buttonDta->setText( tr( "..." ) ); QObject::connect( buttonDta,SIGNAL(clicked()),this,SLOT(SelectDtaFile())); QLabel * labelSmb = new QLabel( this, "labelSmb" ); labelSmb->setGeometry( QRect( 10, 110, 61, 20 ) ); labelSmb->setText( tr( "SMB Path" ) ); buttonSmb = new QToolButton( this, "buttonSmb" ); buttonSmb->setGeometry( QRect( 450, 110, 40, 21 ) ); buttonSmb->setText( tr( "..." ) ); QObject::connect( buttonSmb,SIGNAL(clicked()),this,SLOT(SelectSMBPath())); QLabel * labelLig = new QLabel( this, "labelLig" ); labelLig->setGeometry( QRect( 10, 10, 61, 20 ) ); labelLig->setText( tr( "Lig File" ) ); editLig = new QLineEdit( this, "editLig" ); editLig->setGeometry( QRect( 100, 10, 350, 22 ) ); editDta = new QLineEdit( this, "editDta" ); editDta->setGeometry( QRect( 100, 60, 350, 22 ) ); if(!DTA_FILENAME.isEmpty())editDta->setText( tr(DTA_FILENAME) ); editSmb = new QLineEdit( this, "editSmb" ); editSmb->setGeometry( QRect( 100, 110, 350, 22 ) ); if(SMB_PATH.isEmpty()) { SMB_PATH = (TOOLS(getPlantGLDir())+"share/plantgl/SMBFiles").c_str() ; } if(!SMB_PATH.isEmpty())editSmb->setText( tr( SMB_PATH ) ); labelKey = new QLabel( this, "labelKey" ); labelKey->setGeometry( QRect( 10, 160, 89, 20 ) ); if(open)labelKey->setText( tr( "Key :" ) ); else labelKey->setText("Key : [AMAPmod]"); editKey = new QLineEdit( this, "editKey" ); editKey->setGeometry( QRect( 100, 160, 350, 22 ) ); editKey->setReadOnly(open); editKey->setFont(QFont("courier", 8)); QPalette pal = editKey->palette(); QColorGroup cg = pal.active(); cg.setColor( QColorGroup::Base, QColor( 212, 208, 200) ); pal.setActive( cg ); cg = pal.inactive(); cg.setColor( QColorGroup::Base, QColor( 212, 208, 200) ); pal.setInactive( cg ); cg = pal.disabled(); cg.setColor( QColorGroup::Base, QColor( 212, 208, 200) ); pal.setDisabled( cg ); editKey->setProperty( "palette", pal ); editKey->setEchoMode(QLineEdit::Password); if(!open)editKey->setText(PGL(LinetreePrinter)::PROTECTION.c_str()); QObject::connect( editKey,SIGNAL(textChanged(const QString&)),this,SLOT(checkKey(const QString&))); DblClickEater * dblCkEater = new DblClickEater(editKey); labelKey->installEventFilter( dblCkEater ); if(!open){ QToolButton * buttonKey = new QToolButton( this, "buttonKey" ); buttonKey->setGeometry( QRect( 450, 160, 40, 21 ) ); buttonKey->setText( tr( "Reset" ) ); QObject::connect( buttonKey,SIGNAL(clicked()),this,SLOT(resetKey())); } buttonCancel = new QPushButton( this, "buttonCancel" ); buttonCancel->setGeometry( QRect( 390, 200, 104, 28 ) ); buttonCancel->setText( tr( "&Cancel" ) ); QObject::connect( buttonCancel,SIGNAL(clicked()),this,SLOT(reject())); buttonOk = new QPushButton( this, "buttonOk" ); buttonOk->setGeometry( QRect( 280, 200, 104, 28 ) ); buttonOk->setText( tr( "&Ok" ) ); QObject::connect( buttonOk,SIGNAL(clicked()),this,SLOT(ok())); endianBox = new QCheckBox( this, "endianBox" ); endianBox->setGeometry( QRect( 10, 205, 90, 20 ) ); endianBox->setText( tr( "Big Endian" ) ); endianBox->setChecked(true); if(open){ QPushButton * buttonTestEndianess = new QPushButton( this, "TestEndianess" ); buttonTestEndianess->setGeometry( QRect( 100, 200, 54, 28 ) ); buttonTestEndianess->setText( tr( "Test" ) ); QObject::connect( buttonTestEndianess,SIGNAL(clicked()),this,SLOT(testEndianess())); } if(!LIG_FILENAME.isEmpty()){ editLig->setText( tr(LIG_FILENAME) ); checkKey(); } }