Changeset 11158 in ntrip for trunk/BNC/qwt/qwt_arrow_button.cpp


Ignore:
Timestamp:
Nov 3, 2026, 10:53:35 AM (3 weeks ago)
Author:
stuerze
Message:

deprecated functions exchanged libs updated

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/qwt/qwt_arrow_button.cpp

    r8127 r11158  
    1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
     1/******************************************************************************
    22 * Qwt Widget Library
    33 * Copyright (C) 1997   Josef Wilgen
    … …  
    99
    1010#include "qwt_arrow_button.h"
    11 #include "qwt_math.h"
     11#include "qwt.h"
     12
    1213#include <qpainter.h>
    1314#include <qstyle.h>
    1415#include <qstyleoption.h>
    1516#include <qevent.h>
    16 #include <qapplication.h>
    1717
    1818static const int MaxNum = 3;
    … …  
    2222class QwtArrowButton::PrivateData
    2323{
    24 public:
     24  public:
    2525    int num;
    2626    Qt::ArrowType arrowType;
    … …  
    3030{
    3131    QStyleOptionButton option;
    32     option.init( btn );
     32    option.initFrom( btn );
    3333    option.features = QStyleOptionButton::None;
    3434    if ( btn->isFlat() )
    … …  
    4949
    5050/*!
    51   \param num Number of arrows
    52   \param arrowType see Qt::ArrowType in the Qt docs.
    53   \param parent Parent widget
    54 */
    55 QwtArrowButton::QwtArrowButton( int num,
    56         Qt::ArrowType arrowType, QWidget *parent ):
    57     QPushButton( parent )
    58 {
    59     d_data = new PrivateData;
    60     d_data->num = qBound( 1, num, MaxNum );
    61     d_data->arrowType = arrowType;
     51   \param num Number of arrows
     52   \param arrowType see Qt::ArrowType in the Qt docs.
     53   \param parent Parent widget
     54 */
     55QwtArrowButton::QwtArrowButton( int num, Qt::ArrowType arrowType, QWidget* parent )
     56    : QPushButton( parent )
     57{
     58    m_data = new PrivateData;
     59    m_data->num = qBound( 1, num, MaxNum );
     60    m_data->arrowType = arrowType;
    6261
    6362    setAutoRepeat( true );
    6463    setAutoDefault( false );
    6564
    66     switch ( d_data->arrowType )
     65    switch ( m_data->arrowType )
    6766    {
    6867        case Qt::LeftArrow:
    … …  
    8079QwtArrowButton::~QwtArrowButton()
    8180{
    82     delete d_data;
    83     d_data = NULL;
    84 }
    85 
    86 /*!
    87   \brief The direction of the arrows
    88 */
     81    delete m_data;
     82    m_data = NULL;
     83}
     84
     85/*!
     86   \brief The direction of the arrows
     87 */
    8988Qt::ArrowType QwtArrowButton::arrowType() const
    9089{
    91     return d_data->arrowType;
    92 }
    93 
    94 /*!
    95   \brief The number of arrows
    96 */
     90    return m_data->arrowType;
     91}
     92
     93/*!
     94   \brief The number of arrows
     95 */
    9796int QwtArrowButton::num() const
    9897{
    99     return d_data->num;
    100 }
    101 
    102 /*!
    103   \return the bounding rectangle for the label
    104 */
     98    return m_data->num;
     99}
     100
     101/*!
     102   \return the bounding rectangle for the label
     103 */
    105104QRect QwtArrowButton::labelRect() const
    106105{
    … …  
    128127   Paint event handler
    129128   \param event Paint event
    130 */
    131 void QwtArrowButton::paintEvent( QPaintEvent *event )
     129 */
     130void QwtArrowButton::paintEvent( QPaintEvent* event )
    132131{
    133132    QPushButton::paintEvent( event );
    … …  
    137136
    138137/*!
    139   \brief Draw the button label
    140 
    141   \param painter Painter
    142   \sa The Qt Manual for QPushButton
    143 */
    144 void QwtArrowButton::drawButtonLabel( QPainter *painter )
    145 {
    146     const bool isVertical = d_data->arrowType == Qt::UpArrow ||
    147         d_data->arrowType == Qt::DownArrow;
     138   \brief Draw the button label
     139
     140   \param painter Painter
     141   \sa The Qt Manual for QPushButton
     142 */
     143void QwtArrowButton::drawButtonLabel( QPainter* painter )
     144{
     145    const bool isVertical = m_data->arrowType == Qt::UpArrow ||
     146        m_data->arrowType == Qt::DownArrow;
    148147
    149148    const QRect r = labelRect();
    … …  
    162161
    163162    QRect contentsSize; // aligned rect where to paint all arrows
    164     if ( d_data->arrowType == Qt::LeftArrow || d_data->arrowType == Qt::RightArrow )
    165     {
    166         contentsSize.setWidth( d_data->num * arrow.width()
    167             + ( d_data->num - 1 ) * Spacing );
     163    if ( m_data->arrowType == Qt::LeftArrow || m_data->arrowType == Qt::RightArrow )
     164    {
     165        contentsSize.setWidth( m_data->num * arrow.width()
     166            + ( m_data->num - 1 ) * Spacing );
    168167        contentsSize.setHeight( arrow.height() );
    169168    }
    … …  
    171170    {
    172171        contentsSize.setWidth( arrow.width() );
    173         contentsSize.setHeight( d_data->num * arrow.height()
    174             + ( d_data->num - 1 ) * Spacing );
     172        contentsSize.setHeight( m_data->num * arrow.height()
     173            + ( m_data->num - 1 ) * Spacing );
    175174    }
    176175
    … …  
    180179
    181180    painter->save();
    182     for ( int i = 0; i < d_data->num; i++ )
    183     {
    184         drawArrow( painter, arrowRect, d_data->arrowType );
     181    for ( int i = 0; i < m_data->num; i++ )
     182    {
     183        drawArrow( painter, arrowRect, m_data->arrowType );
    185184
    186185        int dx = 0;
    … …  
    199198    {
    200199        QStyleOptionFocusRect option;
    201         option.init( this );
     200        option.initFrom( this );
    202201        option.backgroundColor = palette().color( QPalette::Window );
    203202
    … …  
    213212    \param r Rectangle where to paint the arrow
    214213    \param arrowType Arrow type
    215 */
    216 void QwtArrowButton::drawArrow( QPainter *painter,
    217     const QRect &r, Qt::ArrowType arrowType ) const
     214 */
     215void QwtArrowButton::drawArrow( QPainter* painter,
     216    const QRect& r, Qt::ArrowType arrowType ) const
    218217{
    219218    QPolygon pa( 3 );
    … …  
    256255
    257256/*!
    258   \return a size hint
    259 */
     257   \return a size hint
     258 */
    260259QSize QwtArrowButton::sizeHint() const
    261260{
    262261    const QSize hint = minimumSizeHint();
    263     return hint.expandedTo( QApplication::globalStrut() );
    264 }
    265 
    266 /*!
    267   \brief Return a minimum size hint
    268 */
     262    return qwtExpandedToGlobalStrut( hint );
     263}
     264
     265/*!
     266   \brief Return a minimum size hint
     267 */
    269268QSize QwtArrowButton::minimumSizeHint() const
    270269{
    … …  
    274273        2 * Margin + ( MaxNum - 1 ) * Spacing + MaxNum * asz.width(),
    275274        2 * Margin + asz.height()
    276     );
    277 
    278     if ( d_data->arrowType == Qt::UpArrow || d_data->arrowType == Qt::DownArrow )
     275        );
     276
     277    if ( m_data->arrowType == Qt::UpArrow || m_data->arrowType == Qt::DownArrow )
    279278        sz.transpose();
    280279
    281280    QStyleOption styleOption;
    282     styleOption.init( this );
     281    styleOption.initFrom( this );
    283282
    284283    sz = style()->sizeFromContents( QStyle::CT_PushButton,
    … …  
    294293   \param boundingSize Bounding size
    295294   \return Size of the arrow
    296 */
     295 */
    297296QSize QwtArrowButton::arrowSize( Qt::ArrowType arrowType,
    298     const QSize &boundingSize ) const
     297    const QSize& boundingSize ) const
    299298{
    300299    QSize bs = boundingSize;
    … …  
    323322
    324323/*!
    325   \brief autoRepeat for the space keys
    326 */
    327 void QwtArrowButton::keyPressEvent( QKeyEvent *event )
     324   \brief autoRepeat for the space keys
     325 */
     326void QwtArrowButton::keyPressEvent( QKeyEvent* event )
    328327{
    329328    if ( event->isAutoRepeat() && event->key() == Qt::Key_Space )
Note: See TracChangeset for help on using the changeset viewer.