Changeset 9383 in ntrip for trunk/BNC/qwt/qwt_plot_legenditem.cpp
- Timestamp:
- Mar 19, 2021, 9:15:03 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/qwt/qwt_plot_legenditem.cpp
r8127 r9383 49 49 }; 50 50 51 QwtLegendLayoutItem::QwtLegendLayoutItem( 51 QwtLegendLayoutItem::QwtLegendLayoutItem( 52 52 const QwtPlotLegendItem *legendItem, const QwtPlotItem *plotItem ): 53 53 d_legendItem( legendItem ), … … 167 167 }; 168 168 169 //! Constructor 169 //! Constructor 170 170 QwtPlotLegendItem::QwtPlotLegendItem(): 171 171 QwtPlotItem( QwtText( "Legend" ) ) … … 194 194 195 195 Alignment means the position of the legend relative 196 to the geometry of the plot canvas. 196 to the geometry of the plot canvas. 197 197 198 198 \param alignment Alignment flags … … 200 200 \sa alignment(), setMaxColumns() 201 201 202 \note To align a legend with many items horizontally 202 \note To align a legend with many items horizontally 203 203 the number of columns need to be limited 204 204 */ … … 262 262 if ( margin != this->margin() ) 263 263 { 264 d_data->layout->setContentsMargins( 264 d_data->layout->setContentsMargins( 265 265 margin, margin, margin, margin ); 266 266 … … 418 418 /*! 419 419 Set the radius for the border 420 420 421 421 \param radius A value <= 0 defines a rectangular border 422 422 \sa borderRadius(), setBorderPen() … … 495 495 \brief Set the background mode 496 496 497 Depending on the mode the complete legend or each item 497 Depending on the mode the complete legend or each item 498 498 might have an background. 499 499 … … 511 511 } 512 512 513 /*! 513 /*! 514 514 \return backgroundMode 515 515 \sa setBackgroundMode(), backgroundBrush(), drawBackground() … … 568 568 if ( d_data->backgroundMode == QwtPlotLegendItem::LegendBackground ) 569 569 drawBackground( painter, d_data->layout->geometry() ); 570 570 571 571 for ( int i = 0; i < d_data->layout->count(); i++ ) 572 572 { 573 const QwtLegendLayoutItem *layoutItem = 573 const QwtLegendLayoutItem *layoutItem = 574 574 static_cast<QwtLegendLayoutItem *>( d_data->layout->itemAt( i ) ); 575 575 … … 595 595 setBackgroundBrush(), setBackgroundMode() 596 596 */ 597 void QwtPlotLegendItem::drawBackground( 597 void QwtPlotLegendItem::drawBackground( 598 598 QPainter *painter, const QRectF &rect ) const 599 599 { … … 602 602 painter->setPen( d_data->borderPen ); 603 603 painter->setBrush( d_data->backgroundBrush ); 604 604 605 605 const double radius = d_data->borderRadius; 606 606 painter->drawRoundedRect( rect, radius, radius ); 607 607 608 608 painter->restore(); 609 609 } … … 624 624 { 625 625 int x = qRound( canvasRect.center().x() ); 626 rect.moveCenter( QPoint( x, rect.center().y() ) ); 626 rect.moveCenter( QPoint( x, rect.center().y() ) ); 627 627 } 628 628 else if ( d_data->alignment & Qt::AlignRight ) … … 630 630 rect.moveRight( qFloor( canvasRect.right() - margin ) ); 631 631 } 632 else 632 else 633 633 { 634 634 rect.moveLeft( qCeil( canvasRect.left() + margin ) ); … … 644 644 rect.moveBottom( qFloor( canvasRect.bottom() - margin ) ); 645 645 } 646 else 647 { 648 rect.moveTop( qCeil( canvasRect.top() + margin ) ); 646 else 647 { 648 rect.moveTop( qCeil( canvasRect.top() + margin ) ); 649 649 } 650 650 … … 653 653 654 654 /*! 655 Update the legend items according to modifications of a 655 Update the legend items according to modifications of a 656 656 plot item 657 657 … … 667 667 QList<QwtLegendLayoutItem *> layoutItems; 668 668 669 QMap<const QwtPlotItem *, QList<QwtLegendLayoutItem *> >::iterator it = 669 QMap<const QwtPlotItem *, QList<QwtLegendLayoutItem *> >::iterator it = 670 670 d_data->map.find( plotItem ); 671 671 if ( it != d_data->map.end() ) … … 692 692 for ( int i = 0; i < data.size(); i++ ) 693 693 { 694 QwtLegendLayoutItem *layoutItem = 694 QwtLegendLayoutItem *layoutItem = 695 695 new QwtLegendLayoutItem( this, plotItem ); 696 696 d_data->layout->addItem( layoutItem ); … … 741 741 */ 742 742 void QwtPlotLegendItem::drawLegendData( QPainter *painter, 743 const QwtPlotItem *plotItem, const QwtLegendData &data, 743 const QwtPlotItem *plotItem, const QwtLegendData &data, 744 744 const QRectF &rect ) const 745 745 { … … 758 758 QRectF iconRect( r.topLeft(), graphic.defaultSize() ); 759 759 760 iconRect.moveCenter( 760 iconRect.moveCenter( 761 761 QPoint( iconRect.center().x(), rect.center().y() ) ); 762 762 … … 822 822 \param width Width 823 823 */ 824 int QwtPlotLegendItem::heightForWidth( 824 int QwtPlotLegendItem::heightForWidth( 825 825 const QwtLegendData &data, int width ) const 826 826 { … … 842 842 } 843 843 844 /*! 844 /*! 845 845 \return All plot items with an entry on the legend 846 846 \note A plot item might have more than one entry on the legend … … 855 855 \note Usually a plot item has only one entry on the legend 856 856 */ 857 QList< QRect > QwtPlotLegendItem::legendGeometries( 857 QList< QRect > QwtPlotLegendItem::legendGeometries( 858 858 const QwtPlotItem *plotItem ) const 859 859 {
Note:
See TracChangeset
for help on using the changeset viewer.