Commit e580988a authored by Alexander Wiebel's avatar Alexander Wiebel
Browse files

[FIX #483] change called function to avoid deprecation warning

parent 4f98817d
......@@ -90,8 +90,8 @@ void WTransferFunctionPoint::paint( QPainter *painter, const QStyleOptionGraphic
if( option->state & QStyle::State_Sunken )
{
gradient.setColorAt( 0, QColor( Qt::yellow ).light( 120 ) );
gradient.setColorAt( 1, QColor( Qt::darkYellow ).light( 120 ) );
gradient.setColorAt( 0, QColor( Qt::yellow ).lighter( 120 ) );
gradient.setColorAt( 1, QColor( Qt::darkYellow ).lighter( 120 ) );
painter->setPen( QPen( Qt::red, 0 ) );
}
else
......
......@@ -64,7 +64,7 @@ WScaleLabel::WScaleLabel( const QString &text, QWidget* parent ):
void WScaleLabel::construct()
{
setMinimumWidth( fontMetrics().width( m_orgText.left( m_minLength ) + tr( "..." ) ) + m_additionalWidth );
setMinimumWidth( fontMetrics().horizontalAdvance( m_orgText.left( m_minLength ) + tr( "..." ) ) + m_additionalWidth );
setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Maximum );
setMargin( WGLOBAL_MARGIN );
setTextInteractionFlags( Qt::TextSelectableByMouse );
......@@ -87,13 +87,13 @@ QSize WScaleLabel::minimumSizeHint() const
size_t WScaleLabel::calculateSize( size_t chars ) const
{
return fontMetrics().width( m_orgText.left( chars ) + tr( "..." ) ) + 2 * margin() + m_additionalWidth;
return fontMetrics().horizontalAdvance( m_orgText.left( chars ) + tr( "..." ) ) + 2 * margin() + m_additionalWidth;
}
void WScaleLabel::setText( const QString &text )
{
m_orgText = text;
setMinimumWidth( fontMetrics().width( m_orgText.left( m_minLength ) + tr( "..." ) ) + 2 * margin() + m_additionalWidth );
setMinimumWidth( fontMetrics().horizontalAdvance( m_orgText.left( m_minLength ) + tr( "..." ) ) + 2 * margin() + m_additionalWidth );
fitTextToSize();
}
......
......@@ -29,7 +29,7 @@ WScaleToolButton::WScaleToolButton( size_t length, QWidget *parent /*= NULL */ )
m_additionalWidth( 0 ),
m_minLength( length )
{
setMinimumWidth( fontMetrics().width( m_orgText.left( m_minLength ) + tr( ".." ) ) + m_additionalWidth );
setMinimumWidth( fontMetrics().horizontalAdvance( m_orgText.left( m_minLength ) + tr( ".." ) ) + m_additionalWidth );
setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Maximum );
}
......@@ -40,7 +40,7 @@ WScaleToolButton::WScaleToolButton( const QString &text, size_t length, QWidget
m_minLength( length )
{
setText( text );
setMinimumWidth( fontMetrics().width( m_orgText.left( m_minLength ) + tr( ".." ) ) + m_additionalWidth );
setMinimumWidth( fontMetrics().horizontalAdvance( m_orgText.left( m_minLength ) + tr( ".." ) ) + m_additionalWidth );
setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Maximum );
}
......@@ -51,20 +51,20 @@ void WScaleToolButton::resizeEvent( QResizeEvent* /*event*/ )
QSize WScaleToolButton::sizeHint() const
{
return QSize( fontMetrics().width( m_orgText ) + m_additionalWidth,
return QSize( fontMetrics().horizontalAdvance( m_orgText ) + m_additionalWidth,
QToolButton::sizeHint().height() );
}
QSize WScaleToolButton::minimumSizeHint() const
{
return QSize( fontMetrics().width( m_orgText.left( m_minLength ) + tr( ".." ) ) + m_additionalWidth,
return QSize( fontMetrics().horizontalAdvance( m_orgText.left( m_minLength ) + tr( ".." ) ) + m_additionalWidth,
QToolButton::minimumSizeHint().height() );
}
void WScaleToolButton::setText( const QString &text )
{
m_orgText = text;
setMinimumWidth( fontMetrics().width( m_orgText.left( m_minLength ) + tr( ".." ) ) + m_additionalWidth );
setMinimumWidth( fontMetrics().horizontalAdvance( m_orgText.left( m_minLength ) + tr( ".." ) ) + m_additionalWidth );
fitTextToSize();
}
......@@ -72,10 +72,10 @@ void WScaleToolButton::fitTextToSize()
{
int newwidth = width();
QFontMetrics fn = fontMetrics();
if( newwidth < fn.width( m_orgText ) )
if( newwidth < fn.horizontalAdvance( m_orgText ) )
{
QString useText = m_orgText.left( m_orgText.length() - 1 );
while( fn.width( useText + tr( ".." ) ) > newwidth || useText.length() == 0 )
while( fn.horizontalAdvance( useText + tr( ".." ) ) > newwidth || useText.length() == 0 )
{
useText = useText.left( useText.length() - 1 );
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment