Skip to content

Commit

Permalink
avoid Qt 6.6 deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
uwerat committed Oct 5, 2023
1 parent 067cffb commit eff3641
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
12 changes: 10 additions & 2 deletions src/inputpanel/QskInputContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,14 @@ static void qskInputContextHook()

Q_COREAPP_STARTUP_FUNCTION( qskInputContextHook )

#if QT_VERSION >= QT_VERSION_CHECK( 6, 2, 0 )
static inline QLocale::Territory qskTerritory( const QLocale& locale )
{ return locale.territory(); }
#else
static inline QLocale::Country qskTerritory( const QLocale& locale )
{ return locale.country(); }
#endif

void QskInputContext::setInstance( QskInputContext* inputContext )
{
if ( inputContext != qskInputContext )
Expand Down Expand Up @@ -527,10 +535,10 @@ std::shared_ptr< QskTextPredictor > QskInputContextFactory::setupPredictor( cons
{
if( !m_data->predictor
|| m_data->predictorLocale.language() != locale.language()
|| m_data->predictorLocale.country() != locale.country() )
|| qskTerritory( m_data->predictorLocale ) != qskTerritory( locale ) )
{
m_data->predictor = std::shared_ptr< QskTextPredictor >( createPredictor( locale ) );
m_data->predictorLocale = QLocale( locale.language(), locale.country() );
m_data->predictorLocale = QLocale( locale.language(), qskTerritory( locale ) );

if( m_data->predictor )
{
Expand Down
9 changes: 8 additions & 1 deletion src/inputpanel/QskVirtualKeyboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,14 @@ void QskVirtualKeyboard::updateLocale( const QLocale& locale )

case QLocale::English:
{
switch ( locale.country() )
const auto territory =
#if QT_VERSION >= QT_VERSION_CHECK( 6, 2, 0 )
locale.territory();
#else
locale.country();
#endif

switch ( territory )
{
case QLocale::Canada:
case QLocale::UnitedStates:
Expand Down

0 comments on commit eff3641

Please sign in to comment.