Changeset 11158 in ntrip for trunk/BNC/qwt/qwt_column_symbol.cpp
- Timestamp:
- Nov 3, 2026, 10:53:35 AM (3 weeks ago)
- File:
-
- 1 edited
-
trunk/BNC/qwt/qwt_column_symbol.cpp (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/qwt/qwt_column_symbol.cpp
r9383 r11158 1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*-*****************************1 /****************************************************************************** 2 2 * Qwt Widget Library 3 3 * Copyright (C) 1997 Josef Wilgen … … 9 9 10 10 #include "qwt_column_symbol.h" 11 #include "qwt_painter.h" 11 12 #include "qwt_math.h" 12 #include "qwt_painter.h" 13 13 14 #include <qpainter.h> 14 15 #include <qpalette.h> 15 16 16 static void qwtDrawBox( QPainter *p, const QRectF&rect,17 const QPalette &pal, double lw )17 static void qwtDrawBox( QPainter* p, const QRectF& rect, 18 const QPalette& pal, double lw ) 18 19 { 19 20 if ( lw > 0.0 ) … … 33 34 } 34 35 35 lw = q Min( lw, rect.height() / 2.0 - 1.0 );36 lw = q Min( lw, rect.width() / 2.0 - 1.0 );36 lw = qwtMinF( lw, rect.height() / 2.0 - 1.0 ); 37 lw = qwtMinF( lw, rect.width() / 2.0 - 1.0 ); 37 38 38 39 const QRectF outerRect = rect.adjusted( 0, 0, 1, 1 ); 39 40 QPolygonF polygon( outerRect ); 40 41 41 if ( outerRect.width() > 2 * lw && 42 outerRect.height() > 2 * lw ) 42 if ( outerRect.width() > 2 * lw && outerRect.height() > 2 * lw ) 43 43 { 44 44 const QRectF innerRect = outerRect.adjusted( lw, lw, -lw, -lw ); … … 57 57 } 58 58 59 static void qwtDrawPanel( QPainter *painter, const QRectF&rect,60 const QPalette &pal, double lw )59 static void qwtDrawPanel( QPainter* painter, const QRectF& rect, 60 const QPalette& pal, double lw ) 61 61 { 62 62 if ( lw > 0.0 ) … … 76 76 } 77 77 78 lw = q Min( lw, rect.height() / 2.0 - 1.0 );79 lw = q Min( lw, rect.width() / 2.0 - 1.0 );78 lw = qwtMinF( lw, rect.height() / 2.0 - 1.0 ); 79 lw = qwtMinF( lw, rect.width() / 2.0 - 1.0 ); 80 80 81 81 const QRectF outerRect = rect.adjusted( 0, 0, 1, 1 ); … … 111 111 class QwtColumnSymbol::PrivateData 112 112 { 113 public: 114 PrivateData() :115 style( QwtColumnSymbol::Box ) ,116 frameStyle( QwtColumnSymbol::Raised ) ,117 palette( Qt::gray ) ,118 lineWidth( 2 ) 113 public: 114 PrivateData() 115 : style( QwtColumnSymbol::Box ) 116 , frameStyle( QwtColumnSymbol::Raised ) 117 , palette( Qt::gray ) 118 , lineWidth( 2 ) 119 119 { 120 120 } … … 128 128 129 129 /*! 130 Constructor 131 132 \param style Style of the symbol 133 \sa setStyle(), style(), Style 134 */ 130 Constructor 131 132 \param style Style of the symbol 133 \sa setStyle(), style(), Style 134 */ 135 135 QwtColumnSymbol::QwtColumnSymbol( Style style ) 136 136 { 137 d_data = new PrivateData();138 d_data->style = style;137 m_data = new PrivateData(); 138 m_data->style = style; 139 139 } 140 140 … … 142 142 QwtColumnSymbol::~QwtColumnSymbol() 143 143 { 144 delete d_data;145 } 146 147 /*! 148 Specify the symbol style 149 150 \param style Style 151 \sa style(), setPalette() 152 */ 144 delete m_data; 145 } 146 147 /*! 148 Specify the symbol style 149 150 \param style Style 151 \sa style(), setPalette() 152 */ 153 153 void QwtColumnSymbol::setStyle( Style style ) 154 154 { 155 d_data->style = style;156 } 157 158 /*! 159 \return Current symbol style 160 \sa setStyle() 161 */ 155 m_data->style = style; 156 } 157 158 /*! 159 \return Current symbol style 160 \sa setStyle() 161 */ 162 162 QwtColumnSymbol::Style QwtColumnSymbol::style() const 163 163 { 164 return d_data->style;165 } 166 167 /*! 168 Assign a palette for the symbol 169 170 \param palette Palette 171 \sa palette(), setStyle() 172 */ 173 void QwtColumnSymbol::setPalette( const QPalette &palette )174 { 175 d_data->palette = palette;176 } 177 178 /*! 179 \return Current palette 180 \sa setPalette() 181 */ 164 return m_data->style; 165 } 166 167 /*! 168 Assign a palette for the symbol 169 170 \param palette Palette 171 \sa palette(), setStyle() 172 */ 173 void QwtColumnSymbol::setPalette( const QPalette& palette ) 174 { 175 m_data->palette = palette; 176 } 177 178 /*! 179 \return Current palette 180 \sa setPalette() 181 */ 182 182 const QPalette& QwtColumnSymbol::palette() const 183 183 { 184 return d_data->palette;184 return m_data->palette; 185 185 } 186 186 … … 190 190 \param frameStyle Frame style 191 191 \sa frameStyle(), setLineWidth(), setStyle() 192 */ 192 */ 193 193 void QwtColumnSymbol::setFrameStyle( FrameStyle frameStyle ) 194 194 { 195 d_data->frameStyle = frameStyle;196 } 197 198 /*! 199 \return Current frame style, that is used for the Box style. 200 \sa setFrameStyle(), lineWidth(), setStyle() 201 */ 195 m_data->frameStyle = frameStyle; 196 } 197 198 /*! 199 \return Current frame style, that is used for the Box style. 200 \sa setFrameStyle(), lineWidth(), setStyle() 201 */ 202 202 QwtColumnSymbol::FrameStyle QwtColumnSymbol::frameStyle() const 203 203 { 204 return d_data->frameStyle;204 return m_data->frameStyle; 205 205 } 206 206 … … 210 210 \param width Width 211 211 \sa lineWidth(), setFrameStyle() 212 */ 212 */ 213 213 void QwtColumnSymbol::setLineWidth( int width ) 214 214 { … … 216 216 width = 0; 217 217 218 d_data->lineWidth = width;219 } 220 221 /*! 222 \return Line width of the frame, that is used for the Box style. 223 \sa setLineWidth(), frameStyle(), setStyle() 224 */ 218 m_data->lineWidth = width; 219 } 220 221 /*! 222 \return Line width of the frame, that is used for the Box style. 223 \sa setLineWidth(), frameStyle(), setStyle() 224 */ 225 225 int QwtColumnSymbol::lineWidth() const 226 226 { 227 return d_data->lineWidth;228 } 229 230 /*! 231 Draw the symbol depending on its style. 232 233 \param painter Painter 234 \param rect Directed rectangle 235 236 \sa drawBox() 237 */ 238 void QwtColumnSymbol::draw( QPainter *painter,239 const QwtColumnRect &rect ) const227 return m_data->lineWidth; 228 } 229 230 /*! 231 Draw the symbol depending on its style. 232 233 \param painter Painter 234 \param rect Directed rectangle 235 236 \sa drawBox() 237 */ 238 void QwtColumnSymbol::draw( QPainter* painter, 239 const QwtColumnRect& rect ) const 240 240 { 241 241 painter->save(); 242 242 243 switch ( d_data->style )243 switch ( m_data->style ) 244 244 { 245 245 case QwtColumnSymbol::Box: … … 255 255 256 256 /*! 257 Draw the symbol when it is in Box style. 258 259 \param painter Painter 260 \param rect Directed rectangle 261 262 \sa draw() 263 */ 264 void QwtColumnSymbol::drawBox( QPainter *painter,265 const QwtColumnRect &rect ) const257 Draw the symbol when it is in Box style. 258 259 \param painter Painter 260 \param rect Directed rectangle 261 262 \sa draw() 263 */ 264 void QwtColumnSymbol::drawBox( QPainter* painter, 265 const QwtColumnRect& rect ) const 266 266 { 267 267 QRectF r = rect.toRect(); … … 274 274 } 275 275 276 switch ( d_data->frameStyle )276 switch ( m_data->frameStyle ) 277 277 { 278 278 case QwtColumnSymbol::Raised: 279 279 { 280 qwtDrawPanel( painter, r, d_data->palette,d_data->lineWidth );280 qwtDrawPanel( painter, r, m_data->palette, m_data->lineWidth ); 281 281 break; 282 282 } 283 283 case QwtColumnSymbol::Plain: 284 284 { 285 qwtDrawBox( painter, r, d_data->palette,d_data->lineWidth );285 qwtDrawBox( painter, r, m_data->palette, m_data->lineWidth ); 286 286 break; 287 287 } 288 288 default: 289 289 { 290 painter->fillRect( r.adjusted( 0, 0, 1, 1 ), d_data->palette.window() ); 291 } 292 } 293 } 290 painter->fillRect( r.adjusted( 0, 0, 1, 1 ), m_data->palette.window() ); 291 } 292 } 293 } 294 295 //! \return A normalized QRect built from the intervals 296 QRectF QwtColumnRect::toRect() const 297 { 298 QRectF r( hInterval.minValue(), vInterval.minValue(), 299 hInterval.maxValue() - hInterval.minValue(), 300 vInterval.maxValue() - vInterval.minValue() ); 301 302 r = r.normalized(); 303 304 if ( hInterval.borderFlags() & QwtInterval::ExcludeMinimum ) 305 r.adjust( 1, 0, 0, 0 ); 306 307 if ( hInterval.borderFlags() & QwtInterval::ExcludeMaximum ) 308 r.adjust( 0, 0, -1, 0 ); 309 310 if ( vInterval.borderFlags() & QwtInterval::ExcludeMinimum ) 311 r.adjust( 0, 1, 0, 0 ); 312 313 if ( vInterval.borderFlags() & QwtInterval::ExcludeMaximum ) 314 r.adjust( 0, 0, 0, -1 ); 315 316 return r; 317 } 318
Note:
See TracChangeset
for help on using the changeset viewer.
