Skip to content

Commit

Permalink
Use QColor::isValidColorName
Browse files Browse the repository at this point in the history
QColor::isValidColor is deprecated in Qt 6.6, QColor::isValidColorName was introduced in 6.4
  • Loading branch information
magnesj committed Oct 7, 2024
1 parent cc274d6 commit 0141340
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions ApplicationLibCode/FileInterface/RifColorLegendData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ cvf::ref<RigFormationNames> RifColorLegendData::readLyrFormationNameFile( const
// extract last word which may contain formation color
QString colorWord = RiaTextStringTools::splitSkipEmptyParts( numberString ).last();

if ( QColor::isValidColor( colorWord ) ) numberString.remove( colorWord ); // remove color if present as last word on line
if ( QColor::isValidColorName( colorWord ) ) numberString.remove( colorWord ); // remove color if present as last word on line

// extract words containing formation number(s)
QStringList numberWords = RiaTextStringTools::splitSkipEmptyParts( numberString, QRegExp( "-" ) );
Expand All @@ -110,7 +110,7 @@ cvf::ref<RigFormationNames> RifColorLegendData::readLyrFormationNameFile( const
startK = tmp < endK ? tmp : endK;
endK = tmp > endK ? tmp : endK;

if ( QColor::isValidColor( colorWord ) ) // formation color present at end of line
if ( QColor::isValidColorName( colorWord ) ) // formation color present at end of line
{
cvf::Color3f formationColor;

Expand All @@ -133,7 +133,7 @@ cvf::ref<RigFormationNames> RifColorLegendData::readLyrFormationNameFile( const
continue;
}

if ( QColor::isValidColor( colorWord ) ) // formation color present at end of line
if ( QColor::isValidColorName( colorWord ) ) // formation color present at end of line
{
cvf::Color3f formationColor;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ std::unique_ptr<QIcon> IconProvider::icon( const QSize& size ) const
bool validIcon = false;
if ( !m_backgroundColorStrings.empty() )
{
if ( m_backgroundColorStrings.size() == 1u && QColor::isValidColor( m_backgroundColorStrings.front() ) )
if ( m_backgroundColorStrings.size() == 1u && QColor::isValidColorName( m_backgroundColorStrings.front() ) )
{
pixmap.fill( QColor( m_backgroundColorStrings.front() ) );
validIcon = true;
Expand All @@ -176,7 +176,7 @@ std::unique_ptr<QIcon> IconProvider::icon( const QSize& size ) const
QLinearGradient gradient( QPointF( 0.0f, 0.0f ), QPoint( size.width(), 0.0f ) );
for ( size_t i = 0; i < m_backgroundColorStrings.size(); ++i )
{
if ( !QColor::isValidColor( m_backgroundColorStrings[i] ) )
if ( !QColor::isValidColorName( m_backgroundColorStrings[i] ) )
{
validIcon = false;
break;
Expand Down Expand Up @@ -303,7 +303,7 @@ bool IconProvider::backgroundColorsAreValid() const
bool validBackgroundColors = true;
for ( QString colorName : m_backgroundColorStrings )
{
if ( !QColor::isValidColor( colorName ) )
if ( !QColor::isValidColorName( colorName ) )
{
validBackgroundColors = false;
break;
Expand Down

0 comments on commit 0141340

Please sign in to comment.