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


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

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


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

示例1:

void	MarkListTable::clear()
{
	QColorGroup cg = QApplication::palette()->normal();
	if( backgroundColor() != cg.base() )
		setBackgroundColor(cg.base());
	items.clear();
	sel = -1;
	update();
}
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:9,代码来源:marklist.cpp

示例2: PaintBars

static void PaintBars(toTreeWidgetItem *item, QPainter *p, const QColorGroup & cg,
                      int width, std::list<double> &val, std::list<double> &maxExt, std::list<double> &curExt)
{
#if 0                           // disabled, wrong override
    if ( val.empty() )
    {
        p->fillRect(0, 0, width, item->height(),
                    QBrush(item->isSelected() ? cg.highlight() : cg.base()));
    }
    else
    {
        int num = 0;
        int lastHeight = 0;

        std::list<double>::iterator j = curExt.begin();
        std::list<double>::iterator k = maxExt.begin();
        for (std::list<double>::iterator i = val.begin();
                i != val.end() && j != curExt.end() && k != maxExt.end();
                i++, j++, k++)
        {
            num++;

            QBrush bg(item->isSelected() ? cg.highlight() : cg.base());
            QBrush fg(num % 2 ? Qt::blue : Qt::red);

            double start = (*i);
            double end = (*j);

            if (BarsAlignLeft)
            {
                end -= start;
                start = 0;
                if (end < 0)
                    end += (*k);
            }

            int height = item->height() * num / val.size();
            int pos = int(start * width / (*k));
            int posEnd = int(end * width / (*k));

            if (start > end)
            {
                p->fillRect(0, lastHeight, posEnd, height, fg);
                p->fillRect(posEnd, lastHeight, pos, height, bg);
                p->fillRect(pos, lastHeight, width, height, fg);
            }
            else
            {
                p->fillRect(0, lastHeight, pos, height, bg);
                p->fillRect(pos, lastHeight, posEnd, height, fg);
                p->fillRect(posEnd, lastHeight, width, height, bg);
            }
            lastHeight = height;
        }
    }
#endif
}
开发者ID:Daniel1892,项目名称:tora,代码行数:57,代码来源:torollback.cpp

示例3: 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

示例4: paintCell

void TeQtBigTable::paintCell(QPainter *painter, int row, int col,
                          const QRect &cr, bool selected, const QColorGroup &cg)
{
	QRect rect(0, 0, cr.width(), cr.height());
	if (selected)
	{
		painter->fillRect(rect, cg.highlight());
		painter->setPen(cg.highlightedText());
	}
	else
	{
		painter->fillRect(rect, cg.base());
		painter->setPen(cg.text());
	}

	QTable::paintCell(painter, row, col, cr, selected, cg);

	QVariant v(dataSource_->cell(row, col));
	if (v.type() == QVariant::Pixmap)
	{
		QPixmap p = v.toPixmap();
		painter->drawPixmap(0, 0, p);
	}
	else if (v.type() == QVariant::String || v.type() == QVariant::CString)
	{
		QString qs = v.toString();
		bool ok;
		qs.toDouble(&ok);
		if (ok)
			painter->drawText(0, 0, cr.width()-10, cr.height(), Qt::AlignRight | Qt::SingleLine, v.toString());
		else
			painter->drawText(0, 0, cr.width()-10, cr.height(), Qt::AlignLeft | Qt::SingleLine, v.toString());

	}
}
开发者ID:Universefei,项目名称:Terralib-analysis,代码行数:35,代码来源:TeQtBigTable.cpp

示例5: 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

示例6: paintCell

