当前位置: 首页>>代码示例>>C++>>正文


C++ QColorGroup::dark方法代码示例

本文整理汇总了C++中QColorGroup::dark方法的典型用法代码示例。如果您正苦于以下问题:C++ QColorGroup::dark方法的具体用法?C++ QColorGroup::dark怎么用?C++ QColorGroup::dark使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QColorGroup的用法示例。


在下文中一共展示了QColorGroup::dark方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: drawExclusiveIndicator

/*!\reimp
  */
void QCDEStyle::drawExclusiveIndicator( QPainter* p,
				   int x, int y, int w, int h, const QColorGroup &g,
				   bool on, bool down, bool /* enabled */ )
{
    static const QCOORD pts1[] = {		// up left  lines
	1,9, 1,8, 0,7, 0,4, 1,3, 1,2, 2,1, 3,1, 4,0, 7,0, 8,1, 9,1 };
    static const QCOORD pts4[] = {		// bottom right  lines
	2,10, 3,10, 4,11, 7,11, 8,10, 9,10, 10,9, 10,8, 11,7,
	11,4, 10,3, 10,2 };
    static const QCOORD pts5[] = {		// inner fill
	4,2, 7,2, 9,4, 9,7, 7,9, 4,9, 2,7, 2,4 };

    p->eraseRect( x, y, w, h );
    QPointArray a( QCOORDARRLEN(pts1), pts1 );
    a.translate( x, y );
    p->setPen( (down||on) ? g.dark() : g.light() );
    p->drawPolyline( a );
    a.setPoints( QCOORDARRLEN(pts4), pts4 );
    a.translate( x, y );
    p->setPen(  (down||on) ? g.light() : g.dark() );
    p->drawPolyline( a );
    a.setPoints( QCOORDARRLEN(pts5), pts5 );
    a.translate( x, y );
    QColor fillColor = on ? g.dark() : g.background();
    p->setPen( fillColor );
    p->setBrush( on ?  g.brush( QColorGroup::Dark )        :
		       g.brush( QColorGroup::Background ) );
    p->drawPolygon( a );
}
开发者ID:kthxbyte,项目名称:QT2-Linaro,代码行数:31,代码来源:qcdestyle.cpp

示例2: drawComboButton

/*!\reimp
 */
void QWindowsStyle::drawComboButton( QPainter *p, int x, int y, int w, int h,
				     const QColorGroup &g, bool sunken ,
				     bool /* editable */,
				     bool enabled,
				     const QBrush *fill )
{
    qDrawWinPanel(p, x, y, w, h, g, TRUE,
		   fill?fill:(enabled?&g.brush( QColorGroup::Base ):
				      &g.brush( QColorGroup::Background )));
    // the special reversed left shadow panel ( slightly different from drawPanel() )
    //qDrawWinPanel(p, w-2-16,2,16,h-4, g, sunken);
    // #### DO SUNKEN!
    if ( sunken )
	drawWinShades( p, x+w-2-16, y+2, 16, h-4,
		       g.dark(), g.dark(), g.button(), g.button(), 
		       fill ? fill : &g.brush( QColorGroup::Button ) );
    else
	drawWinShades( p, x+w-2-16, y+2, 16, h-4,
		       g.midlight(), g.shadow(), g.light(), g.dark(), 
		       fill ? fill : &g.brush( QColorGroup::Button ) );


    drawArrow( p, QStyle::DownArrow, sunken,
	       x+w-2-16+ 2, y+2+ 2, 16- 4, h-4- 4, g, enabled,
	       fill ? fill : &g.brush( QColorGroup::Button ) );

}
开发者ID:opieproject,项目名称:qte-opie,代码行数:29,代码来源:qwindowsstyle.cpp

示例3: paintCell

