Examples: replace deprecated QComboBox functions
Replace the deprecated currentIndexChanged(QString) and activated(QString) with the new currentTextChanged() and textActivated() functions Change-Id: I8616354fa06cc63dce6f5cfef0902f4b55981043 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
parent
332f295743
commit
d8ac4b40b5
@ -473,7 +473,7 @@ void MainWindow::createToolbars()
|
||||
fontSizeCombo->addItem(QString().setNum(i));
|
||||
QIntValidator *validator = new QIntValidator(2, 64, this);
|
||||
fontSizeCombo->setValidator(validator);
|
||||
connect(fontSizeCombo, QOverload<const QString &>::of(&QComboBox::currentIndexChanged),
|
||||
connect(fontSizeCombo, &QComboBox::currentTextChanged,
|
||||
this, &MainWindow::fontSizeChanged);
|
||||
|
||||
fontColorToolButton = new QToolButton;
|
||||
@ -536,7 +536,7 @@ void MainWindow::createToolbars()
|
||||
scales << tr("50%") << tr("75%") << tr("100%") << tr("125%") << tr("150%");
|
||||
sceneScaleCombo->addItems(scales);
|
||||
sceneScaleCombo->setCurrentIndex(2);
|
||||
connect(sceneScaleCombo, QOverload<const QString &>::of(&QComboBox::currentIndexChanged),
|
||||
connect(sceneScaleCombo, &QComboBox::currentTextChanged,
|
||||
this, &MainWindow::sceneScaleChanged);
|
||||
|
||||
pointerToolbar = addToolBar(tr("Pointer type"));
|
||||
|
@ -73,7 +73,7 @@ EmbeddedDialog::EmbeddedDialog(QWidget *parent)
|
||||
this, &EmbeddedDialog::spacingChanged);
|
||||
connect(ui->fontComboBox, &QFontComboBox::currentFontChanged,
|
||||
this, &EmbeddedDialog::fontChanged);
|
||||
connect(ui->style, QOverload<const QString &>::of(&QComboBox::activated),
|
||||
connect(ui->style, &QComboBox::textActivated,
|
||||
this, &EmbeddedDialog::styleChanged);
|
||||
}
|
||||
|
||||
|
@ -369,7 +369,7 @@ void TextEdit::setupTextActions()
|
||||
|
||||
comboFont = new QFontComboBox(tb);
|
||||
tb->addWidget(comboFont);
|
||||
connect(comboFont, QOverload<const QString &>::of(&QComboBox::activated), this, &TextEdit::textFamily);
|
||||
connect(comboFont, &QComboBox::textActivated, this, &TextEdit::textFamily);
|
||||
|
||||
comboSize = new QComboBox(tb);
|
||||
comboSize->setObjectName("comboSize");
|
||||
@ -381,7 +381,7 @@ void TextEdit::setupTextActions()
|
||||
comboSize->addItem(QString::number(size));
|
||||
comboSize->setCurrentIndex(standardSizes.indexOf(QApplication::font().pointSize()));
|
||||
|
||||
connect(comboSize, QOverload<const QString &>::of(&QComboBox::activated), this, &TextEdit::textSize);
|
||||
connect(comboSize, &QComboBox::textActivated, this, &TextEdit::textSize);
|
||||
}
|
||||
|
||||
bool TextEdit::load(const QString &f)
|
||||
|
@ -114,9 +114,9 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
this, &MainWindow::findSizes);
|
||||
connect(fontCombo, &QFontComboBox::currentFontChanged,
|
||||
characterWidget, &CharacterWidget::updateFont);
|
||||
connect(sizeCombo, QOverload<const QString &>::of(&QComboBox::currentIndexChanged),
|
||||
connect(sizeCombo, &QComboBox::currentTextChanged,
|
||||
characterWidget, &CharacterWidget::updateSize);
|
||||
connect(styleCombo, QOverload<const QString &>::of(&QComboBox::currentIndexChanged),
|
||||
connect(styleCombo, &QComboBox::currentTextChanged,
|
||||
characterWidget, &CharacterWidget::updateStyle);
|
||||
//! [4] //! [5]
|
||||
connect(characterWidget, &CharacterWidget::characterSelected,
|
||||
|
@ -176,7 +176,7 @@ void Window::createDateTimeEdits()
|
||||
formatComboBox->addItem("hh:mm ap");
|
||||
//! [9] //! [10]
|
||||
|
||||
connect(formatComboBox, QOverload<const QString &>::of(&QComboBox::activated),
|
||||
connect(formatComboBox, &QComboBox::textActivated,
|
||||
this, &Window::setFormatString);
|
||||
//! [10]
|
||||
|
||||
|
@ -79,7 +79,7 @@ WidgetGallery::WidgetGallery(QWidget *parent)
|
||||
//! [0]
|
||||
|
||||
//! [1]
|
||||
connect(styleComboBox, QOverload<const QString &>::of(&QComboBox::activated),
|
||||
connect(styleComboBox, &QComboBox::textActivated,
|
||||
//! [1] //! [2]
|
||||
this, &WidgetGallery::changeStyle);
|
||||
connect(useStylePaletteCheckBox, &QCheckBox::toggled,
|
||||
|
Loading…
Reference in New Issue
Block a user