本文整理汇总了C++中QwtDynGridLayout::iterator方法的典型用法代码示例。如果您正苦于以下问题:C++ QwtDynGridLayout::iterator方法的具体用法?C++ QwtDynGridLayout::iterator怎么用?C++ QwtDynGridLayout::iterator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QwtDynGridLayout
的用法示例。
在下文中一共展示了QwtDynGridLayout::iterator方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: printLegend
void QwtPlot::printLegend(QPainter *painter, const QRect &rect) const
{
if ( !d_legend || d_legend->isEmpty() )
return;
QLayout *l = d_legend->contentsWidget()->layout();
if ( l == 0 || !l->inherits("QwtDynGridLayout") )
return;
QwtDynGridLayout *legendLayout = (QwtDynGridLayout *)l;
uint numCols = legendLayout->columnsForWidth(rect.width());
QValueList<QRect> itemRects =
legendLayout->layoutItems(rect, numCols);
int index = 0;
QLayoutIterator layoutIterator = legendLayout->iterator();
for ( QLayoutItem *item = layoutIterator.current();
item != 0; item = ++layoutIterator)
{
QWidget *w = item->widget();
if ( w )
{
painter->save();
painter->setClipping(TRUE);
QwtPainter::setClipRect(painter, itemRects[index]);
printLegendItem(painter, w, itemRects[index]);
index++;
painter->restore();
}
}
}
示例2: printLegend
void QwtPlot::printLegend(QPainter *painter, const QRect &rect) const
{
if ( !legend() || legend()->isEmpty() )
return;
QLayout *l = legend()->contentsWidget()->layout();
if ( l == 0 || !l->inherits("QwtDynGridLayout") )
return;
QwtDynGridLayout *legendLayout = (QwtDynGridLayout *)l;
uint numCols = legendLayout->columnsForWidth(rect.width());
#if QT_VERSION < 0x040000
QValueList<QRect> itemRects =
legendLayout->layoutItems(rect, numCols);
#else
QList<QRect> itemRects =
legendLayout->layoutItems(rect, numCols);
#endif
int index = 0;
#if QT_VERSION < 0x040000
QLayoutIterator layoutIterator = legendLayout->iterator();
for ( QLayoutItem *item = layoutIterator.current();
item != 0; item = ++layoutIterator) {
#else
for ( int i = 0; i < legendLayout->count(); i++ ) {
QLayoutItem *item = legendLayout->itemAt(i);
#endif
QWidget *w = item->widget();
if ( w ) {
painter->save();
painter->setClipping(true);
QwtPainter::setClipRect(painter, itemRects[index]);
printLegendItem(painter, w, itemRects[index]);
index++;
painter->restore();
}
}
}
/*!
Print the legend item into a given rectangle.
\param painter Painter
\param w Widget representing a legend item
\param rect Bounding rectangle
*/
void QwtPlot::printLegendItem(QPainter *painter,
const QWidget *w, const QRect &rect) const
{
if ( w->inherits("QwtLegendItem") ) {
QwtLegendItem *item = (QwtLegendItem *)w;
painter->setFont(item->font());
item->drawItem(painter, rect);
}
}
/*!
\brief Paint a scale into a given rectangle.
Paint the scale into a given rectangle.
\param painter Painter
\param axisId Axis
\param startDist Start border distance
\param endDist End border distance
\param baseDist Base distance
\param rect Bounding rectangle
*/
void QwtPlot::printScale(QPainter *painter,
int axisId, int startDist, int endDist, int baseDist,
const QRect &rect) const
{
if (!axisEnabled(axisId))
return;
const QwtScaleWidget *scaleWidget = axisWidget(axisId);
if ( scaleWidget->isColorBarEnabled()
&& scaleWidget->colorBarWidth() > 0) {
const QwtMetricsMap map = QwtPainter::metricsMap();
QRect r = map.layoutToScreen(rect);
r.setWidth(r.width() - 1);
r.setHeight(r.height() - 1);
scaleWidget->drawColorBar(painter, scaleWidget->colorBarRect(r));
const int off = scaleWidget->colorBarWidth() + scaleWidget->spacing();
if ( scaleWidget->scaleDraw()->orientation() == Qt::Horizontal )
baseDist += map.screenToLayoutY(off);
else
baseDist += map.screenToLayoutX(off);
}
//.........这里部分代码省略.........
示例3: renderLegend
void QwtPolarPlot::renderLegend( QPainter *painter, const QRect &rect ) const
{
#if 1
// Shift this code into QwtLegend, so that Qwt/QwtPolar can share it
#endif
if ( !legend() || legend()->isEmpty() )
return;
QLayout *l = legend()->contentsWidget()->layout();
if ( l == 0 || !l->inherits( "QwtDynGridLayout" ) )
return;
QwtDynGridLayout *legendLayout = ( QwtDynGridLayout * )l;
uint numCols = legendLayout->columnsForWidth( rect.width() );
#if QT_VERSION < 0x040000
QValueList<QRect> itemRects =
legendLayout->layoutItems( rect, numCols );
#else
QList<QRect> itemRects =
legendLayout->layoutItems( rect, numCols );
#endif
int index = 0;
#if QT_VERSION < 0x040000
QLayoutIterator layoutIterator = legendLayout->iterator();
for ( QLayoutItem *item = layoutIterator.current();
item != 0; item = ++layoutIterator )
{
#else
for ( int i = 0; i < legendLayout->count(); i++ )
{
QLayoutItem *item = legendLayout->itemAt( i );
#endif
QWidget *w = item->widget();
if ( w )
{
painter->save();
painter->setClipping( true );
QwtPainter::setClipRect( painter, itemRects[index] );
renderLegendItem( painter, w, itemRects[index] );
index++;
painter->restore();
}
}
}
/*!
Render the legend item into a given rectangle.
\param painter Painter
\param w Widget representing a legend item
\param rect Bounding rectangle
*/
void QwtPolarPlot::renderLegendItem( QPainter *painter,
const QWidget *w, const QRect &rect ) const
{
#if 1
// Shift this code into QwtLegend, so that Qwt/QwtPolar can share it
#endif
if ( w->inherits( "QwtLegendItem" ) )
{
QwtLegendItem *item = ( QwtLegendItem * )w;
painter->setFont( item->font() );
item->drawItem( painter, rect );
}
}
示例4: printLegend
void QwtPlot::printLegend(QPainter *painter, const QRect &rect) const
{
if ( !legend() || legend()->isEmpty() )
return;
QLayout *l = legend()->contentsWidget()->layout();
if ( l == 0 || !l->inherits("QwtDynGridLayout") )
return;
QwtDynGridLayout *legendLayout = (QwtDynGridLayout *)l;
uint numCols = legendLayout->columnsForWidth(rect.width());
#if QT_VERSION < 0x040000
QValueList<QRect> itemRects =
legendLayout->layoutItems(rect, numCols);
#else
QList<QRect> itemRects =
legendLayout->layoutItems(rect, numCols);
#endif
int index = 0;
#if QT_VERSION < 0x040000
QLayoutIterator layoutIterator = legendLayout->iterator();
for ( QLayoutItem *item = layoutIterator.current();
item != 0; item = ++layoutIterator)
{
#else
for ( int i = 0; i < legendLayout->count(); i++ )
{
QLayoutItem *item = legendLayout->itemAt(i);
#endif
QWidget *w = item->widget();
if ( w )
{
painter->save();
painter->setClipping(true);
QwtPainter::setClipRect(painter, itemRects[index]);
printLegendItem(painter, w, itemRects[index]);
index++;
painter->restore();
}
}
}
/*!
Print the legend item into a given rectangle.
\param painter Painter
\param w Widget representing a legend item
\param rect Bounding rectangle
*/
void QwtPlot::printLegendItem(QPainter *painter,
const QWidget *w, const QRect &rect) const
{
if ( w->inherits("QwtLegendItem") )
{
QwtLegendItem *item = (QwtLegendItem *)w;
painter->setFont(item->font());
item->drawItem(painter, rect);
}
}
/*!
\brief Paint a scale into a given rectangle.
Paint the scale into a given rectangle.
\param painter Painter
\param axisId Axis
\param startDist Start border distance
\param endDist End border distance
\param baseDist Base distance
\param rect Bounding rectangle
*/
void QwtPlot::printScale(QPainter *painter,
int axisId, int startDist, int endDist, int baseDist,
const QRect &rect) const
{
if (!axisEnabled(axisId))
return;
QwtScaleDraw::Alignment align;
int x, y, w;
switch(axisId)
{
case yLeft:
{
x = rect.right() - baseDist + 1;
y = rect.y() + startDist;
w = rect.height() - startDist - endDist;
align = QwtScaleDraw::LeftScale;
break;
}
case yRight:
//.........这里部分代码省略.........