// Overridden to highlight the changed items
void VarItem::paintCell(QPainter *p, const QColorGroup &cg,
                        int column, int width, int align)
{
    if (p == 0) {
        return;
	}

    if (column == VALUE_COLUMN) {
		// Show color values as colors, and make the text color the same
		// as the base color
		if (dataType_ == COLOR_TYPE) {
			QRegExp color_re("\\s(#.*)>");
			
			if (color_re.search(text(column)) != -1) {
        		QColorGroup color_cg(	cg.foreground(), cg.background(), 
										cg.light(), cg.dark(), cg.mid(), 
										QColor(color_re.cap(1)), QColor(color_re.cap(1)) );
        		QListViewItem::paintCell(p, color_cg, column, width, align);
				return;
			}
		}
		
		// Highlight recently changed items in red
		if (highlight_) {
        	QColorGroup hl_cg(	cg.foreground(), cg.background(), 
								cg.light(), cg.dark(), cg.mid(), 
								red, cg.base() );
        	QListViewItem::paintCell(p, hl_cg, column, width, align);
			return;
		}
	}
	
	QListViewItem::paintCell(p, cg, column, width, align);
	return;
}
开发者ID:serghei,项目名称:kde3-kdevelop,代码行数:36,代码来源:variablewidget.cpp

示例4: qDrawWinPanel

void qDrawWinPanel( QPainter *p, int x, int y, int w, int h,
		    const QColorGroup &g, bool	sunken,
		    const QBrush *fill )
{
    if ( sunken )
	qDrawWinShades( p, x, y, w, h,
			g.dark(), g.light(), g.shadow(), g.midlight(), fill );
    else
	qDrawWinShades( p, x, y, w, h,
			g.light(), g.shadow(), g.midlight(), g.dark(), fill );
}
开发者ID:AliYousuf,项目名称:abanq-port,代码行数:11,代码来源:qdrawutil.cpp

示例5: drawButton

/*!
  Draws a press-sensitive shape.
*/
void QWindowsStyle::drawButton( QPainter *p, int x, int y, int w, int h,
				const QColorGroup &g, bool sunken, const QBrush* fill)
{
    if (sunken)
	drawWinShades( p, x, y, w, h,
		       g.shadow(), g.light(), g.dark(), g.button(),
		       fill?fill: &g.brush( QColorGroup::Button ) );
    else
	drawWinShades( p, x, y, w, h,
		       g.light(), g.shadow(), g.button(), g.dark(),
		       fill?fill:&g.brush( QColorGroup::Button ) );

}
开发者ID:opieproject,项目名称:qte-opie,代码行数:16,代码来源:qwindowsstyle.cpp

示例6: paintCell

void HierarchyItem::paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int align )
{
    QColorGroup g( cg );
    g.setColor( QColorGroup::Base, backgroundColor() );
    g.setColor( QColorGroup::Foreground, Qt::black );
    g.setColor( QColorGroup::Text, Qt::black );
    QString txt = text( 0 );
    if ( rtti() == Slot &&
   ( txt == "init()" || txt == "destroy()" ) ) {
  listView()->setUpdatesEnabled( false );
  if ( txt == "init()" )
      setText( 0, txt + " " + i18n( "(Constructor)" ) );
  else
      setText( 0, txt + " " + i18n( "(Destructor)" ) );
  QListViewItem::paintCell( p, g, column, width, align );
  setText( 0, txt );
  listView()->setUpdatesEnabled( true );
    } else {
  QListViewItem::paintCell( p, g, column, width, align );
    }
    p->save();
    p->setPen( QPen( cg.dark(), 1 ) );
    if ( column == 0 )
  p->drawLine( 0, 0, 0, height() - 1 );
    if ( listView()->firstChild() != this ) {
  if ( nextSibling() != itemBelow() && itemBelow()->depth() < depth() ) {
      int d = depth() - itemBelow()->depth();
      p->drawLine( -listView()->treeStepSize() * d, height() - 1, 0, height() - 1 );
  }
    }
    p->drawLine( 0, height() - 1, width, height() - 1 );
    p->drawLine( width - 1, 0, width - 1, height() );
    p->restore();
}
开发者ID:serghei,项目名称:kde3-kdewebdev,代码行数:34,代码来源:hierarchyview.cpp

示例7: drawIndicator

/*!\reimp
  */
