Changeset 8127 in ntrip for trunk/BNC/qwt/qwt_plot_grid.cpp
- Timestamp:
- May 10, 2017, 3:20:54 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/qwt/qwt_plot_grid.cpp
r4271 r8127 36 36 QwtScaleDiv yScaleDiv; 37 37 38 QPen maj Pen;39 QPen min Pen;38 QPen majorPen; 39 QPen minorPen; 40 40 }; 41 41 … … 45 45 { 46 46 d_data = new PrivateData; 47 48 setItemInterest( QwtPlotItem::ScaleInterest, true ); 47 49 setZ( 10.0 ); 48 50 } … … 61 63 62 64 /*! 63 \brief Enable or disable vertical grid lines64 \param tfEnable (true) or disable65 66 \sa Minor grid lines can be enabled or disabled with65 \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 67 69 enableXMin() 68 70 */ 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 71 void 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 */ 87 void 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 95 101 \sa enableX() 96 102 */ 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 103 void 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 109 117 \sa enableY() 110 118 */ 111 void QwtPlotGrid::enableYMin( bool tf ) 112 { 113 if ( d_data->yMinEnabled != tf ) 114 { 115 d_data->yMinEnabled = tf; 119 void QwtPlotGrid::enableYMin( bool on ) 120 { 121 if ( d_data->yMinEnabled != on ) 122 { 123 d_data->yMinEnabled = on; 124 125 legendChanged(); 116 126 itemChanged(); 117 127 } … … 147 157 148 158 /*! 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 */ 171 void 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 150 178 151 179 \param pen Pen 152 \sa setMaj Pen(), setMinPen()180 \sa setMajorPen(), setMinorPen() 153 181 */ 154 182 void QwtPlotGrid::setPen( const QPen &pen ) 155 183 { 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 */ 207 void 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 166 214 167 215 \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 */ 218 void 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 */ 242 void 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 181 249 182 250 \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 */ 253 void QwtPlotGrid::setMinorPen( const QPen &pen ) 254 { 255 if ( d_data->minorPen != pen ) 256 { 257 d_data->minorPen = pen; 258 259 legendChanged(); 190 260 itemChanged(); 191 261 } … … 196 266 197 267 The grid is drawn into the bounding rectangle such that 198 grid lines begin and end at the rectangle's borders. The X and Y268 grid lines begin and end at the rectangle's borders. The X and Y 199 269 maps are used to map the scale divisions into the drawing region 200 270 screen. 271 201 272 \param painter Painter 202 273 \param xMap X axis map 203 274 \param yMap Y axis 204 \param canvasRect Contents rect of the plot canvas275 \param canvasRect Contents rectangle of the plot canvas 205 276 */ 206 277 void QwtPlotGrid::draw( QPainter *painter, … … 208 279 const QRectF &canvasRect ) const 209 280 { 210 // draw minor grid lines211 QPen min Pen = d_data->minPen;212 min Pen.setCapStyle( Qt::FlatCap );213 214 painter->setPen( min Pen );281 // draw minor grid lines 282 QPen minorPen = d_data->minorPen; 283 minorPen.setCapStyle( Qt::FlatCap ); 284 285 painter->setPen( minorPen ); 215 286 216 287 if ( d_data->xEnabled && d_data->xMinEnabled ) … … 230 301 } 231 302 232 // draw major grid lines233 QPen maj Pen = d_data->majPen;234 maj Pen.setCapStyle( Qt::FlatCap );235 236 painter->setPen( maj Pen );303 // draw major grid lines 304 QPen majorPen = d_data->majorPen; 305 majorPen.setCapStyle( Qt::FlatCap ); 306 307 painter->setPen( majorPen ); 237 308 238 309 if ( d_data->xEnabled ) … … 286 357 287 358 /*! 288 \return the pen for the major grid lines289 \sa setMaj Pen(), setMinPen(), setPen()290 */ 291 const QPen &QwtPlotGrid::maj Pen() const292 { 293 return d_data->maj Pen;294 } 295 296 /*! 297 \return the pen for the minor grid lines298 \sa setMin Pen(), setMajPen(), setPen()299 */ 300 const QPen &QwtPlotGrid::min Pen() const301 { 302 return d_data->min Pen;303 } 304 305 /*! 306 \return true if vertical grid lines are enabled359 \return the pen for the major grid lines 360 \sa setMajorPen(), setMinorPen(), setPen() 361 */ 362 const 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 */ 371 const QPen &QwtPlotGrid::minorPen() const 372 { 373 return d_data->minorPen; 374 } 375 376 /*! 377 \return true if vertical grid lines are enabled 307 378 \sa enableX() 308 379 */ … … 313 384 314 385 /*! 315 \return true if minor vertical grid lines are enabled386 \return true if minor vertical grid lines are enabled 316 387 \sa enableXMin() 317 388 */ … … 322 393 323 394 /*! 324 \return true if horizontal grid lines are enabled395 \return true if horizontal grid lines are enabled 325 396 \sa enableY() 326 397 */ … … 331 402 332 403 /*! 333 \return true if minor horizontal grid lines are enabled404 \return true if minor horizontal grid lines are enabled 334 405 \sa enableYMin() 335 406 */
Note:
See TracChangeset
for help on using the changeset viewer.