Skip to content

Commit dd4caea

Browse files
committed
COMP: Update ctkPythonConsole to remove use of deprecated QString API
Fixes the following warning: ``` /path/to/CTK/Libs/Scripting/Python/Widgets/ctkPythonConsole.cpp: In member function ‘virtual void ctkPythonConsoleCompleter::updateCompletionModel(const QString&)’: /path/to/CTK/Libs/Scripting/Python/Widgets/ctkPythonConsole.cpp:459:56: warning: ‘qsizetype QString::count() const’ is deprecated: Use size() or length() instead. [-Wdeprecated-declarations] 459 | if (dotCount == 0 || completion.at(completion.count() - 1) == '.') | ~~~~~~~~~~~~~~~~^~ ```
1 parent 1b54d60 commit dd4caea

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Libs/Scripting/Python/Widgets/ctkPythonConsole.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,11 @@ void ctkPythonConsoleCompleter::updateCompletionModel(const QString& completion)
456456
// choices matches one of the preference list, it will be selected.
457457
QModelIndex preferredIndex = this->completionModel()->index(0, 0);
458458
int dotCount = completion.count('.');
459+
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
460+
if (dotCount == 0 || completion.at(completion.size() - 1) == '.')
461+
#else
459462
if (dotCount == 0 || completion.at(completion.count() - 1) == '.')
463+
#endif
460464
{
461465
foreach(const QString& pref, this->AutocompletePreferenceList)
462466
{

0 commit comments

Comments
 (0)