void QCDEStyle::drawIndicator( QPainter* p,
			       int x, int y, int w, int h, const QColorGroup &g,
			       int s, bool down, bool /* enabled */ )
{
    bool showUp = !down && s == QButton::Off;
    QBrush fill =  down ? g.brush( QColorGroup::Mid )   :
			  g.brush( QColorGroup::Button );
    qDrawShadePanel( p, x, y, w, h, g, !showUp, defaultFrameWidth(), &fill );

    if (s != QButton::Off) {
	QPointArray a( 7*2 );
	int i, xx, yy;
	xx = x+3;
	yy = y+5;
	for ( i=0; i<3; i++ ) {
	    a.setPoint( 2*i,   xx, yy );
	    a.setPoint( 2*i+1, xx, yy+2 );
	    xx++; yy++;
	}
	yy -= 2;
	for ( i=3; i<7; i++ ) {
	    a.setPoint( 2*i,   xx, yy );
	    a.setPoint( 2*i+1, xx, yy+2 );
	    xx++; yy--;
	}
	if ( s == QButton::NoChange )
	    p->setPen( g.dark() );
	else
	    p->setPen( g.foreground() );
	p->drawLineSegments( a );
    }
}
开发者ID:kthxbyte,项目名称:QT2-Linaro,代码行数:34,代码来源:qcdestyle.cpp

示例8: drawExclusiveIndicator

void FreshStyle::drawExclusiveIndicator ( QPainter * p, int x, int y, int w,
	int h, const QColorGroup &cg, bool on, bool down, bool enabled )
{
    static const QCOORD pts1[] = {              // dark lines
	1,9, 1,8, 0,7, 0,4, 1,3, 1,2, 2,1, 3,1, 4,0, 7,0, 8,1, 9,1 };
    static const QCOORD pts4[] = {              // white lines
	2,10, 3,10, 4,11, 7,11, 8,10, 9,10, 10,9, 10,8, 11,7,
	11,4, 10,3, 10,2 };
    static const QCOORD pts5[] = {              // inner fill
	4,2, 7,2, 9,4, 9,7, 7,9, 4,9, 2,7, 2,4 };

    p->eraseRect( x, y, w, h );
    QPointArray a( QCOORDARRLEN(pts1), pts4 );
    a.translate( x, y );
    p->setPen( cg.dark() );
    p->drawPolyline( a );
    a.setPoints( QCOORDARRLEN(pts4), pts1 );
    a.translate( x, y );
    p->setPen( cg.light() );
    p->drawPolyline( a );
    a.setPoints( QCOORDARRLEN(pts5), pts5 );
    a.translate( x, y );
    QColor fillColor = ( down || !enabled ) ? cg.button() : cg.base();
    p->setPen( fillColor );
    p->setBrush( fillColor  ) ;
    p->drawPolygon( a );
    if ( on ) {
	p->setPen( NoPen );
	p->setBrush( cg.text() );
	p->drawRect( x+5, y+4, 2, 4 );
	p->drawRect( x+4, y+5, 4, 2 );
    }
}
开发者ID:opieproject,项目名称:opie,代码行数:33,代码来源:fresh.cpp

示例9: paintCell

// Reimplemented 
void QmvItem::paintCell( QPainter *p, const QColorGroup &cg,
                                 int column, int width, int alignment )
{
    QListView *listview = listView();
    
    QColorGroup g( cg );
    g.setColor( QColorGroup::Base, backgroundColor() );
    g.setColor( QColorGroup::Foreground, Qt::black );
    g.setColor( QColorGroup::Text, Qt::black );
    
    int indent = 0;
    if ( column == 0 ) {
        indent = 20 + (shuttletupleattribute  ? 20 : 0 );
        p->fillRect( 0, 0, width, height(), backgroundColor() );
        p->save();
        p->translate( indent, 0 );
    }

    if ( isChanged() && column == 0 ) {
        p->save();
        QFont f = p->font();
        f.setBold( TRUE );
        p->setFont( f );
    }

    if ( !hasCustomContents() || column != 1 ) {
        QListViewItem::paintCell( p, g, column, width - indent, alignment  );
    } else {
        p->fillRect( 0, 0, width, height(), backgroundColor() );
        drawCustomContents( p, QRect( 0, 0, width, height() ) );
    }
    
    if ( isChanged() && column == 0 )
        p->restore();
    if ( column == 0 )
        p->restore();
        // Draw +/- open/close control icon on tuple items
    if ( !shuttletupleattribute && column == 0 ) {
        p->save();
        p->setPen( cg.foreground() );
        p->setBrush( cg.base() );
        p->drawRect( 5, height() / 2 - 4, 9, 9 );
        p->drawLine( 7, height() / 2, 11, height() / 2 );
        if ( !isOpen() )
            p->drawLine( 9, height() / 2 - 2, 9, height() / 2 + 2 );
        p->restore();
    }
    
    p->save();
    p->setPen( QPen( cg.dark(), 1 ) );
    p->drawLine( 0, height() - 1, width, height() - 1 );
    p->drawLine( width - 1, 0, width - 1, height() );
    p->restore();

    if ( listview->currentItem() == this && column == 0 &&
         !listview->hasFocus() && !listview->viewport()->hasFocus() )
        paintFocus( p, cg, QRect( 0, 0, width, height() ) );


}
开发者ID:py1668,项目名称:xpracman-qt2-final,代码行数:61,代码来源:qmvedit.cpp

