Changeset 8127 in ntrip for trunk/BNC/qwt/qwt_plot_grid.cpp


Ignore:
Timestamp:
May 10, 2017, 3:20:54 PM (7 years ago)
Author:
stoecker
Message:

update qwt and qwtpolar, many QT5 fixes (unfinished)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/qwt/qwt_plot_grid.cpp

    r4271 r8127  
    3636    QwtScaleDiv yScaleDiv;
    3737
    38     QPen majPen;
    39     QPen minPen;
     38    QPen majorPen;
     39    QPen minorPen;
    4040};
    4141
     
    4545{
    4646    d_data = new PrivateData;
     47
     48    setItemInterest( QwtPlotItem::ScaleInterest, true );
    4749    setZ( 10.0 );
    4850}
     
    6163
    6264/*!
    63   \brief Enable or disable vertical gridlines
    64   \param tf Enable (true) or disable
    65 
    66   \sa Minor gridlines can be enabled or disabled with
     65  \brief Enable or disable vertical grid lines
     66  \param on Enable (true) or disable
     67
     68  \sa Minor grid lines can be enabled or disabled with
    6769      enableXMin()
    6870*/
    69 void QwtPlotGrid::enableX( bool tf )
    70 {
    71     if ( d_data->xEnabled != tf )
    72     {
    73         d_data->xEnabled = tf;
    74         itemChanged();
    75     }
    76 }
    77 
    78 /*!
    79   \brief Enable or disable horizontal gridlines
    80   \param tf Enable (true) or disable
    81   \sa Minor gridlines can be enabled or disabled with enableYMin()
    82 */
    83 void QwtPlotGrid::enableY( bool tf )
    84 {
    85     if ( d_data->yEnabled != tf )
    86     {
    87         d_data->yEnabled = tf;
    88         itemChanged();
    89     }
    90 }
    91 
    92 /*!
    93   \brief Enable or disable  minor vertical gridlines.
    94   \param tf Enable (true) or disable
     71void QwtPlotGrid::enableX( bool on )
     72{
     73    if ( d_data->xEnabled != on )
     74    {
     75        d_data->xEnabled = on;
     76
     77        legendChanged();
     78        itemChanged();
     79    }
     80}
     81
     82/*!
     83  \brief Enable or disable horizontal grid lines
     84  \param on Enable (true) or disable
     85  \sa Minor grid lines can be enabled or disabled with enableYMin()
     86*/
     87void QwtPlotGrid::enableY( bool on )
     88{
     89    if ( d_data->yEnabled != on )
     90    {
     91        d_data->yEnabled = on;
     92
     93        legendChanged();
     94        itemChanged();
     95    }
     96}
     97
     98/*!
     99  \brief Enable or disable  minor vertical grid lines.
     100  \param on Enable (true) or disable
    95101  \sa enableX()
    96102*/
    97 void QwtPlotGrid::enableXMin( bool tf )
    98 {
    99     if ( d_data->xMinEnabled != tf )
    100     {
    101         d_data->xMinEnabled = tf;
    102         itemChanged();
    103     }
    104 }
    105 
    106 /*!
    107   \brief Enable or disable minor horizontal gridlines
    108   \param tf Enable (true) or disable
     103void QwtPlotGrid::enableXMin( bool on )
     104{
     105    if ( d_data->xMinEnabled != on )
     106    {
     107        d_data->xMinEnabled = on;
     108
     109        legendChanged();
     110        itemChanged();
     111    }
     112}
     113
     114/*!
     115  \brief Enable or disable minor horizontal grid lines
     116  \param on Enable (true) or disable
    109117  \sa enableY()
    110118*/
    111 void QwtPlotGrid::enableYMin( bool tf )
    112 {
    113     if ( d_data->yMinEnabled != tf )
    114     {
    115         d_data->yMinEnabled = tf;
     119void QwtPlotGrid::enableYMin( bool on )
     120{
     121    if ( d_data->yMinEnabled != on )
     122    {
     123        d_data->yMinEnabled = on;
     124
     125        legendChanged();
    116126        itemChanged();
    117127    }
     
    147157
    148158/*!
    149   Assign a pen for both major and minor gridlines
     159  Build and assign a pen for both major and minor grid lines
     160
     161  In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it
     162  non cosmetic ( see QPen::isCosmetic() ). This method has been introduced
     163  to hide this incompatibility.
     164
     165  \param color Pen color
     166  \param width Pen width
     167  \param style Pen style
     168
     169  \sa pen(), brush()
     170 */
     171void QwtPlotGrid::setPen( const QColor &color, qreal width, Qt::PenStyle style )
     172{
     173    setPen( QPen( color, width, style ) );
     174}
     175
     176/*!
     177  Assign a pen for both major and minor grid lines
    150178
    151179  \param pen Pen
    152   \sa setMajPen(), setMinPen()
     180  \sa setMajorPen(), setMinorPen()
    153181*/
    154182void QwtPlotGrid::setPen( const QPen &pen )
    155183{
    156     if ( d_data->majPen != pen || d_data->minPen != pen )
    157     {
    158         d_data->majPen = pen;
    159         d_data->minPen = pen;
    160         itemChanged();
    161     }
    162 }
    163 
    164 /*!
    165   Assign a pen for the major gridlines
     184    if ( d_data->majorPen != pen || d_data->minorPen != pen )
     185    {
     186        d_data->majorPen = pen;
     187        d_data->minorPen = pen;
     188
     189        legendChanged();
     190        itemChanged();
     191    }
     192}
     193
     194/*!
     195  Build and assign a pen for both major grid lines
     196
     197  In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it
     198  non cosmetic ( see QPen::isCosmetic() ). This method has been introduced
     199  to hide this incompatibility.
     200
     201  \param color Pen color
     202  \param width Pen width
     203  \param style Pen style
     204
     205  \sa pen(), brush()
     206 */
     207void QwtPlotGrid::setMajorPen( const QColor &color, qreal width, Qt::PenStyle style )
     208{
     209    setMajorPen( QPen( color, width, style ) );
     210}
     211
     212/*!
     213  Assign a pen for the major grid lines
    166214
    167215  \param pen Pen
    168   \sa majPen(), setMinPen(), setPen()
    169 */
    170 void QwtPlotGrid::setMajPen( const QPen &pen )
    171 {
    172     if ( d_data->majPen != pen )
    173     {
    174         d_data->majPen = pen;
    175         itemChanged();
    176     }
    177 }
    178 
    179 /*!
    180   Assign a pen for the minor gridlines
     216  \sa majorPen(), setMinorPen(), setPen()
     217*/
     218void QwtPlotGrid::setMajorPen( const QPen &pen )
     219{
     220    if ( d_data->majorPen != pen )
     221    {
     222        d_data->majorPen = pen;
     223
     224        legendChanged();
     225        itemChanged();
     226    }
     227}
     228
     229/*!
     230  Build and assign a pen for the minor grid lines
     231
     232  In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it
     233  non cosmetic ( see QPen::isCosmetic() ). This method has been introduced
     234  to hide this incompatibility.
     235
     236  \param color Pen color
     237  \param width Pen width
     238  \param style Pen style
     239
     240  \sa pen(), brush()
     241 */
     242void QwtPlotGrid::setMinorPen( const QColor &color, qreal width, Qt::PenStyle style )
     243{
     244    setMinorPen( QPen( color, width, style ) );
     245}
     246
     247/*!
     248  Assign a pen for the minor grid lines
    181249
    182250  \param pen Pen
    183   \sa minPen(), setMajPen(), setPen()
    184 */
    185 void QwtPlotGrid::setMinPen( const QPen &pen )
    186 {
    187     if ( d_data->minPen != pen )
    188     {
    189         d_data->minPen = pen;
     251  \sa minorPen(), setMajorPen(), setPen()
     252*/
     253void QwtPlotGrid::setMinorPen( const QPen &pen )
     254{
     255    if ( d_data->minorPen != pen )
     256    {
     257        d_data->minorPen = pen;
     258
     259        legendChanged();
    190260        itemChanged();
    191261    }
     
    196266
    197267  The grid is drawn into the bounding rectangle such that
    198   gridlines begin and end at the rectangle's borders. The X and Y
     268  grid lines begin and end at the rectangle's borders. The X and Y
    199269  maps are used to map the scale divisions into the drawing region
    200270  screen.
     271
    201272  \param painter  Painter
    202273  \param xMap X axis map
    203274  \param yMap Y axis
    204   \param canvasRect Contents rect of the plot canvas
     275  \param canvasRect Contents rectangle of the plot canvas
    205276*/
    206277void QwtPlotGrid::draw( QPainter *painter,
     
    208279    const QRectF &canvasRect ) const
    209280{
    210     //  draw minor gridlines
    211     QPen minPen = d_data->minPen;
    212     minPen.setCapStyle( Qt::FlatCap );
    213 
    214     painter->setPen( minPen );
     281    //  draw minor grid lines
     282    QPen minorPen = d_data->minorPen;
     283    minorPen.setCapStyle( Qt::FlatCap );
     284
     285    painter->setPen( minorPen );
    215286
    216287    if ( d_data->xEnabled && d_data->xMinEnabled )
     
    230301    }
    231302
    232     //  draw major gridlines
    233     QPen majPen = d_data->majPen;
    234     majPen.setCapStyle( Qt::FlatCap );
    235 
    236     painter->setPen( majPen );
     303    //  draw major grid lines
     304    QPen majorPen = d_data->majorPen;
     305    majorPen.setCapStyle( Qt::FlatCap );
     306
     307    painter->setPen( majorPen );
    237308
    238309    if ( d_data->xEnabled )
     
    286357
    287358/*!
    288   \return the pen for the major gridlines
    289   \sa setMajPen(), setMinPen(), setPen()
    290 */
    291 const QPen &QwtPlotGrid::majPen() const
    292 {
    293     return d_data->majPen;
    294 }
    295 
    296 /*!
    297   \return the pen for the minor gridlines
    298   \sa setMinPen(), setMajPen(), setPen()
    299 */
    300 const QPen &QwtPlotGrid::minPen() const
    301 {
    302     return d_data->minPen;
    303 }
    304 
    305 /*!
    306   \return true if vertical gridlines are enabled
     359  \return the pen for the major grid lines
     360  \sa setMajorPen(), setMinorPen(), setPen()
     361*/
     362const QPen &QwtPlotGrid::majorPen() const
     363{
     364    return d_data->majorPen;
     365}
     366
     367/*!
     368  \return the pen for the minor grid lines
     369  \sa setMinorPen(), setMajorPen(), setPen()
     370*/
     371const QPen &QwtPlotGrid::minorPen() const
     372{
     373    return d_data->minorPen;
     374}
     375
     376/*!
     377  \return true if vertical grid lines are enabled
    307378  \sa enableX()
    308379*/
     
    313384
    314385/*!
    315   \return true if minor vertical gridlines are enabled
     386  \return true if minor vertical grid lines are enabled
    316387  \sa enableXMin()
    317388*/
     
    322393
    323394/*!
    324   \return true if horizontal gridlines are enabled
     395  \return true if horizontal grid lines are enabled
    325396  \sa enableY()
    326397*/
     
    331402
    332403/*!
    333   \return true if minor horizontal gridlines are enabled
     404  \return true if minor horizontal grid lines are enabled
    334405  \sa enableYMin()
    335406*/
Note: See TracChangeset for help on using the changeset viewer.