Changeset 8127 in ntrip for trunk/BNC/qwt/qwt_text.cpp
- Timestamp:
- May 10, 2017, 3:20:54 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/qwt/qwt_text.cpp
r4271 r8127 2 2 * Qwt Widget Library 3 3 * Copyright (C) 1997 Josef Wilgen 4 * Copyright (C) 200 3Uwe Rathmann4 * Copyright (C) 2002 Uwe Rathmann 5 5 * 6 6 * This library is free software; you can redistribute it and/or … … 139 139 PrivateData(): 140 140 renderFlags( Qt::AlignCenter ), 141 backgroundPen( Qt::NoPen ), 141 borderRadius( 0 ), 142 borderPen( Qt::NoPen ), 142 143 backgroundBrush( Qt::NoBrush ), 143 144 paintAttributes( 0 ), … … 151 152 QFont font; 152 153 QColor color; 153 QPen backgroundPen; 154 double borderRadius; 155 QPen borderPen; 154 156 QBrush backgroundBrush; 155 157 … … 219 221 d_data->font == other.d_data->font && 220 222 d_data->color == other.d_data->color && 221 d_data->backgroundPen == other.d_data->backgroundPen && 223 d_data->borderRadius == other.d_data->borderRadius && 224 d_data->borderPen == other.d_data->borderPen && 222 225 d_data->backgroundBrush == other.d_data->backgroundBrush && 223 226 d_data->paintAttributes == other.d_data->paintAttributes && … … 248 251 249 252 /*! 250 Return the text.253 \return Text as QString. 251 254 \sa setText() 252 255 */ … … 261 264 The default setting is Qt::AlignCenter 262 265 263 \param renderFlags Bitwise OR of the flags used like in QPainter::drawText 266 \param renderFlags Bitwise OR of the flags used like in QPainter::drawText() 264 267 265 268 \sa renderFlags(), QwtTextEngine::draw() … … 304 307 305 308 /*! 306 Return the font of the text, if it has one. 307 Otherwise return defaultFont. 308 309 \param defaultFont Default font 310 \sa setFont(), font(), PaintAttributes 309 Return the font of the text, if it has one. 310 Otherwise return defaultFont. 311 312 \param defaultFont Default font 313 \return Font used for drawing the text 314 315 \sa setFont(), font(), PaintAttributes 311 316 */ 312 317 QFont QwtText::usedFont( const QFont &defaultFont ) const … … 319 324 320 325 /*! 321 Set the pen color used for painting the text.326 Set the pen color used for drawing the text. 322 327 323 328 \param color Color … … 342 347 343 348 \param defaultColor Default color 349 \return Color used for drawing the text 350 344 351 \sa setColor(), color(), PaintAttributes 345 352 */ … … 353 360 354 361 /*! 362 Set the radius for the corners of the border frame 363 364 \param radius Radius of a rounded corner 365 \sa borderRadius(), setBorderPen(), setBackgroundBrush() 366 */ 367 void QwtText::setBorderRadius( double radius ) 368 { 369 d_data->borderRadius = qMax( 0.0, radius ); 370 } 371 372 /*! 373 \return Radius for the corners of the border frame 374 \sa setBorderRadius(), borderPen(), backgroundBrush() 375 */ 376 double QwtText::borderRadius() const 377 { 378 return d_data->borderRadius; 379 } 380 381 /*! 355 382 Set the background pen 356 383 357 384 \param pen Background pen 358 \sa b ackgroundPen(), setBackgroundBrush()359 */ 360 void QwtText::setB ackgroundPen( const QPen &pen )361 { 362 d_data->b ackgroundPen = pen;385 \sa borderPen(), setBackgroundBrush() 386 */ 387 void QwtText::setBorderPen( const QPen &pen ) 388 { 389 d_data->borderPen = pen; 363 390 setPaintAttribute( PaintBackground ); 364 391 } … … 366 393 /*! 367 394 \return Background pen 368 \sa setB ackgroundPen(), backgroundBrush()369 */ 370 QPen QwtText::b ackgroundPen() const371 { 372 return d_data->b ackgroundPen;395 \sa setBorderPen(), backgroundBrush() 396 */ 397 QPen QwtText::borderPen() const 398 { 399 return d_data->borderPen; 373 400 } 374 401 … … 377 404 378 405 \param brush Background brush 379 \sa backgroundBrush(), setB ackgroundPen()406 \sa backgroundBrush(), setBorderPen() 380 407 */ 381 408 void QwtText::setBackgroundBrush( const QBrush &brush ) … … 387 414 /*! 388 415 \return Background brush 389 \sa setBackgroundBrush(), b ackgroundPen()416 \sa setBackgroundBrush(), borderPen() 390 417 */ 391 418 QBrush QwtText::backgroundBrush() const … … 401 428 402 429 \note Used by setFont(), setColor(), 403 setB ackgroundPen() and setBackgroundBrush()430 setBorderPen() and setBackgroundBrush() 404 431 \sa testPaintAttribute() 405 432 */ … … 492 519 493 520 /*! 494 Find the height for a given width495 496 \param defaultFont Font, used for the calculation if the text has no font497 498 \return Calculated height499 */500 501 /*!502 521 Returns the size, that is needed to render text 503 522 504 523 \param defaultFont Font of the text 505 \return Cal uclated size524 \return Calculated size 506 525 */ 507 526 QSizeF QwtText::textSize( const QFont &defaultFont ) const … … 543 562 if ( d_data->paintAttributes & PaintBackground ) 544 563 { 545 if ( d_data->b ackgroundPen != Qt::NoPen ||564 if ( d_data->borderPen != Qt::NoPen || 546 565 d_data->backgroundBrush != Qt::NoBrush ) 547 566 { 548 567 painter->save(); 549 painter->setPen( d_data->backgroundPen ); 568 569 painter->setPen( d_data->borderPen ); 550 570 painter->setBrush( d_data->backgroundBrush ); 551 QwtPainter::drawRect( painter, rect ); 571 572 if ( d_data->borderRadius == 0 ) 573 { 574 QwtPainter::drawRect( painter, rect ); 575 } 576 else 577 { 578 painter->setRenderHint( QPainter::Antialiasing, true ); 579 painter->drawRoundedRect( rect, 580 d_data->borderRadius, d_data->borderRadius ); 581 } 582 552 583 painter->restore(); 553 584 } … … 596 627 In case of QwtText::AutoText the first text engine 597 628 (beside QwtPlainTextEngine) is returned, where QwtTextEngine::mightRender 598 returns true. If there is none QwtPlainTextEngine is return d.629 returns true. If there is none QwtPlainTextEngine is returned. 599 630 600 631 If no text engine is registered for the format QwtPlainTextEngine … … 603 634 \param text Text, needed in case of AutoText 604 635 \param format Text format 636 637 \return Corresponding text engine 605 638 */ 606 639 const QwtTextEngine *QwtText::textEngine( const QString &text,
Note:
See TracChangeset
for help on using the changeset viewer.