widgets: use const methods more

to avoid implicit detach

Change-Id: I44b2924decd3c650ece377784f4a73b4e5bbd6c6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
bb10
Anton Kudryavtsev 2023-09-07 17:44:17 +03:00
parent e312fbc990
commit d6bd73a343
2 changed files with 3 additions and 3 deletions

View File

@ -101,7 +101,7 @@ static QFontDatabase::WritingSystem writingSystemFromLocale()
static QFontDatabase::WritingSystem writingSystemForFont(const QFont &font, bool *hasLatin)
{
QList<QFontDatabase::WritingSystem> writingSystems = QFontDatabase::writingSystems(font.families().first());
QList<QFontDatabase::WritingSystem> writingSystems = QFontDatabase::writingSystems(font.families().constFirst());
// qDebug() << font.families().first() << writingSystems;
// this just confuses the algorithm below. Vietnamese is Latin with lots of special chars
@ -352,7 +352,7 @@ void QFontComboBoxPrivate::_q_updateModel()
void QFontComboBoxPrivate::_q_currentChanged(const QString &text)
{
Q_Q(QFontComboBox);
QStringList families = currentFont.families();
const QStringList families = currentFont.families();
if (families.isEmpty() || families.first() != text) {
currentFont.setFamilies(QStringList{text});
emit q->currentFontChanged(currentFont);

View File

@ -344,7 +344,7 @@ void QKeySequenceEdit::keyPressEvent(QKeyEvent *e)
return;
if (e->modifiers() & Qt::ShiftModifier) {
QList<int> possibleKeys = QKeyMapper::possibleKeys(e);
const QList<int> possibleKeys = QKeyMapper::possibleKeys(e);
int pkTotal = possibleKeys.size();
if (!pkTotal)
return;