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


C++ QwtDynGridLayout::setMaxCols方法代码示例

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


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

示例1: insertLegend

/*!
  \brief Insert a legend

  If the position legend is \c QwtPlot::LeftLegend or \c QwtPlot::RightLegend
  the legend will be organized in one column from top to down. 
  Otherwise the legend items will be placed in a table 
  with a best fit number of columns from left to right.

  If pos != QwtPlot::ExternalLegend the plot widget will become 
  parent of the legend. It will be deleted when the plot is deleted, 
  or another legend is set with insertLegend().
       
  \param legend Legend
  \param pos The legend's position. For top/left position the number
             of colums will be limited to 1, otherwise it will be set to
             unlimited. 

  \param ratio Ratio between legend and the bounding rect
               of title, canvas and axes. The legend will be shrinked
               if it would need more space than the given ratio.
               The ratio is limited to ]0.0 .. 1.0]. In case of <= 0.0
               it will be reset to the default ratio.
               The default vertical/horizontal ratio is 0.33/0.5.

  \sa legend(), QwtPlotLayout::legendPosition(), 
      QwtPlotLayout::setLegendPosition()
*/
void QwtPlot::insertLegend(QwtLegend *legend, 
    QwtPlot::LegendPosition pos, double ratio)
{
    d_data->layout->setLegendPosition(pos, ratio);

    if ( legend != d_data->legend )
    {
        if ( d_data->legend && d_data->legend->parent() == this )
            delete d_data->legend;

        d_data->legend = legend;

        if ( d_data->legend )
        {
            if ( pos != ExternalLegend )
            {
                if ( d_data->legend->parent() != this )
                {
#if QT_VERSION < 0x040000
                    d_data->legend->reparent(this, QPoint(0, 0));
#else
                    d_data->legend->setParent(this);
#endif
                }
            }

            const QwtPlotItemList& itmList = itemList();
            for ( QwtPlotItemIterator it = itmList.begin();
                it != itmList.end(); ++it )
            {
                (*it)->updateLegend(d_data->legend);
            }

            QLayout *l = d_data->legend->contentsWidget()->layout();
            if ( l && l->inherits("QwtDynGridLayout") )
            {
                QwtDynGridLayout *tl = (QwtDynGridLayout *)l;
                switch(d_data->layout->legendPosition())
                {
                    case LeftLegend:
                    case RightLegend:
                        tl->setMaxCols(1); // 1 column: align vertical
                        break;
                    case TopLegend:
                    case BottomLegend:
                        tl->setMaxCols(0); // unlimited
                        break;
                    case ExternalLegend:
                        break;
                }
            }
        }
        updateTabOrder();
    }

    updateLayout();
}
开发者ID:DTUautopilot,项目名称:qgroundcontrol,代码行数:84,代码来源:qwt_plot.cpp

示例2: insertLegend

/*!
  \brief Insert a legend

  If the position legend is \c QwtPlot::LeftLegend or \c QwtPlot::RightLegend
  the legend will be organized in one column from top to down.
  Otherwise the legend items will be placed in a table
  with a best fit number of columns from left to right.

  If pos != QwtPlot::ExternalLegend the plot widget will become
  parent of the legend. It will be deleted when the plot is deleted,
  or another legend is set with insertLegend().

  \param legend Legend
  \param pos The legend's position. For top/left position the number
             of colums will be limited to 1, otherwise it will be set to
             unlimited.

  \param ratio Ratio between legend and the bounding rect
               of title, canvas and axes. The legend will be shrinked
               if it would need more space than the given ratio.
               The ratio is limited to ]0.0 .. 1.0]. In case of <= 0.0
               it will be reset to the default ratio.
               The default vertical/horizontal ratio is 0.33/0.5.

  \sa legend(), QwtPlotLayout::legendPosition(),
      QwtPlotLayout::setLegendPosition()
*/
void QwtPlot::insertLegend( QwtLegend *legend,
    QwtPlot::LegendPosition pos, double ratio )
{
    d_data->layout->setLegendPosition( pos, ratio );

    if ( legend != d_data->legend )
    {
        if ( d_data->legend && d_data->legend->parent() == this )
            delete d_data->legend;

        d_data->legend = legend;

        if ( d_data->legend )
        {
            if ( pos != ExternalLegend )
            {
                if ( d_data->legend->parent() != this )
                    d_data->legend->setParent( this );
            }

            const QwtPlotItemList& itmList = itemList();
            for ( QwtPlotItemIterator it = itmList.begin();
                it != itmList.end(); ++it )
            {
                ( *it )->updateLegend( d_data->legend );
            }

            QwtDynGridLayout *tl = qobject_cast<QwtDynGridLayout *>(
                d_data->legend->contentsWidget()->layout() );
            if ( tl )
            {
                switch ( d_data->layout->legendPosition() )
                {
                    case LeftLegend:
                    case RightLegend:
                        tl->setMaxCols( 1 ); // 1 column: align vertical
                        break;
                    case TopLegend:
                    case BottomLegend:
                        tl->setMaxCols( 0 ); // unlimited
                        break;
                    case ExternalLegend:
                        break;
                }
            }
        }
        updateTabOrder();
    }

    updateLayout();
}
开发者ID:Alex-Rongzhen-Huang,项目名称:OpenPilot,代码行数:78,代码来源:qwt_plot.cpp

示例3: setLegendPosition

/*!
  Specify the position of the legend within the widget.
  If the position legend is \c QwtPlot::Left or \c QwtPlot::Right
  the legend will be organized in one column from top to down. 
  Otherwise the legend items will be placed be placed in a table 
  with a best fit number of columns from left to right.
       
  \param pos The legend's position. Valid values are \c QwtPlot::Left,
           \c QwtPlot::Right, \c QwtPlot::Top, \c QwtPlot::Bottom.
  \param ratio Ratio between legend and the bounding rect
               of title, canvas and axes. The legend will be shrinked
               if it would need more space than the given ratio.
               The ratio is limited to ]0.0 .. 1.0]. In case of <= 0.0
               it will be reset to the default ratio.
               The default vertical/horizontal ratio is 0.33/0.5.

  \sa QwtPlot::legendPosition(), QwtPlotLayout::setLegendPosition()
*/
void QwtPlot::setLegendPosition(QwtPlot::Position pos, double ratio)
{
    if (pos != d_layout->legendPosition())
    {
        d_layout->setLegendPosition(pos, ratio);

        QLayout *l = d_legend->contentsWidget()->layout();
        if ( l && l->inherits("QwtDynGridLayout") )
        {
            QwtDynGridLayout *tl = (QwtDynGridLayout *)l;
            if ( d_layout->legendPosition() == QwtPlot::Top ||
                d_layout->legendPosition() == QwtPlot::Bottom )
            {
                tl->setMaxCols(0); // unlimited
            }
            else
                tl->setMaxCols(1); // 1 column: align vertical
        }

        updateLayout();
        updateTabOrder();
    }
}
开发者ID:jiajw0426,项目名称:easyscada,代码行数:41,代码来源:qwt_plot.cpp


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