示例10: fill

/*!\reimp
 */
void
QWindowsStyle::drawPushButton( QPushButton* btn, QPainter *p)
{
#ifndef QT_NO_PUSHBUTTON
    QColorGroup g = btn->colorGroup();
    int x1, y1, x2, y2;

    btn->rect().coords( &x1, &y1, &x2, &y2 );	// get coordinates

    p->setPen( g.foreground() );
    p->setBrush( QBrush(g.button(),NoBrush) );

    int diw = buttonDefaultIndicatorWidth();
    if ( btn->isDefault() || btn->autoDefault() ) {
	if ( btn->isDefault() ) {
	    p->setPen( g.shadow() );
	    p->drawRect( x1, y1, x2-x1+1, y2-y1+1 );
	}
	x1 += diw;
	y1 += diw;
	x2 -= diw;
	y2 -= diw;
    }

    bool clearButton = TRUE;
    if ( btn->isDown() ) {
	if ( btn->isDefault() ) {
	    p->setPen( g.dark() );
	    p->drawRect( x1, y1, x2-x1+1, y2-y1+1 );
	} else {
	    drawButton( p, x1, y1, x2-x1+1, y2-y1+1, g, TRUE,
			&g.brush( QColorGroup::Button ) );
	}
    } else {
	if ( btn->isToggleButton() && btn->isOn() && btn->isEnabled() ) {
	    QBrush fill(g.light(), Dense4Pattern );
	    drawButton( p, x1, y1, x2-x1+1, y2-y1+1, g, TRUE, &fill );
	    clearButton = FALSE;
	} else {
	    if ( !btn->isFlat() )
		drawButton( p, x1, y1, x2-x1+1, y2-y1+1, g, btn->isOn(),
			&g.brush( QColorGroup::Button ) );
	}
    }
    if ( clearButton ) {
	if (btn->isDown())
	    p->setBrushOrigin(p->brushOrigin() + QPoint(1,1));
	p->fillRect( x1+2, y1+2, x2-x1-3, y2-y1-3,
		     g.brush( QColorGroup::Button ) );
	if (btn->isDown())
	    p->setBrushOrigin(p->brushOrigin() - QPoint(1,1));
    }

    if ( p->brush().style() != NoBrush )
	p->setBrush( NoBrush );

#endif
}
开发者ID:opieproject,项目名称:qte-opie,代码行数:60,代码来源:qwindowsstyle.cpp

示例11: drawWinShades

void
QWindowsStyle::drawPanel( QPainter *p, int x, int y, int w, int h,
		const QColorGroup &g, bool sunken,
		   int lineWidth, const QBrush* fill)
{
    if ( lineWidth == 2 ) {
	if (sunken)
	    drawWinShades( p, x, y, w, h,
			   g.dark(), g.light(), g.shadow(), g.midlight(),
			   fill );
	else
	    drawWinShades( p, x, y, w, h,
			   g.light(), g.shadow(), g.midlight(), g.dark(),
			   fill );
    }
    else
	QStyle::drawPanel( p, x, y, w, h, g, sunken, lineWidth, fill );
}
开发者ID:opieproject,项目名称:qte-opie,代码行数:18,代码来源:qwindowsstyle.cpp

示例12: drawRiffles

/*!
    Draws the nifty Macintosh decoration used on sliders using painter
    \a p and colorgroup \a g. \a x, \a y, \a w, \a h and \a horizontal
    specify the geometry and orientation of the riffles.
*/
void QPlatinumStyle::drawRiffles( QPainter* p,  int x, int y, int w, int h,
				  const QColorGroup &g, bool horizontal ) const
{
    if (!horizontal) {
	if (h > 20) {
	    y += (h-20)/2 ;
	    h = 20;
	}
	if (h > 8) {
	    int n = h / 4;
	    int my = y+h/2-n;
	    int i ;
	    p->setPen(g.light());
	    for (i=0; i<n; i++) {
		p->drawLine(x+3, my+2*i, x+w-5, my+2*i);
	    }
	    p->setPen(g.dark());
	    my++;
	    for (i=0; i<n; i++) {
		p->drawLine(x+4, my+2*i, x+w-4, my+2*i);
	    }
	}
    }
    else {
	if (w > 20) {
	    x += (w-20)/2 ;
	    w = 20;
	}
	if (w > 8) {
	    int n = w / 4;
	    int mx = x+w/2-n;
	    int i ;
	    p->setPen(g.light());
	    for (i=0; i<n; i++) {
		p->drawLine(mx+2*i, y+3, mx + 2*i, y+h-5);
	    }
	    p->setPen(g.dark());
	    mx++;
	    for (i=0; i<n; i++) {
		p->drawLine(mx+2*i, y+4, mx + 2*i, y+h-4);
	    }
	}
    }
}
开发者ID:AliYousuf,项目名称:univ-aca-mips,代码行数:49,代码来源:qplatinumstyle.cpp

示例13: HTMLColors

    HTMLColors()
    {
        map["black"] = "#000000";
        map["green"] = "#008000";
        map["silver"] = "#c0c0c0";
        map["lime"] = "#00ff00";
        map["gray"] = "#808080";
        map["olive"] = "#808000";
        map["white"] = "#ffffff";
        map["yellow"] = "#ffff00";
        map["maroon"] = "#800000";
        map["navy"] = "#000080";
        map["red"] = "#ff0000";
        map["blue"] = "#0000ff";
        map["purple"] = "#800080";
        map["teal"] = "#008080";
        map["fuchsia"] = "#ff00ff";
        map["aqua"] = "#00ffff";
	map["crimson"] = "#dc143c";
	map["indigo"] = "#4b0082";
#ifdef __BEOS__
	printf( "Warning: HTMLColors::HTMLColors() not initiating all colors\n" );
#else	
        // ### react to style changes
        // see http://www.richinstyle.com for details
        QColorGroup cg = kapp->palette().active();
        map["activeborder"] = cg.light(); // bordercolor of an active window
        map["activecaption"] = cg.text(); // caption color of an active window
        map["appworkspace"] = cg.background(); // background color of an MDI interface
        map["highlight"] = cg.highlight();
        map["highlighttext"] = cg.highlightedText();
        cg = kapp->palette().inactive();
        map["background"] = cg.background(); // desktop background color
        map["buttonface"] = cg.button(); // Button background color
        map["buttonhighlight"] =  cg.light();
        map["buttonshadow"] = cg.shadow();
        map["buttontext"] = cg.buttonText();
        map["captiontext"] = cg.text();
        map["infobackground"] = QToolTip::palette().inactive().background();
        map["menu"] = cg.background();
        map["menutext"] = cg.foreground();
        map["scrollbar"] = cg.background();
        map["threeddarkshadow"] = cg.dark();
        map["threedface"] = cg.button();
        map["threedhighlight"] = cg.light();
        map["threedlightshadow"] = cg.midlight();
        map["window"] = cg.background();
        map["windowframe"] = cg.background();
        map["text"] = cg.text();
        cg = kapp->palette().disabled();
        map["inactiveborder"] = cg.background();
        map["inactivecaption"] = cg.background();
        map["inactivecaptiontext"] = cg.text();
        map["graytext"] = cg.text();
#endif	
    };
开发者ID:BackupTheBerlios,项目名称:nirvana-svn,代码行数:56,代码来源:helper.cpp