void ListListViewItem::paintCell(QPainter *p,const QColorGroup &cg,int column,
				 int width,int align)
{
  if(column!=list_track_column) {
    Q3ListViewItem::paintCell(p,cg,column,width,align);
    return;
  }
  QColor fg=cg.text();
  QColor bg=cg.base();
  if(isSelected()) {
    fg=cg.highlightedText();
    bg=cg.highlight();
  }
  QString str=QString().sprintf("%u / %u",list_tracks,list_total_tracks);
  QPixmap *icon=list_whiteball_map;
  if(list_total_tracks>0) {
    if(list_tracks==list_total_tracks) {
      icon=list_greenball_map;
    }
    else {
      icon=list_redball_map;
    }
  }
  QFontMetrics *m=new QFontMetrics(p->font());
  p->setBackgroundColor(bg);
  p->eraseRect(0,0,width,height());
  p->setPen(fg);
  p->drawPixmap(list_parent->itemMargin(),(height()-icon->size().height())/2,
		*icon);
  p->drawText(icon->size().width()+10,3*(height()-m->height())/2,str);
  delete m;
}
开发者ID:WMFO,项目名称:rivendell,代码行数:32,代码来源:list_listviewitem.cpp

示例7: paint

	void KviVariantTableItem::paint(QPainter *p,const QColorGroup &cg,const QRect &cr,bool)
	{
		p->fillRect(0,0,cr.width(),cr.height(),cg.base());

		if(m_property.type() == QVariant::Color)
		{
			p->fillRect(3,3,cr.width() - 6,cr.height() - 6,m_property.asColor());
		} else {
			QString sz;
			switch(m_property.type())
			{
				case QVariant::String:
					sz = m_property.toString();
				break;
				case QVariant::Bool:
					sz = m_property.toBool() ? "TRUE" : "FALSE";
				break;
				case QVariant::Font:
					sz.setNum(m_property.toFont().pointSize());
					sz.prepend(", ");
					sz.prepend(m_property.toFont().family());
				break;
				case QVariant::Int:
					sz.setNum(m_property.toInt());
				break;
				case QVariant::UInt:
					sz.setNum(m_property.toUInt());
				break;
				default:
				break;
			}
			p->setPen(cg.text());
			p->drawText(0,0,cr.width(),cr.height(),Qt::AlignLeft | Qt::AlignTop,sz);
		}
	}
开发者ID:netrunner-debian-kde-extras,项目名称:kvirc,代码行数:35,代码来源:canvaswidget.cpp

示例8: paintCell

        virtual void paintCell(QPainter *p, const QColorGroup &cg,
                               int column, int width, int alignment)
        {
#if 0                           // disabled - not overriding correct method
            if (column == 2)
            {
                toProfilerUnits *units = dynamic_cast<toProfilerUnits *>(listView());
                if (!units)
                {
                    toTreeWidgetItem::paintCell(p, cg, column, width, alignment);
                    return ;
                }
                double total = allText(column).toDouble();
                QString timstr = FormatTime(total / 1E9);
                double val = total / units->total();

                p->fillRect(0, 0, int(val*width), height(), QBrush(Qt::blue));
                p->fillRect(int(val*width), 0, width, height(),
                            QBrush(isSelected() ? cg.highlight() : cg.base()));

                QPen pen(isSelected() ? cg.highlightedText() : cg.foreground());
                p->setPen(pen);
                p->drawText(0, 0, width, height(), Qt::AlignRight, timstr);
            }
            else
            {
                toTreeWidgetItem::paintCell(p, cg, column, width, alignment);
            }
#endif
        }
开发者ID:netrunner-debian-kde-extras,项目名称:tora,代码行数:30,代码来源:toprofiler.cpp

示例9: 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

示例10: paintCell

void FancyItem::paintCell(QPainter *p, const QColorGroup &cg, int c, int w, int)
{
	int h = height();
	QFontMetrics fm(p->font());
	if(isSelected())
		p->fillRect(0, 0, w, h-1, cg.highlight());
	else
		p->fillRect(0, 0, w, h, cg.base());

	int x = 0;
	const QPixmap *pix = pixmap(c);
	if(pix) {
		p->drawPixmap(4, (h - pix->height()) / 2, *pix);
		x += pix->width();
	}
	else
		x += 16;
	x += 8;
	int y = ((h - fm.height()) / 2) + fm.ascent();
	p->setPen(isSelected() ? cg.highlightedText() : cg.text());
	p->drawText(x, y, text(c));

	p->setPen(QPen(QColor(0xE0, 0xE0, 0xE0), 0, Qt::DotLine));
	p->drawLine(0, h-1, w-1, h-1);
}
开发者ID:Voker57,项目名称:psi,代码行数:25,代码来源:optionsdlg.cpp

示例11: init

// A ctor.
QsciStyle::QsciStyle(int style)
{
    init(style);

    QColorGroup cg = QApplication::palette().active();
    setColor(cg.text());
    setPaper(cg.base());

    setFont(QApplication::font());
    setEolFill(false);
}
开发者ID:paralect,项目名称:robomongo-deps,代码行数:12,代码来源:qscistyle.cpp

示例12: paintRegisterCellSetup

bool InvestTransactionDownloaded::paintRegisterCellSetup(QPainter* painter, int& row, int& col, QRect& cellRect, QRect& textRect, QColorGroup& cg, QBrush& brush)

{
  bool rc = Transaction::paintRegisterCellSetup(painter, row, col, cellRect, textRect, cg, brush);
  // if not selected paint in selected background color
  if(!isSelected()) {
    cg.setColor(QColorGroup::Base, KMyMoneyGlobalSettings::importedTransactionColor());
    brush = QBrush(cg.base());
  }
  return rc;
}
开发者ID:sajidji94,项目名称:kmymoney2,代码行数:11,代码来源:stdtransactiondownloaded.cpp

示例13: drawIndicator

void QWindowsStyle::drawIndicator( QPainter* p,
				   int x, int y, int w, int h, const QColorGroup &g,
				   int s, bool down, bool enabled )
{
#ifndef QT_NO_BUTTON
    QBrush fill;
    if ( s == QButton::NoChange ) {
	QBrush b = p->brush();
	QColor c = p->backgroundColor();
	p->setBackgroundMode( TransparentMode );
	p->setBackgroundColor( green );
	fill = QBrush(g.base(), Dense4Pattern);
	p->setBackgroundColor( c );
	p->setBrush( b );
    } else if ( down )
	fill = g.brush( QColorGroup::Button );
    else
	fill = g.brush( enabled ? QColorGroup::Base : QColorGroup::Background );
    qDrawWinPanel( p, x, y, w, h, g, TRUE, &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.text() );
	}
	p->drawLineSegments( a );
    }
#endif
}
开发者ID:opieproject,项目名称:qte-opie,代码行数:44,代码来源:qwindowsstyle.cpp

示例14: paintCell

void DriverItem::paintCell(QPainter *p, const QColorGroup &cg, int, int width, int)
{
    // background
    p->fillRect(0, 0, width, height(), cg.base());

    // highlight rectangle
    if(isSelected())
        p->fillRect(0, 0, /*2+p->fontMetrics().width(text(0))+(pixmap(0) ? pixmap(0)->width()+2 : 0)*/ width, height(),
                    (m_conflict ? red : cg.highlight()));

    // draw pixmap
    int w(0);
    if(pixmap(0) && !pixmap(0)->isNull())
    {
        int h((height() - pixmap(0)->height()) / 2);
        p->drawPixmap(w, h, *pixmap(0));
        w += (pixmap(0)->width() + 2);
    }

    // draw Text
    if(!m_item || !m_item->isOption() || isSelected())
    {
        p->setPen((isSelected() ? cg.highlightedText() : (m_conflict ? red : cg.text())));
        p->drawText(w, 0, width - w, height(), Qt::AlignLeft | Qt::AlignVCenter, text(0));
    }
    else
    {
        int w1(0);
        QString s(m_item->get("text") + ": <");
        w1 = p->fontMetrics().width(s);
        p->setPen(cg.text());
        p->drawText(w, 0, w1, height(), Qt::AlignLeft | Qt::AlignVCenter, s);
        w += w1;
        p->setPen((m_conflict ? red : darkGreen));
        s = m_item->prettyText();
        w1 = p->fontMetrics().width(s);
        p->drawText(w, 0, w1, height(), Qt::AlignLeft | Qt::AlignVCenter, s);
        w += w1;
        p->setPen(cg.text());
        s = QString::fromLatin1(">");
        w1 = p->fontMetrics().width(s);
        p->drawText(w, 0, w1, height(), Qt::AlignLeft | Qt::AlignVCenter, s);
    }
}
开发者ID:serghei,项目名称:kde3-kdelibs,代码行数:44,代码来源:driveritem.cpp

示例15: paintEvent

void QLineEdit::paintEvent( QPaintEvent *e )
{
    if ( !d->pm || d->pmDirty ) {
	if ( !d->pm )
	    d->pm = new QPixmap( size() );
	QPainter p( d->pm, this );

	QColorGroup g = colorGroup();
	QColor bg = isEnabled() ? g.base() : g.background();
	QFontMetrics fm = fontMetrics();
	int markBegin = minMark();
	int markEnd = maxMark();
	int margin = frame() ? 2 : 0;

	if ( frame() ) {
	    QBrush fill( bg );
	    qDrawWinPanel( &p, 0, 0, width(), height(), g, TRUE, &fill );
	} else {
	    p.fillRect( 0, 0, width(), height(), bg );
	}

	QString displayText;

	switch( echoMode() ) {
	case Normal:
	    displayText = tbuf.mid( offset, tbuf.length() );
	    break;
	case NoEcho:
	    displayText = "";
	    break;
	case Password:
	    displayText.fill( '*', tbuf.length() - offset );
	    break;
	}

	int ypos = height() - margin - fm.descent() - 1 -
		   (height() - 2*margin - fm.height())/2;

	if ( !displayText.isEmpty() ) {
	    int charsVisible = lastCharVisible() - offset;
	    if ( displayText[ charsVisible ] != '\0' )
		charsVisible++;

	    int mark1,mark2;

	    if ( markBegin > offset ) {
		if ( markBegin <  offset + charsVisible )
		    mark1 = markBegin - offset;
		else
		    mark1 = charsVisible;
	    } else {
		mark1 = 0;
	    }

	    if ( markEnd > offset ) {
		if ( markEnd <	offset + charsVisible )
		    mark2 = markEnd - offset;
		else
		    mark2 = charsVisible;
	    } else {
		mark2 = 0;
	    }

	    // display code comes here - a bit yucky but it works
	    if ( mark1 != mark2 ) {
		QString marked( displayText.mid( mark1, mark2 - mark1 ) );
		int xpos1 =  margin + 2 + fm.width( displayText, mark1 );
		int xpos2 =  xpos1 + fm.width( marked ) - 1;
		p.fillRect( xpos1, ypos - fm.ascent(),
			    xpos2 - xpos1, fm.height(),
			    style() == WindowsStyle
			    ? QApplication::winStyleHighlightColor()
			    : g.text() );
		p.setPen(  style() == WindowsStyle ? white : g.base() );
		p.drawText( xpos1, ypos, marked );
	    }
	    p.setPen( g.text() );
	    if ( mark1 != 0 )
		p.drawText( margin + 2, ypos, displayText, mark1 );
	    if ( mark2 != charsVisible ) {
		QString rest( displayText.mid( mark2, charsVisible - mark2 ) );
		p.drawText( margin + 2 + fm.width( displayText.left( mark2) ),
			    ypos, rest );
	    }
	}

	p.setPen( g.foreground() );

	int curXPos = margin + 2;
	if ( echoMode() != NoEcho )
	    curXPos += offset > cursorPos ? -1 : // ?: for scrolling case
			    fm.width( displayText, cursorPos - offset ) - 1;
	int curYPos   = ypos - fm.ascent();
	d->cursorRepaintRect.setRect( curXPos-2, curYPos, 5, fm.height() );
	d->pmDirty = FALSE;
    }
	
    bitBlt( this, e->rect().topLeft(), d->pm, e->rect() );
    if ( hasFocus() ) {
	if ( cursorOn && d->cursorRepaintRect.intersects( e->rect() ) ) {
//.........这里部分代码省略.........
开发者ID:kthxbyte,项目名称:Qt1.45-Linaro,代码行数:101,代码来源:qlineedit.cpp


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