void GCUserViewGroupItem::paintCell(QPainter *p, const QColorGroup & cg, int column, int width, int alignment)
{
	QColorGroup xcg = cg;
	QFont f = p->font();
	f.setPointSize(common_smallFontSize);
	p->setFont(f);
	xcg.setColor(QColorGroup::Text, PsiOptions::instance()->getOption("options.ui.look.colors.contactlist.grouping.header-foreground").value<QColor>());
	if (!PsiOptions::instance()->getOption("options.ui.look.contactlist.use-slim-group-headings").toBool()) {
		#if QT_VERSION < 0x040301
			xcg.setColor(QColorGroup::Background, PsiOptions::instance()->getOption("options.ui.look.colors.contactlist.grouping.header-background").value<QColor>());
		#else
			xcg.setColor(QColorGroup::Base, PsiOptions::instance()->getOption("options.ui.look.colors.contactlist.grouping.header-background").value<QColor>());
		#endif
	}
	Q3ListViewItem::paintCell(p, xcg, column, width, alignment);
	if (PsiOptions::instance()->getOption("options.ui.look.contactlist.use-slim-group-headings").toBool() && !isSelected()) {
		QFontMetrics fm(p->font());
		int x = fm.width(text(column)) + 8;
		if(x < width - 8) {
			int h = (height() / 2) - 1;
			p->setPen(QPen(PsiOptions::instance()->getOption("options.ui.look.colors.contactlist.grouping.header-background").value<QColor>()));
			p->drawLine(x, h, width - 8, h);
			h++;
			p->setPen(QPen(PsiOptions::instance()->getOption("options.ui.look.colors.contactlist.grouping.header-foreground").value<QColor>()));
			p->drawLine(x, h, width - 8, h);
		}
	}
}
Ejemplo n.º 2
0
void SkinListItem::paintCell(QPainter* p, const QColorGroup& /* cg */, int /* column */, int width, int /* align */)
{
    if (width <= 0) return;

    QColor textColor = isSelected() ? KGlobalSettings::highlightedTextColor() : KGlobalSettings::textColor();
    QColor background = isSelected() ? KGlobalSettings::highlightColor() : listView()->paletteBackgroundColor();

    QColorGroup colors;
    colors.setColor(QColorGroup::Foreground, textColor);
    colors.setColor(QColorGroup::Text, textColor);
    colors.setColor(QColorGroup::Background, background);
    colors.setColor(QColorGroup::Base, background);

    p->fillRect(0, 0, width, height(), background);


    if (pixmap(0))
    {
        int y = (height() - 32) / 2;
        p->drawPixmap(MARGIN, y, *pixmap(0));
    }

    item_text->setWidth(width);
    item_text->draw(p, MARGIN+32+MARGIN+MARGIN, MARGIN, QRect(0, 0, width-MARGIN-32-MARGIN, height()), colors);
}
Ejemplo n.º 3
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();
}
Ejemplo n.º 4
0
void KACLListViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment)
{
    QColorGroup mycg = cg;
    if(isDefault)
    {
        mycg.setColor(QColorGroup::Text, QColor(0, 0, 255));
    }
    if(isPartial)
    {
        QFont font = p->font();
        font.setItalic(true);
        mycg.setColor(QColorGroup::Text, QColor(100, 100, 100));
        p->setFont(font);
    }
    KListViewItem::paintCell(p, mycg, column, width, alignment);

    KACLListViewItem *below = 0;
    if(itemBelow())
        below = static_cast< KACLListViewItem * >(itemBelow());
    const bool lastUser = type == KACLListView::NamedUser && below && below->type == KACLListView::NamedGroup;
    const bool lastNonDefault = !isDefault && below && below->isDefault;
    if(type == KACLListView::Mask || lastUser || lastNonDefault)
    {
        p->setPen(QPen(Qt::gray, 0, QPen::DotLine));
        if(type == KACLListView::Mask)
            p->drawLine(0, 0, width - 1, 0);
        p->drawLine(0, height() - 1, width - 1, height() - 1);
    }
}
Ejemplo n.º 5
0
IsometryWindow::IsometryWindow( int u, Organizer *organ, vector <ManifoldInterface *> v)
	: QMainWindow(0,0,Qt::WStyle_Tool)
{
	setCaption("Compare");

	items = v;
	o = organ;
	upper_bound = u;
	box = new QVBox( this );
	setCentralWidget( box );

	top = new QHBox( box, "top");

	blank = new QLabel( "",top, 0 );
	blank->setPixmap( compare_xpm );
	top->setStretchFactor( blank, 10 );

	button = new QPushButton("Compare", top, 0 );
	connect( button, SIGNAL( clicked() ),
		this, SLOT( sameManifoldSlot() ) );

	lists = new QHBox( box, "lists" );

	list1 = new QListBox( lists );
        QPalette p = list1->palette();
        QColorGroup cg = p.active();
        cg.setColor(QColorGroup::Base, BASE );
        cg.setColor(QColorGroup::Text, TEXT );
        cg.setColor(QColorGroup::Highlight, HIGHLIGHT );
        p.setBrush(QColorGroup::Text, TEXT );
        p.setBrush(QColorGroup::Base, BASE );
        p.setActive(cg);
        list1->setPalette(p);

	list2 = new QListBox( lists );
        p = list1->palette();
        cg = p.active();
        cg.setColor(QColorGroup::Base, BASE );
        cg.setColor(QColorGroup::Text, TEXT );
        cg.setColor(QColorGroup::Highlight, HIGHLIGHT );
	p.setBrush(QColorGroup::Text, TEXT );
        p.setBrush(QColorGroup::Base, BASE );
	p.setActive(cg);
	list2->setPalette(p);


	buttonGroup = new QHButtonGroup( "Random matching:", box, "buttonGroup");
	checkBox = new QCheckBox("Use",buttonGroup, "checkBox");
	slider = new QSlider( 1, 1000, 100, 0, Qt::Horizontal, buttonGroup, "slider" );

	setMinimumWidth( 225 );
	setMaximumWidth( 500 );
	setMinimumHeight( 100  );
	setMaximumHeight( 500 );

        setGeometry(0,353,250,180);
}
Ejemplo n.º 6
0
/*!
  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 );
}
FLAccessControlForm::FLAccessControlForm() : FLAccessControl() {
  QColorGroup cg;
  QColor bg = qApp->palette().color( QPalette::Active, QColorGroup::Background );
  cg.setColor( QColorGroup::Foreground, bg );
  cg.setColor( QColorGroup::Text, bg );
  cg.setColor( QColorGroup::ButtonText, bg );
  cg.setColor( QColorGroup::Base, bg );
  cg.setColor( QColorGroup::Background, bg );
  pal.setDisabled( cg );
}
Ejemplo n.º 8
0
void MainWindow::buildDisabled()
{
    QColorGroup cg = editPalette.active();
    cg.setColor( QColorGroup::ButtonText, Qt::darkGray );
    cg.setColor( QColorGroup::WindowText, Qt::darkGray );
    cg.setColor( QColorGroup::Text, Qt::darkGray );
    cg.setColor( QColorGroup::HighlightedText, Qt::darkGray );
    editPalette.setDisabled( cg );

    buildDisabledEffect();
}
Ejemplo n.º 9
0
DiskInfoWidget::DiskInfoWidget(QWidget *parent, const char *name, ConfigDialogImpl *config, bool init)
	: QWidget(parent, name)
{
		_config = config;

		connect(&mDiskList , SIGNAL(readDFDone() ), this, SLOT (updateDFDone()) );
		connect(&mDiskList , SIGNAL(criticallyFull(DiskEntry*)), this, SLOT (criticallyFull(DiskEntry*)) );

		mTabProp.resize(8);
		mTabProp[0] = new CTabEntry( "Icon", i18n("Icon"), false, 0);
		mTabProp[1] = new CTabEntry( "Device", i18n("Device"), false, 0);
		mTabProp[2] = new CTabEntry( "Type", i18n("Type"), false, 0);
		mTabProp[3] = new CTabEntry( "Size", i18n("Size"), false, 0);
		mTabProp[4] = new CTabEntry( "MountPoint", i18n("Mount Point"), true, 90 );
		mTabProp[5] = new CTabEntry( "Free", i18n("Free"), false, 0);
		// xgettext:no-c-format
		mTabProp[6] = new CTabEntry( "Full%", i18n("Full %"), false, 0);
		mTabProp[7] = new CTabEntry( "UsageBar", i18n("Usage"), true, 100);

		GUI = !init;
		if( GUI )
		{
			QVBoxLayout *topLayout = new QVBoxLayout( this, 0, 0 );
			mList = new CListView( this, "list" );
			topLayout->addWidget( mList );

			mList->setAllColumnsShowFocus( true );
			mList->setFrameStyle( QFrame::WinPanel + QFrame::Sunken );
			mList->setShowSortIndicator(true);
			QPalette pal;
			QColorGroup cg;
			cg.setColor( QColorGroup::Button, BACKGROUND );
			cg.setColor( QColorGroup::ButtonText, TEXTCOLOR );
			cg.setColor( QColorGroup::Base, BACKGROUND );
			pal.setActive( cg );
			cg.setColor( QColorGroup::Button, BACKGROUND );
			cg.setColor( QColorGroup::ButtonText, TEXTCOLOR );
			cg.setColor( QColorGroup::Base, BACKGROUND );
			pal.setInactive( cg );
			cg.setColor( QColorGroup::Button, BACKGROUND );
			cg.setColor( QColorGroup::ButtonText, TEXTCOLOR );
			cg.setColor( QColorGroup::Base, BACKGROUND );
			pal.setDisabled( cg );
			mList->setPalette( pal );
//			connect( mList,
//				SIGNAL( pressed( QListViewItem *, const QPoint &, int )),
//				this, SLOT( rightButtonPressed( QListViewItem *, const QPoint &, int )));
//			connect( mList,
//				SIGNAL( clicked( QListViewItem *, const QPoint &, int )),
//				this, SLOT( rightButtonClicked( QListViewItem *, const QPoint &, int )));
			connect( mList->header(), SIGNAL(sizeChange(int, int, int)),
				this, SLOT(columnSizeChanged(int, int, int)) );
			makeColumns();
		}

		updateDF();
		setUpdateFrequency(60);
}
Ejemplo n.º 10
0
void PaletteEditorAdvanced::buildDisabled()
{
    QColorGroup cg = editPalette.active();
    cg.setColor( QColorGroup::ButtonText, darkGray );
    cg.setColor( QColorGroup::Foreground, darkGray );
    cg.setColor( QColorGroup::Text, darkGray );
    cg.setColor( QColorGroup::HighlightedText, darkGray );
    editPalette.setDisabled( cg );

    if ( checkBuildEffect->isChecked() )
	buildDisabledEffect();
    else {
	setPreviewPalette( editPalette );
	updateColorButtons();
    }
}
Ejemplo n.º 11
0
void PaletteEditorAdvanced::mapToDisabledEffectRole( const QColor& c )
{
    QColorGroup cg = editPalette.disabled();
    cg.setColor( effectFromItem(comboEffect->currentItem()), c );
    editPalette.setDisabled( cg );

    setPreviewPalette( editPalette );
}
Ejemplo n.º 12
0
void PaletteEditorAdvanced::mapToInactiveEffectRole( const QColor& c )
{
    QColorGroup cg = editPalette.inactive();
    cg.setColor( effectFromItem(comboEffect->currentItem()), c );
    editPalette.setInactive( cg );

    setPreviewPalette( editPalette );
}
Ejemplo n.º 13
0
void PaletteEditor::buildDisabled()
{
    QColorGroup cg = editPalette.active();
    cg.setColor( QColorGroup::ButtonText, darkGray );
    cg.setColor( QColorGroup::Foreground, darkGray );
    editPalette.setDisabled( cg );

    buildDisabledEffect();
}
Ejemplo n.º 14
0
void PaletteEditorAdvanced::mapToDisabledCentralRole( const QColor& c )
{
    QColorGroup cg = editPalette.disabled();
    cg.setColor( centralFromItem(comboCentral->currentItem()), c );
    editPalette.setDisabled( cg );

    buildDisabledEffect();

    setPreviewPalette( editPalette );
}
Ejemplo n.º 15
0
void PaletteEditorAdvanced::mapToInactiveCentralRole( const QColor& c )
{
    QColorGroup cg = editPalette.inactive();
    cg.setColor( centralFromItem(comboCentral->currentItem()), c );
    editPalette.setInactive( cg );

    buildInactiveEffect();

    setPreviewPalette( editPalette );
}
Ejemplo n.º 16
0
void FileListItem::paintCell( QPainter * p, const QColorGroup & cg, int column, int width, int align )
{
	QColorGroup mcg = cg;

	if ( isActive() )
	{
		mcg.setColor( QColorGroup::Base, Qt::yellow );
	}

	QListViewItem::paintCell( p, mcg, column, width, align );
}
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;
}
Ejemplo n.º 18
0
    void paintCell( QPainter * p, const QColorGroup & cg,
                               int column, int width, int align )
    {
	if ( !isSelectable() || !isAvailable() ) {
	    QColorGroup c = cg;
	    c.setColor(QColorGroup::Text, lightGray);
	    QCheckListItem::paintCell(p,c,column,width,align);
	} else {
	    QCheckListItem::paintCell(p,cg,column,width,align);
	}
    }
Ejemplo n.º 19
0
void PaletteEditorAdvanced::mapToActiveEffectRole( const QColor& c )
{
    QColorGroup cg = editPalette.active();
    cg.setColor( effectFromItem(comboEffect->currentItem()), c );
    editPalette.setActive( cg );

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

    setPreviewPalette( editPalette );
}
Ejemplo n.º 20
0
void PaletteEditor::buildInactiveEffect()
{
    QColorGroup cg = editPalette.inactive();

    QColor light, midlight, mid, dark, shadow;
    QColor btn = cg.color( QColorGroup::Button );

    light = btn.light(150);
    midlight = btn.light(115);
    mid = btn.dark(150);
    dark = btn.dark();
    shadow = black;

    cg.setColor( QColorGroup::Light, light );
    cg.setColor( QColorGroup::Midlight, midlight );
    cg.setColor( QColorGroup::Mid, mid );
    cg.setColor( QColorGroup::Dark, dark );
    cg.setColor( QColorGroup::Shadow, shadow );

    editPalette.setInactive( cg );
    setPreviewPalette( editPalette );
    updateStyledButtons();
}
Ejemplo n.º 21
0
/*!
  Auxiliary function to load a color group. The colorgroup must not
  contain pixmaps.
 */
