avoid Qt 6.6 deprecation warnings

This commit is contained in:
Uwe Rathmann 2023-10-05 09:23:45 +02:00
parent 067cffbd7c
commit eff3641c4c
2 changed files with 18 additions and 3 deletions

View File

@ -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 )
@ -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 )
{

View File

@ -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: