void QwtPolarRenderer::renderTitle( QPainter *painter, const QRectF &rect ) const { QwtTextLabel *title = d_data->plot->titleLabel(); painter->setFont( title->font() ); const QColor color = title->palette().color( QPalette::Active, QPalette::Text ); painter->setPen( color ); title->text().draw( painter, rect ); }
void SetWPDlg::on_knob_sliderMoved(double value) { #if 0 QwtKnob *p = ui->knob; QwtTextLabel *l = ui->TextLabel; if(p != NULL && l != NULL) { QwtText txt; txt = QString::number(value); l->setText(txt); p->setValue(value); } else { QMessageBox::warning(this, "fsadsa", "fdsfsda", QMessageBox::Yes); } #endif }
/*! Reset color and fonts of a plot \sa apply() */ void QwtPlotPrintFilter::reset(QwtPlot *plot) const { if ( d_data->cache == 0 ) return; const bool doAutoReplot = plot->autoReplot(); plot->setAutoReplot(false); const PrivateData::Cache &cache = *d_data->cache; if ( plot->titleLabel() ) { QwtTextLabel* title = plot->titleLabel(); if ( title->text().testPaintAttribute(QwtText::PaintUsingTextFont) ) { QwtText text = title->text(); text.setColor(cache.titleColor); title->setText(text); } else { QPalette palette = title->palette(); palette.setColor( QPalette::Active, Palette::Text, cache.titleColor); title->setPalette(palette); } if ( title->text().testPaintAttribute(QwtText::PaintUsingTextFont) ) { QwtText text = title->text(); text.setFont(cache.titleFont); title->setText(text); } else { title->setFont(cache.titleFont); } } if ( plot->legend() ) { #if QT_VERSION < 0x040000 QValueList<QWidget *> list = plot->legend()->legendItems(); for ( QValueListIterator<QWidget *> it = list.begin(); it != list.end(); ++it ) #else QList<QWidget *> list = plot->legend()->legendItems(); for ( QList<QWidget*>::iterator it = list.begin(); it != list.end(); ++it ) #endif { QWidget *w = *it; if ( cache.legendFonts.contains(w) ) w->setFont(cache.legendFonts[w]); if ( w->inherits("QwtLegendItem") ) { QwtLegendItem *label = (QwtLegendItem *)w; const QwtPlotItem *plotItem = (const QwtPlotItem*)plot->legend()->find(label); QwtSymbol symbol = label->symbol(); if ( cache.curveSymbolPenColors.contains(plotItem) ) { QPen pen = symbol.pen(); pen.setColor(cache.curveSymbolPenColors[plotItem]); symbol.setPen(pen); } if ( cache.curveSymbolBrushColors.contains(plotItem) ) { QBrush brush = symbol.brush(); brush.setColor(cache.curveSymbolBrushColors[plotItem]); symbol.setBrush(brush); } label->setSymbol(symbol); if ( cache.curveColors.contains(plotItem) ) { QPen pen = label->curvePen(); pen.setColor(cache.curveColors[plotItem]); label->setCurvePen(pen); } } } } for ( int axis = 0; axis < QwtPlot::axisCnt; axis++ ) { QwtScaleWidget *scaleWidget = plot->axisWidget(axis); if ( scaleWidget ) { QPalette palette = scaleWidget->palette(); palette.setColor(QPalette::Active, Palette::Foreground, cache.scaleColor[axis]); scaleWidget->setPalette(palette); scaleWidget->setFont(cache.scaleFont[axis]); scaleWidget->setTitle(cache.scaleTitle[axis]); int startDist, endDist; scaleWidget->getBorderDistHint(startDist, endDist); scaleWidget->setBorderDist(startDist, endDist); } } if ( hasBackgroundColor(plot) ) { QPalette p = plot->palette(); p.setColor(QPalette::Active, Palette::Background, cache.widgetBackground); plot->setPalette(p); } if ( hasBackgroundColor(plot->canvas()) ) { plot->setCanvasBackground(cache.canvasBackground); } const QwtPlotItemList& itmList = plot->itemList(); for ( QwtPlotItemIterator it = itmList.begin(); it != itmList.end(); ++it ) { reset(*it); } delete d_data->cache; d_data->cache = 0; plot->setAutoReplot(doAutoReplot); }