示例14: drawButton

void FreshStyle::drawButton( QPainter *p, int x, int y, int w, int h,
                                const QColorGroup &cg, bool sunken, const QBrush* fill )
{
    QPen oldPen = p->pen();
    int off = sunken ? 1 : 0;
    p->fillRect( x+1+off, y+1+off, w-3, h-3, fill?(*fill):cg.brush(QColorGroup::Button) );

    int x2 = x+w-1;
    int y2 = y+h-1;

    if ( sunken )
	p->setPen( cg.dark() );
    else
	p->setPen( cg.light() );
    p->drawLine( x, y, x, y2-1 );
    p->drawLine( x, y, x2, y );

    if ( sunken ) {
	p->setPen( white );
	p->drawLine( x+1, y+1, x+1, y2-2 );
	p->drawLine( x+1, y+1, x2-2, y+1 );
    }

    if ( sunken )
	p->setPen( cg.light() );
    else
	p->setPen( cg.dark() );
    p->drawLine( x2, y+1, x2, y2 );
    p->drawLine( x, y2, x2, y2 );

    if ( !sunken ) {
	p->setPen( white );
	p->drawLine( x2-1, y+1, x2-1, y2-1 );
	p->drawLine( x+1, y2-1, x2-1, y2-1 );
    }
    p->setPen( oldPen );
}
开发者ID:opieproject,项目名称:opie,代码行数:37,代码来源:fresh.cpp

示例15: setBackgroundColor

QPEInputMethod::QPEInputMethod(QWidget *parent,const char *name,WFlags f):QFrame(parent,name,f)
//QPEInputMethod::QPEInputMethod(QWidget *parent,const char *name,WFlags f):QWidget(parent,name,f)
{
 // qt3
 //setBackgroundMode(Qt::NoBackground);
 // qt2
// setBackgroundMode(NoBackground);
// _input[ENGLISH]=new DS::EnglishInput(this);
// _input[ET_PHONETIC]=new DS::EtPhoneticInput(this,std::string(getenv("QPEDIR"))+"/plugins/inputmethods/phonetic.tab" );
// _input[ET_CHANGJEI]=new DS::EtChangjeiInput(this,std::string(getenv("QPEDIR"))+"/plugins/inputmethods/changjei.tab");
//
// _change_input_method = new QPopupMenu(this);
 //_change_input_method->insertItem("english",ENGLISH);
 //_change_input_method->insertItem("et phonetic",ET_PHONETIC);
// _change_input_method->insertItem("english",this,SLOT(change_input_method(int)),0,ENGLISH);
// _change_input_method->insertItem("et phonetic",this,SLOT(change_input_method(int)),0,ET_PHONETIC);
// _change_input_method->insertItem("et changjei",this,SLOT(change_input_method(int)),0,ET_CHANGJEI);

 //connect(_change_input_method,SIGNAL(actiaved(int)),this,SLOT(change_input_method(int)));

 //QFont font("unifont",16,15,false);
// QFont font("mingliu",12,50,false);
// setFont(font);
// _input_status=ENGLISH;
 //_input_status=ET_PHONETIC;

 _cell_rows=5; //  QPEInputMethod widget 的 rows 有幾個 cell
 _cell_cols=15; // QPEInputMethod widget 的 col 有幾個 cell
 // QPEInputMethod key width 的基本單位
 _key_unit_width=(width() / _cell_cols) / 2 ; 
 //qDebug("_key_unit_width : %d",_key_unit_width);
 // QPEInputMethod key height 的基本單位
 _key_unit_height=fontMetrics().lineSpacing()+3; 


 _painter.begin(this);
 //_buffer_painter.begin(&_buffer);

 // 設定此 widget 的背景色
 const QColorGroup cg=colorGroup();
 QColor key_color= key_color=cg.dark();
 QColor key_bg=QColor(240,240,230);
 // qt3 使用
 //setEraseColor(key_bg);
 // qt2 使用
 setBackgroundColor(key_bg);
}
开发者ID:descent,项目名称:qpeim,代码行数:47,代码来源:qpe_input_w.cpp


注:本文中的QColorGroup::dark方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。