Changeset 11158 in ntrip for trunk/BNC/qwt/qwt_legend_data.cpp
- Timestamp:
- Nov 3, 2026, 10:53:35 AM (3 weeks ago)
- File:
-
- 1 edited
-
trunk/BNC/qwt/qwt_legend_data.cpp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/qwt/qwt_legend_data.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_legend_data.h" 11 #include "qwt_text.h" 12 #include "qwt_graphic.h" 11 13 12 14 //! Constructor … … 21 23 22 24 /*! 23 Set the legend attributes 25 Set the legend attributes 24 26 25 QwtLegendData actually is a QMap<int, QVariant> with some 26 convenience interfaces 27 QwtLegendData actually is a QMap<int, QVariant> with some 28 convenience interfaces 27 29 28 \param map Values 29 \sa values() 30 \param map Values 31 \sa values() 30 32 */ 31 void QwtLegendData::setValues( const QMap<int, QVariant > &map )33 void QwtLegendData::setValues( const QMap< int, QVariant >& map ) 32 34 { 33 d_map = map;35 m_map = map; 34 36 } 35 37 36 38 /*! 37 \return Legend attributes 38 \sa setValues() 39 \return Legend attributes 40 \sa setValues() 39 41 */ 40 const QMap<int, QVariant > &QwtLegendData::values() const42 const QMap< int, QVariant >& QwtLegendData::values() const 41 43 { 42 return d_map;44 return m_map; 43 45 } 44 46 45 47 /*! 46 \param role Attribute role 47 \return True, when the internal map has an entry for role 48 \param role Attribute role 49 \return True, when the internal map has an entry for role 48 50 */ 49 51 bool QwtLegendData::hasRole( int role ) const 50 52 { 51 return d_map.contains( role );53 return m_map.contains( role ); 52 54 } 53 55 54 56 /*! 55 Set an attribute value 57 Set an attribute value 56 58 57 \param role Attribute role 58 \param data Attribute value 59 \param role Attribute role 60 \param data Attribute value 59 61 60 \sa value() 62 \sa value() 61 63 */ 62 void QwtLegendData::setValue( int role, const QVariant &data )64 void QwtLegendData::setValue( int role, const QVariant& data ) 63 65 { 64 d_map[role] = data;66 m_map[role] = data; 65 67 } 66 68 67 69 /*! 68 \param role Attribute role 69 \return Attribute value for a specific role 70 \param role Attribute role 71 \return Attribute value for a specific role 70 72 */ 71 73 QVariant QwtLegendData::value( int role ) const 72 74 { 73 if ( ! d_map.contains( role ) )75 if ( !m_map.contains( role ) ) 74 76 return QVariant(); 75 77 76 return d_map[role];78 return m_map[role]; 77 79 } 78 80 … … 80 82 bool QwtLegendData::isValid() const 81 83 { 82 return ! d_map.isEmpty();84 return !m_map.isEmpty(); 83 85 } 84 86 … … 89 91 90 92 const QVariant titleValue = value( QwtLegendData::TitleRole ); 91 if ( titleValue.canConvert< QwtText>() )93 if ( titleValue.canConvert< QwtText >() ) 92 94 { 93 text = qvariant_cast< QwtText>( titleValue );95 text = qvariant_cast< QwtText >( titleValue ); 94 96 } 95 else if ( titleValue.canConvert< QString>() )97 else if ( titleValue.canConvert< QString >() ) 96 98 { 97 text.setText( qvariant_cast< QString>( titleValue ) );99 text.setText( qvariant_cast< QString >( titleValue ) ); 98 100 } 99 101 … … 107 109 108 110 QwtGraphic graphic; 109 if ( iconValue.canConvert<QwtGraphic>() ) 111 if ( iconValue.canConvert< QwtGraphic >() ) 110 112 { 111 graphic = qvariant_cast<QwtGraphic>( iconValue ); 113 graphic = qvariant_cast< QwtGraphic >( iconValue ); 112 114 } 113 115 … … 119 121 { 120 122 const QVariant modeValue = value( QwtLegendData::ModeRole ); 121 if ( modeValue.canConvert< int>() )123 if ( modeValue.canConvert< int >() ) 122 124 { 123 const int mode = qvariant_cast< int>( modeValue );124 return static_cast<QwtLegendData::Mode>( mode ); 125 const int mode = qvariant_cast< int >( modeValue ); 126 return static_cast< QwtLegendData::Mode >( mode ); 125 127 } 126 128
Note:
See TracChangeset
for help on using the changeset viewer.