QColorGroup Uic::loadColorGroup( const QDomElement &e ) {
  QColorGroup cg;
  int r = -1;
  QDomElement n = e.firstChild().toElement();
  QColor col;
  while ( !n.isNull() ) {
    if ( n.tagName() == "color" ) {
      r++;
      cg.setColor(( QColorGroup::ColorRole )r, ( col = DomTool::readColor( n ) ) );
    }
    n = n.nextSibling().toElement();
  }
  return cg;
}
Ejemplo n.º 22
0
/*!
  Draw the scale

  \param painter Painter
  \param center Center of the dial
  \param radius Radius of the scale
  \param origin Origin of the scale
  \param minArc Minimum of the arc 
  \param maxArc Minimum of the arc 
  
  \sa QwtAbstractScaleDraw::setAngleRange
*/
void QwtDial::drawScale(QPainter *painter, const QPoint &center,
    int radius, double origin, double minArc, double maxArc) const
{
    if ( d_data->scaleDraw == NULL )
        return;

    origin -= 270.0; // hardcoded origin of QwtScaleDraw

    double angle = maxArc - minArc;
    if ( angle > 360.0 )
        angle = fmod(angle, 360.0);

    minArc += origin;
    if ( minArc < -360.0 )
        minArc = fmod(minArc, 360.0);
    
    maxArc = minArc + angle;
    if ( maxArc > 360.0 )
    {
        // QwtAbstractScaleDraw::setAngleRange accepts only values
        // in the range [-360.0..360.0]
        minArc -= 360.0;
        maxArc -= 360.0;
    }
    
    painter->setFont(font());

    d_data->scaleDraw->setAngleRange(minArc, maxArc);
    d_data->scaleDraw->setRadius(radius);
    d_data->scaleDraw->moveCenter(center);

#if QT_VERSION < 0x040000
    QColorGroup cg = colorGroup();

    const QColor textColor = cg.color(QColorGroup::Text);
    cg.setColor(QColorGroup::Foreground, textColor);
    painter->setPen(QPen(textColor, d_data->scaleDraw->penWidth()));
    
    d_data->scaleDraw->draw(painter, cg);
#else
    QPalette pal = palette();

    const QColor textColor = pal.color(QPalette::Text);
    pal.setColor(QPalette::Foreground, textColor); //ticks, backbone
    
    painter->setPen(QPen(textColor, d_data->scaleDraw->penWidth()));

    d_data->scaleDraw->draw(painter, pal);
#endif
}
Ejemplo n.º 23
0
/*! \brief Returns a palette with colored scrollbars
 *
 *  This method creates a palette with skin specific scrollbar colors.
 *  Parent should be a widget that holds a "default" active palette, which will
 *  be used as base for the resulting palette.
 *  The returned QPalette is a copy of the parent palette but with modified
 *  scrollbar colors: QColorGroup::Highlight, QColorGroup::Button,
 *  QColorGroup::Foreground, QColorGroup::Background and QColorGroup::ButtonText.
 */
QPalette CSkin::palette(QWidget *parent)
{
  QPalette pal;
  QColorGroup cg;
  cg = parent->QWidget::palette().active(); // copy active palette from parent
  // ButtonText +  arrow of scrollbar
  if (colors.btnTxt)
  {
    cg.setColor(QColorGroup::ButtonText, QColor(colors.btnTxt));
    cg.setColor(QColorGroup::Foreground, cg.buttonText());
  }
  // Scrollbar
  if (colors.scrollbar)
  {
    cg.setColor(QColorGroup::Highlight, QColor(colors.scrollbar));
    cg.setColor(QColorGroup::Button, cg.highlight());
    cg.setColor(QColorGroup::Background, cg.highlight());
  }
  pal.setActive(cg);
  pal.setInactive(cg);
  pal.setDisabled(cg);
  return pal;
}
Ejemplo n.º 24
0
void KCheckEduca::drawButtonLabel( QPainter *p){
    int x, y, w, h;
    int extra_width, indicator_width;

    extra_width = 8;
    indicator_width = style().pixelMetric(QStyle::PM_IndicatorWidth, 0);

    y = 0;
    x = indicator_width + extra_width; //###
    w = width() - x;
    h = height();

    QRect cr(x,y,w,h);

    _doc = new QSimpleRichText( text(), font() );
    _doc->setWidth( 10 );

    _doc->setWidth(p, cr.width() );
    int rw = _doc->widthUsed() + extra_width;
    int rh = _doc->height();
    int xo = 0;
    int yo = 0;

    resize( width(), rh);

    yo = (cr.height()-rh)/2;

    if ( !isEnabled() ) {
        QColorGroup cg = colorGroup();
        cg.setColor( QColorGroup::Text, cg.light() );
        _doc->draw(p, cr.x()+xo+1, cr.y()+yo+1, cr, cg, 0);
    }
    _doc->draw(p, cr.x()+xo, cr.y()+yo, cr, colorGroup(), 0);

    if ( hasFocus() ) {
//	QRect br = style().itemRect( p, x, y, rw, rh+yo,
//				   AlignLeft|AlignVCenter|ShowPrefix,
//				   isEnabled(),
//				   pixmap(), text().visual() );
        QRect br(x,y,rw,rh+yo);

        br.setLeft( br.left()-3 );
        br.setRight( br.right()+2 );
        br.setTop( br.top()-2 );
        br.setBottom( br.bottom()+2);
        br = br.intersect( QRect(0,0,rw, rh+yo ) );

        style().drawPrimitive( QStyle::PE_FocusRect, p, br, colorGroup());
    }
}
Ejemplo n.º 25
0
void PaletteEditorAdvanced::buildDisabledEffect()
{
    QColorGroup cg = editPalette.disabled();

    QColor light, midlight, mid, dark, shadow;
    QColor btn = cg.color( QColorGroup::Button );

    light = btn.light(150);
    midlight = btn.light(115);
    mid = btn.dark(150);
    dark = btn.dark();
    shadow = black;

    cg.setColor( QColorGroup::Light, light );
    cg.setColor( QColorGroup::Midlight, midlight );
    cg.setColor( QColorGroup::Mid, mid );
    cg.setColor( QColorGroup::Dark, dark );
    cg.setColor( QColorGroup::Shadow, shadow );

    editPalette.setDisabled( cg );
    setPreviewPalette( editPalette );
    updateColorButtons();
}
Ejemplo n.º 26
0
void KateFileListItem::paintCell( QPainter *painter, const QColorGroup & cg, int column, int width, int align )
{
  KateFileList *fl = (KateFileList*)listView();
  if ( ! fl ) return;

  if ( column == 0 )
  {
    QColorGroup cgNew = cg;

    // replace the base color with a different shading if necessary...
    if ( fl->shadingEnabled() && m_viewhistpos > 1 )
    {
      QColor b( cg.base() );

      QColor shade = fl->viewShade();
      QColor eshade = fl->editShade();
      int hc = fl->histCount();
      // If this file is in the edit history, blend in the eshade
      // color. The blend is weighted by the position in the editing history
      if ( fl->shadingEnabled() && m_edithistpos > 0 )
      {
        int ec = fl->editHistCount();
        int v = hc-m_viewhistpos;
        int e = ec-m_edithistpos+1;
        e = e*e;
        int n = QMAX(v + e, 1);
        shade.setRgb(
            ((shade.red()*v) + (eshade.red()*e))/n,
            ((shade.green()*v) + (eshade.green()*e))/n,
            ((shade.blue()*v) + (eshade.blue()*e))/n
                    );
      }
      // blend in the shade color.
      // max transperancy < .5, latest is most colored.
      float t = (0.5/hc)*(hc-m_viewhistpos+1);
      b.setRgb(
          (int)((b.red()*(1-t)) + (shade.red()*t)),
          (int)((b.green()*(1-t)) + (shade.green()*t)),
          (int)((b.blue()*(1-t)) + (shade.blue()*t))
              );

      cgNew.setColor(QColorGroup::Base, b);
    }

    QListViewItem::paintCell( painter, cgNew, column, width, align );
  }
  else
    QListViewItem::paintCell( painter, cg, column, width, align );
}
Ejemplo n.º 27
0
/*!
  Paint an axis

  \param painter Painter
  \param axisId Axis id (QwtPolar::Axis)
*/
void QwtPolarGrid::drawAxis( QPainter *painter, int axisId ) const
{
  if ( axisId < 0 || axisId >= QwtPolar::AxesCount )
    return;

  AxisData &axis = d_data->axisData[axisId];

  painter->setPen( axis.pen );
  painter->setFont( axis.font );

#if QT_VERSION < 0x040000
  QColorGroup cg;
  cg.setColor( QColorGroup::Foreground, axis.pen.color() );
  cg.setColor( QColorGroup::Text, axis.pen.color() );

  axis.scaleDraw->draw( painter, cg );
#else
  QPalette pal;
  pal.setColor( QPalette::Foreground, axis.pen.color() );
  pal.setColor( QPalette::Text, axis.pen.color() );

  axis.scaleDraw->draw( painter, pal );
#endif
}
Ejemplo n.º 28
0
void PaletteEditorAdvanced::buildActiveEffect()
{
    QColorGroup cg = editPalette.active();
    QColor btn = cg.color( QColorGroup::Button );

    QPalette temp( btn, btn );

    for (int i = 0; i<5; i++)
	cg.setColor( effectFromItem(i), temp.active().color( effectFromItem(i) ) );

    editPalette.setActive( cg );
    setPreviewPalette( editPalette );

    updateColorButtons();
}
Ejemplo n.º 29
0
    void paletteChange( const QPalette &p )
    {
        static bool excllock = false;

        if ( excllock )
            return;
        excllock = true;

        unsetPalette ( );
        QIconView::paletteChange ( p );
        if ( m_bgtype == TabConfig::Ruled )
            setBackgroundType ( TabConfig::Ruled, QString::null );
        QColorGroup cg = colorGroup ( );
        cg.setColor ( QColorGroup::Text, m_textcolor );
        setPalette ( QPalette ( cg, cg, cg ));

        excllock = false;
    }
Ejemplo n.º 30
0
void PlaylistItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int align)
{
    if(!m_playingItems.contains(this))
        return KListViewItem::paintCell(p, cg, column, width, align);

    QColorGroup colorGroup = cg;

    QColor base = colorGroup.base();
    QColor selection = colorGroup.highlight();

    int r = (base.red() + selection.red()) / 2;
    int b = (base.blue() + selection.blue()) / 2;
    int g = (base.green() + selection.green()) / 2;

    QColor c(r, g, b);

    colorGroup.setColor(QColorGroup::Base, c);
    QListViewItem::paintCell(p, colorGroup, column, width, align);
}