forked from qt-creator/qt-creator
Replace manual signal blocking/unblocking with QSignalBlocker
Change-Id: Ibb59fab4e37d045e506c5a8172b6f5cbb955b028 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -493,9 +493,8 @@ void ContextPaneWidget::setPinButton()
|
||||
|
||||
pinnedChanged(true);
|
||||
if (m_resetAction) {
|
||||
m_resetAction->blockSignals(true);
|
||||
QSignalBlocker blocker(m_resetAction);
|
||||
m_resetAction->setChecked(true);
|
||||
m_resetAction->blockSignals(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -511,9 +510,8 @@ void ContextPaneWidget::setLineButton()
|
||||
|
||||
pinnedChanged(false);
|
||||
if (m_resetAction) {
|
||||
m_resetAction->blockSignals(true);
|
||||
QSignalBlocker blocker(m_resetAction);
|
||||
m_resetAction->setChecked(false);
|
||||
m_resetAction->blockSignals(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -478,14 +478,13 @@ void FancyLineEdit::validate()
|
||||
if (validHasChanged)
|
||||
emit validChanged(newState == Valid);
|
||||
}
|
||||
bool block = blockSignals(true);
|
||||
const QString fixedString = fixInputString(t);
|
||||
if (t != fixedString) {
|
||||
const int cursorPos = cursorPosition();
|
||||
QSignalBlocker blocker(this);
|
||||
setText(fixedString);
|
||||
setCursorPosition(qMin(cursorPos, fixedString.length()));
|
||||
}
|
||||
blockSignals(block);
|
||||
|
||||
// Check buttons.
|
||||
if (d->m_oldText.isEmpty() || t.isEmpty()) {
|
||||
|
@@ -217,12 +217,11 @@ void DefaultGdbServerProviderConfigWidget::setFromProvider()
|
||||
const auto p = static_cast<DefaultGdbServerProvider *>(provider());
|
||||
Q_ASSERT(p);
|
||||
|
||||
const auto b = blockSignals(true);
|
||||
QSignalBlocker blocker(this);
|
||||
m_hostWidget->setHost(p->m_host);
|
||||
m_hostWidget->setPort(p->m_port);
|
||||
m_initCommandsTextEdit->setPlainText(p->initCommands());
|
||||
m_resetCommandsTextEdit->setPlainText(p->resetCommands());
|
||||
blockSignals(b);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -355,10 +355,9 @@ void GdbServerProviderConfigWidget::clearErrorMessage()
|
||||
|
||||
void GdbServerProviderConfigWidget::setFromProvider()
|
||||
{
|
||||
const bool b = blockSignals(true);
|
||||
QSignalBlocker blocker(this);
|
||||
m_nameLineEdit->setText(m_provider->displayName());
|
||||
setStartupMode(m_provider->startupMode());
|
||||
blockSignals(b);
|
||||
}
|
||||
|
||||
QString GdbServerProviderConfigWidget::defaultInitCommandsTooltip()
|
||||
@@ -398,9 +397,8 @@ HostWidget::HostWidget(QWidget *parent)
|
||||
|
||||
void HostWidget::setHost(const QString &host)
|
||||
{
|
||||
const bool b = blockSignals(true);
|
||||
QSignalBlocker blocker(this);
|
||||
m_hostLineEdit->setText(host);
|
||||
blockSignals(b);
|
||||
}
|
||||
|
||||
QString HostWidget::host() const
|
||||
@@ -410,9 +408,8 @@ QString HostWidget::host() const
|
||||
|
||||
void HostWidget::setPort(const quint16 &port)
|
||||
{
|
||||
const bool b = blockSignals(true);
|
||||
QSignalBlocker blocker(this);
|
||||
m_portSpinBox->setValue(port);
|
||||
blockSignals(b);
|
||||
}
|
||||
|
||||
quint16 HostWidget::port() const
|
||||
|
@@ -101,7 +101,7 @@ QString GdbServerProviderChooser::providerText(const GdbServerProvider *provider
|
||||
|
||||
void GdbServerProviderChooser::populate()
|
||||
{
|
||||
const bool b = m_chooser->blockSignals(true);
|
||||
QSignalBlocker blocker(m_chooser);
|
||||
m_chooser->clear();
|
||||
m_chooser->addItem(tr("None"));
|
||||
|
||||
@@ -110,7 +110,6 @@ void GdbServerProviderChooser::populate()
|
||||
continue;
|
||||
m_chooser->addItem(providerText(p), qVariantFromValue(p->id()));
|
||||
}
|
||||
m_chooser->blockSignals(b);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -350,7 +350,7 @@ void OpenOcdGdbServerProviderConfigWidget::setFromProvider()
|
||||
const auto p = static_cast<OpenOcdGdbServerProvider *>(provider());
|
||||
Q_ASSERT(p);
|
||||
|
||||
const bool b = blockSignals(true);
|
||||
QSignalBlocker blocker(this);
|
||||
startupModeChanged();
|
||||
m_hostWidget->setHost(p->m_host);
|
||||
m_hostWidget->setPort(p->m_port);
|
||||
@@ -360,7 +360,6 @@ void OpenOcdGdbServerProviderConfigWidget::setFromProvider()
|
||||
m_additionalArgumentsLineEdit->setText(p->m_additionalArguments);
|
||||
m_initCommandsTextEdit->setPlainText(p->initCommands());
|
||||
m_resetCommandsTextEdit->setPlainText(p->resetCommands());
|
||||
blockSignals(b);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -391,7 +391,7 @@ void StLinkUtilGdbServerProviderConfigWidget::setFromProvider()
|
||||
const auto p = static_cast<StLinkUtilGdbServerProvider *>(provider());
|
||||
Q_ASSERT(p);
|
||||
|
||||
const bool b = blockSignals(true);
|
||||
QSignalBlocker blocker(this);
|
||||
startupModeChanged();
|
||||
m_hostWidget->setHost(p->m_host);
|
||||
m_hostWidget->setPort(p->m_port);
|
||||
@@ -402,7 +402,6 @@ void StLinkUtilGdbServerProviderConfigWidget::setFromProvider()
|
||||
setTransportLayer(p->m_transport);
|
||||
m_initCommandsTextEdit->setPlainText(p->initCommands());
|
||||
m_resetCommandsTextEdit->setPlainText(p->resetCommands());
|
||||
blockSignals(b);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -105,7 +105,7 @@ void ConfigurationPanel::edit()
|
||||
|
||||
void ConfigurationPanel::populateConfigurations(const QString &key)
|
||||
{
|
||||
const bool block = ui->configurations->blockSignals(true);
|
||||
QSignalBlocker blocker(ui->configurations);
|
||||
const QString currentText = (!key.isEmpty()) ? key : ui->configurations->currentText();
|
||||
ui->configurations->clear();
|
||||
ui->configurations->addItems(m_settings->styles());
|
||||
@@ -113,7 +113,6 @@ void ConfigurationPanel::populateConfigurations(const QString &key)
|
||||
if (textIndex != -1)
|
||||
ui->configurations->setCurrentIndex(textIndex);
|
||||
updateButtons();
|
||||
ui->configurations->blockSignals(block);
|
||||
}
|
||||
|
||||
void ConfigurationPanel::updateButtons()
|
||||
|
@@ -507,7 +507,8 @@ QString CMakeBuildStepConfigWidget::displayName() const
|
||||
|
||||
void CMakeBuildStepConfigWidget::buildTargetsChanged()
|
||||
{
|
||||
const bool wasBlocked = m_buildTargetsList->blockSignals(true);
|
||||
{
|
||||
QSignalBlocker blocker(m_buildTargetsList);
|
||||
m_buildTargetsList->clear();
|
||||
|
||||
auto pro = static_cast<CMakeProject *>(m_buildStep->project());
|
||||
@@ -536,19 +537,20 @@ void CMakeBuildStepConfigWidget::buildTargetsChanged()
|
||||
if (CMakeBuildStep::specialTargets().contains(title) || title == ADD_RUNCONFIGURATION_TEXT)
|
||||
item->setFont(italics);
|
||||
}
|
||||
m_buildTargetsList->blockSignals(wasBlocked);
|
||||
}
|
||||
updateDetails();
|
||||
}
|
||||
|
||||
void CMakeBuildStepConfigWidget::selectedBuildTargetsChanged()
|
||||
{
|
||||
const bool wasBlocked = m_buildTargetsList->blockSignals(true);
|
||||
{
|
||||
QSignalBlocker blocker(m_buildTargetsList);
|
||||
for (int y = 0; y < m_buildTargetsList->count(); ++y) {
|
||||
QListWidgetItem *item = m_buildTargetsList->item(y);
|
||||
item->setCheckState(m_buildStep->buildsBuildTarget(item->data(Qt::UserRole).toString())
|
||||
? Qt::Checked : Qt::Unchecked);
|
||||
}
|
||||
m_buildTargetsList->blockSignals(wasBlocked);
|
||||
}
|
||||
updateDetails();
|
||||
}
|
||||
|
||||
|
@@ -550,9 +550,10 @@ void ExternalToolConfig::showInfoForItem(const QModelIndex &index)
|
||||
ui->modifiesDocumentCheckbox->setChecked(tool->modifiesCurrentDocument());
|
||||
m_environment = tool->environment();
|
||||
|
||||
bool blocked = ui->inputText->blockSignals(true);
|
||||
{
|
||||
QSignalBlocker blocker(ui->inputText);
|
||||
ui->inputText->setPlainText(tool->input());
|
||||
ui->inputText->blockSignals(blocked);
|
||||
}
|
||||
|
||||
ui->description->setCursorPosition(0);
|
||||
ui->arguments->setCursorPosition(0);
|
||||
|
@@ -301,13 +301,14 @@ void FindPrivate::readSettings()
|
||||
{
|
||||
QSettings *settings = ICore::settings();
|
||||
settings->beginGroup(QLatin1String("Find"));
|
||||
bool block = m_instance->blockSignals(true);
|
||||
{
|
||||
QSignalBlocker blocker(m_instance);
|
||||
Find::setBackward(settings->value(QLatin1String("Backward"), false).toBool());
|
||||
Find::setCaseSensitive(settings->value(QLatin1String("CaseSensitively"), false).toBool());
|
||||
Find::setWholeWord(settings->value(QLatin1String("WholeWords"), false).toBool());
|
||||
Find::setRegularExpression(settings->value(QLatin1String("RegularExpression"), false).toBool());
|
||||
Find::setPreserveCase(settings->value(QLatin1String("PreserveCase"), false).toBool());
|
||||
m_instance->blockSignals(block);
|
||||
}
|
||||
m_findCompletions = settings->value(QLatin1String("FindStrings")).toStringList();
|
||||
m_replaceCompletions = settings->value(QLatin1String("ReplaceStrings")).toStringList();
|
||||
m_findCompletionModel.setStringList(m_findCompletions);
|
||||
|
@@ -637,9 +637,8 @@ void FindToolBar::putSelectionToFindClipboard()
|
||||
void FindToolBar::updateFromFindClipboard()
|
||||
{
|
||||
if (QApplication::clipboard()->supportsFindBuffer()) {
|
||||
const bool blocks = m_ui.findEdit->blockSignals(true);
|
||||
QSignalBlocker blocker(m_ui.findEdit);
|
||||
setFindText(QApplication::clipboard()->text(QClipboard::FindBuffer));
|
||||
m_ui.findEdit->blockSignals(blocks);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -128,9 +128,8 @@ void SideBarWidget::setCurrentItem(const QString &id)
|
||||
if (idx < 0)
|
||||
idx = 0;
|
||||
|
||||
bool blocked = m_comboBox->blockSignals(true);
|
||||
QSignalBlocker blocker(m_comboBox);
|
||||
m_comboBox->setCurrentIndex(idx);
|
||||
m_comboBox->blockSignals(blocked);
|
||||
}
|
||||
|
||||
SideBarItem *item = m_sideBar->item(id);
|
||||
@@ -149,7 +148,7 @@ void SideBarWidget::setCurrentItem(const QString &id)
|
||||
|
||||
void SideBarWidget::updateAvailableItems()
|
||||
{
|
||||
bool blocked = m_comboBox->blockSignals(true);
|
||||
QSignalBlocker blocker(m_comboBox);
|
||||
QString currentTitle = m_comboBox->currentText();
|
||||
m_comboBox->clear();
|
||||
QStringList titleList = m_sideBar->availableItemTitles();
|
||||
@@ -167,7 +166,6 @@ void SideBarWidget::updateAvailableItems()
|
||||
|
||||
m_comboBox->setCurrentIndex(idx);
|
||||
m_splitAction->setEnabled(titleList.count() > 1);
|
||||
m_comboBox->blockSignals(blocked);
|
||||
}
|
||||
|
||||
void SideBarWidget::removeCurrentItem()
|
||||
|
@@ -155,9 +155,10 @@ void CppEditorOutline::setSorted(bool sort)
|
||||
m_proxyModel->sort(0, Qt::AscendingOrder);
|
||||
else
|
||||
m_proxyModel->sort(-1, Qt::AscendingOrder);
|
||||
bool block = m_sortAction->blockSignals(true);
|
||||
{
|
||||
QSignalBlocker blocker(m_sortAction);
|
||||
m_sortAction->setChecked(m_proxyModel->sortColumn() == 0);
|
||||
m_sortAction->blockSignals(block);
|
||||
}
|
||||
updateIndexNow();
|
||||
}
|
||||
}
|
||||
@@ -226,10 +227,9 @@ void CppEditorOutline::updateIndexNow()
|
||||
QModelIndex comboIndex = modelIndex();
|
||||
|
||||
if (comboIndex.isValid()) {
|
||||
bool blocked = m_combo->blockSignals(true);
|
||||
QSignalBlocker blocker(m_combo);
|
||||
m_combo->setCurrentIndex(m_proxyModel->mapFromSource(comboIndex));
|
||||
updateToolTip();
|
||||
m_combo->blockSignals(blocked);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -645,12 +645,11 @@ public:
|
||||
|
||||
void setThreadBoxContents(const QStringList &list, int index)
|
||||
{
|
||||
const bool state = m_threadBox->blockSignals(true);
|
||||
QSignalBlocker blocker(m_threadBox);
|
||||
m_threadBox->clear();
|
||||
foreach (const QString &item, list)
|
||||
m_threadBox->addItem(item);
|
||||
m_threadBox->setCurrentIndex(index);
|
||||
m_threadBox->blockSignals(state);
|
||||
}
|
||||
|
||||
RunControl *attachToRunningProcess(Kit *kit, DeviceProcessItem process, bool contAfterAttach);
|
||||
|
@@ -339,10 +339,9 @@ void DiffEditorDocument::beginReload()
|
||||
emit aboutToReload();
|
||||
m_state = Reloading;
|
||||
emit changed();
|
||||
const bool blocked = blockSignals(true);
|
||||
QSignalBlocker blocker(this);
|
||||
setDiffFiles(QList<FileData>(), QString());
|
||||
setDescription(QString());
|
||||
blockSignals(blocked);
|
||||
}
|
||||
|
||||
void DiffEditorDocument::endReload(bool success)
|
||||
|
@@ -137,14 +137,15 @@ public:
|
||||
int messageLevel, FakeVimHandler *eventFilter)
|
||||
{
|
||||
if (cursorPos != -1) {
|
||||
m_edit->blockSignals(true);
|
||||
{
|
||||
QSignalBlocker blocker(m_edit);
|
||||
m_label->clear();
|
||||
m_edit->setText(contents);
|
||||
if (anchorPos != -1 && anchorPos != cursorPos)
|
||||
m_edit->setSelection(anchorPos, cursorPos - anchorPos);
|
||||
else
|
||||
m_edit->setCursorPosition(cursorPos);
|
||||
m_edit->blockSignals(false);
|
||||
}
|
||||
setCurrentWidget(m_edit);
|
||||
m_edit->setFocus();
|
||||
} else {
|
||||
|
@@ -223,7 +223,8 @@ void GerritPushDialog::storeTopic()
|
||||
|
||||
void GerritPushDialog::setRemoteBranches(bool includeOld)
|
||||
{
|
||||
bool blocked = m_ui->targetBranchComboBox->blockSignals(true);
|
||||
{
|
||||
QSignalBlocker blocker(m_ui->targetBranchComboBox);
|
||||
m_ui->targetBranchComboBox->clear();
|
||||
|
||||
const QString remoteName = selectedRemoteName();
|
||||
@@ -259,7 +260,7 @@ void GerritPushDialog::setRemoteBranches(bool includeOld)
|
||||
if (excluded)
|
||||
m_ui->targetBranchComboBox->addItem(tr("... Include older branches ..."), 1);
|
||||
setChangeRange();
|
||||
m_ui->targetBranchComboBox->blockSignals(blocked);
|
||||
}
|
||||
validate();
|
||||
}
|
||||
|
||||
|
@@ -232,7 +232,7 @@ void GeneralSettingsPage::updateFontSizeSelector()
|
||||
if (pointSizes.empty())
|
||||
pointSizes = QFontDatabase::standardSizes();
|
||||
|
||||
bool blocked = m_ui->sizeComboBox->blockSignals(true);
|
||||
QSignalBlocker blocker(m_ui->sizeComboBox);
|
||||
m_ui->sizeComboBox->clear();
|
||||
m_ui->sizeComboBox->setCurrentIndex(-1);
|
||||
m_ui->sizeComboBox->setEnabled(!pointSizes.empty());
|
||||
@@ -246,7 +246,6 @@ void GeneralSettingsPage::updateFontSizeSelector()
|
||||
if (closestIndex != -1)
|
||||
m_ui->sizeComboBox->setCurrentIndex(closestIndex);
|
||||
}
|
||||
m_ui->sizeComboBox->blockSignals(blocked);
|
||||
}
|
||||
|
||||
void GeneralSettingsPage::updateFontStyleSelector()
|
||||
@@ -254,7 +253,7 @@ void GeneralSettingsPage::updateFontStyleSelector()
|
||||
const QString &fontStyle = m_fontDatabase.styleString(m_font);
|
||||
const QStringList &styles = m_fontDatabase.styles(m_font.family());
|
||||
|
||||
bool blocked = m_ui->styleComboBox->blockSignals(true);
|
||||
QSignalBlocker blocker(m_ui->styleComboBox);
|
||||
m_ui->styleComboBox->clear();
|
||||
m_ui->styleComboBox->setCurrentIndex(-1);
|
||||
m_ui->styleComboBox->setEnabled(!styles.empty());
|
||||
@@ -276,7 +275,6 @@ void GeneralSettingsPage::updateFontStyleSelector()
|
||||
if (m_ui->styleComboBox->currentIndex() == -1 && normalIndex != -1)
|
||||
m_ui->styleComboBox->setCurrentIndex(normalIndex);
|
||||
}
|
||||
m_ui->styleComboBox->blockSignals(blocked);
|
||||
}
|
||||
|
||||
void GeneralSettingsPage::updateFontFamilySelector()
|
||||
|
@@ -163,18 +163,16 @@ void ExportDialog::resetExportSize()
|
||||
void ExportDialog::setExportWidthBlocked(int width)
|
||||
{
|
||||
if (m_widthSpinBox->value() != width) {
|
||||
const bool blockSignals = m_widthSpinBox->blockSignals(true);
|
||||
QSignalBlocker blocker(m_widthSpinBox);
|
||||
m_widthSpinBox->setValue(width);
|
||||
m_widthSpinBox->blockSignals(blockSignals);
|
||||
}
|
||||
}
|
||||
|
||||
void ExportDialog::setExportHeightBlocked(int height)
|
||||
{
|
||||
if (m_heightSpinBox->value() != height) {
|
||||
const bool blockSignals = m_heightSpinBox->blockSignals(true);
|
||||
QSignalBlocker blocker(m_heightSpinBox);
|
||||
m_heightSpinBox->setValue(height);
|
||||
m_heightSpinBox->blockSignals(blockSignals);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -166,8 +166,9 @@ void IosBuildSettingsWidget::configureSigningUi(bool autoManageSigning)
|
||||
|
||||
void IosBuildSettingsWidget::populateDevelopmentTeams()
|
||||
{
|
||||
{
|
||||
QSignalBlocker blocker(ui->m_signEntityCombo);
|
||||
// Populate Team id's
|
||||
ui->m_signEntityCombo->blockSignals(true);
|
||||
ui->m_signEntityCombo->clear();
|
||||
ui->m_signEntityCombo->addItem(tr("Default"));
|
||||
foreach (auto team, IosConfigurations::developmentTeams()) {
|
||||
@@ -176,7 +177,7 @@ void IosBuildSettingsWidget::populateDevelopmentTeams()
|
||||
ui->m_signEntityCombo->setItemData(index, team->identifier(), IdentifierRole);
|
||||
ui->m_signEntityCombo->setItemData(index, team->details(), Qt::ToolTipRole);
|
||||
}
|
||||
ui->m_signEntityCombo->blockSignals(false);
|
||||
}
|
||||
// Maintain previous selection.
|
||||
setDefaultSigningIdentfier(m_lastTeamSelection);
|
||||
updateWarningText();
|
||||
@@ -184,8 +185,9 @@ void IosBuildSettingsWidget::populateDevelopmentTeams()
|
||||
|
||||
void IosBuildSettingsWidget::populateProvisioningProfiles()
|
||||
{
|
||||
{
|
||||
// Populate Team id's
|
||||
ui->m_signEntityCombo->blockSignals(true);
|
||||
QSignalBlocker blocker(ui->m_signEntityCombo);
|
||||
ui->m_signEntityCombo->clear();
|
||||
ProvisioningProfiles profiles = IosConfigurations::provisioningProfiles();
|
||||
if (profiles.count() > 0) {
|
||||
@@ -198,7 +200,7 @@ void IosBuildSettingsWidget::populateProvisioningProfiles()
|
||||
} else {
|
||||
ui->m_signEntityCombo->addItem(tr("None"));
|
||||
}
|
||||
ui->m_signEntityCombo->blockSignals(false);
|
||||
}
|
||||
// Maintain previous selection.
|
||||
setDefaultSigningIdentfier(m_lastProfileSelection);
|
||||
updateWarningText();
|
||||
|
@@ -153,7 +153,7 @@ AbiWidget::~AbiWidget()
|
||||
|
||||
void AbiWidget::setAbis(const QList<Abi> &abiList, const Abi ¤t)
|
||||
{
|
||||
bool blocked = blockSignals(true);
|
||||
QSignalBlocker blocker(this);
|
||||
d->m_abi->clear();
|
||||
|
||||
Abi defaultAbi = current;
|
||||
@@ -183,8 +183,6 @@ void AbiWidget::setAbis(const QList<Abi> &abiList, const Abi ¤t)
|
||||
setCustomAbi(current);
|
||||
}
|
||||
modeChanged();
|
||||
|
||||
blockSignals(blocked);
|
||||
}
|
||||
|
||||
QList<Abi> AbiWidget::supportedAbis() const
|
||||
@@ -208,14 +206,15 @@ Abi AbiWidget::currentAbi() const
|
||||
|
||||
void AbiWidget::osChanged()
|
||||
{
|
||||
bool blocked = d->m_osFlavorComboBox->blockSignals(true);
|
||||
{
|
||||
QSignalBlocker blocker(d->m_osFlavorComboBox);
|
||||
d->m_osFlavorComboBox->clear();
|
||||
Abi::OS os = static_cast<Abi::OS>(d->m_osComboBox->itemData(d->m_osComboBox->currentIndex()).toInt());
|
||||
QList<Abi::OSFlavor> flavors = Abi::flavorsForOs(os);
|
||||
foreach (Abi::OSFlavor f, flavors)
|
||||
d->m_osFlavorComboBox->addItem(Abi::toString(f), static_cast<int>(f));
|
||||
d->m_osFlavorComboBox->setCurrentIndex(0); // default to generic flavor
|
||||
d->m_osFlavorComboBox->blockSignals(blocked);
|
||||
}
|
||||
customAbiChanged();
|
||||
}
|
||||
|
||||
@@ -248,7 +247,8 @@ void AbiWidget::customAbiChanged()
|
||||
|
||||
void AbiWidget::setCustomAbi(const Abi ¤t)
|
||||
{
|
||||
bool blocked = blockSignals(true);
|
||||
{
|
||||
QSignalBlocker blocker(this);
|
||||
d->m_architectureComboBox->setCurrentIndex(static_cast<int>(current.architecture()));
|
||||
d->m_osComboBox->setCurrentIndex(static_cast<int>(current.os()));
|
||||
osChanged();
|
||||
@@ -267,7 +267,7 @@ void AbiWidget::setCustomAbi(const Abi ¤t)
|
||||
}
|
||||
if (d->isCustom())
|
||||
d->m_abi->setItemData(0, current.toString());
|
||||
blockSignals(blocked);
|
||||
}
|
||||
|
||||
emit abiChanged();
|
||||
}
|
||||
|
@@ -661,7 +661,7 @@ void CustomToolChainConfigWidget::applyImpl()
|
||||
void CustomToolChainConfigWidget::setFromToolchain()
|
||||
{
|
||||
// subwidgets are not yet connected!
|
||||
bool blocked = blockSignals(true);
|
||||
QSignalBlocker blocker(this);
|
||||
auto tc = static_cast<CustomToolChain *>(toolChain());
|
||||
m_compilerCommand->setFileName(tc->compilerCommand());
|
||||
m_makeCommand->setFileName(FileName::fromString(tc->makeCommand(Environment())));
|
||||
@@ -673,7 +673,6 @@ void CustomToolChainConfigWidget::setFromToolchain()
|
||||
int index = m_errorParserComboBox->findData(tc->outputParserId().toSetting());
|
||||
m_errorParserComboBox->setCurrentIndex(index);
|
||||
m_customParserSettings = tc->customParserSettings();
|
||||
blockSignals(blocked);
|
||||
}
|
||||
|
||||
bool CustomToolChainConfigWidget::isDirtyImpl() const
|
||||
|
@@ -1149,7 +1149,7 @@ void GccToolChainConfigWidget::applyImpl()
|
||||
void GccToolChainConfigWidget::setFromToolchain()
|
||||
{
|
||||
// subwidgets are not yet connected!
|
||||
bool blocked = blockSignals(true);
|
||||
QSignalBlocker blocker(this);
|
||||
auto tc = static_cast<GccToolChain *>(toolChain());
|
||||
m_compilerCommand->setFileName(tc->compilerCommand());
|
||||
m_platformCodeGenFlagsLineEdit->setText(QtcProcess::joinArgs(tc->platformCodeGenFlags()));
|
||||
@@ -1157,7 +1157,6 @@ void GccToolChainConfigWidget::setFromToolchain()
|
||||
m_abiWidget->setAbis(tc->supportedAbis(), tc->targetAbi());
|
||||
if (!m_isReadOnly && !m_compilerCommand->path().isEmpty())
|
||||
m_abiWidget->setEnabled(true);
|
||||
blockSignals(blocked);
|
||||
}
|
||||
|
||||
bool GccToolChainConfigWidget::isDirtyImpl() const
|
||||
|
@@ -74,7 +74,7 @@ QWidget *ChangeStyleWidgetAction::createWidget(QWidget *parent)
|
||||
if (!comboBox)
|
||||
return;
|
||||
|
||||
bool block = comboBox->blockSignals(true);
|
||||
QSignalBlocker blocker(comboBox);
|
||||
|
||||
if (style.isEmpty()) { /* The .conf file is misssing. */
|
||||
comboBox->setDisabled(true);
|
||||
@@ -85,8 +85,6 @@ QWidget *ChangeStyleWidgetAction::createWidget(QWidget *parent)
|
||||
comboBox->setToolTip(tr(enabledTooltip));
|
||||
comboBox->setEditText(style);
|
||||
}
|
||||
|
||||
comboBox->blockSignals(block);
|
||||
});
|
||||
|
||||
connect(comboBox,
|
||||
|
@@ -160,22 +160,19 @@ void ComponentView::modelAttached(Model *model)
|
||||
if (AbstractView::model() == model)
|
||||
return;
|
||||
|
||||
bool block = m_componentAction->blockSignals(true);
|
||||
QSignalBlocker blocker(m_componentAction);
|
||||
m_standardItemModel->clear();
|
||||
|
||||
AbstractView::modelAttached(model);
|
||||
|
||||
searchForComponentAndAddToList(rootModelNode());
|
||||
|
||||
m_componentAction->blockSignals(block);
|
||||
}
|
||||
|
||||
void ComponentView::modelAboutToBeDetached(Model *model)
|
||||
{
|
||||
bool block = m_componentAction->blockSignals(true);
|
||||
QSignalBlocker blocker(m_componentAction);
|
||||
m_standardItemModel->clear();
|
||||
AbstractView::modelAboutToBeDetached(model);
|
||||
m_componentAction->blockSignals(block);
|
||||
}
|
||||
|
||||
ComponentAction *ComponentView::action()
|
||||
|
@@ -117,9 +117,10 @@ void DocumentWarningWidget::refreshContent()
|
||||
m_continueButton->setText(tr("OK"));
|
||||
} else {
|
||||
m_headerLabel->setText(tr("This QML file contains features which are not supported by Qt Quick Designer at:"));
|
||||
bool block = m_ignoreWarningsCheckBox->blockSignals(true);
|
||||
{
|
||||
QSignalBlocker blocker(m_ignoreWarningsCheckBox);
|
||||
m_ignoreWarningsCheckBox->setChecked(!warningsEnabled());
|
||||
m_ignoreWarningsCheckBox->blockSignals(block);
|
||||
}
|
||||
m_ignoreWarningsCheckBox->show();
|
||||
m_continueButton->setText(tr("Ignore"));
|
||||
}
|
||||
|
@@ -54,14 +54,13 @@ AddNewBackendDialog::~AddNewBackendDialog()
|
||||
|
||||
void AddNewBackendDialog::setupPossibleTypes(const QList<CppTypeData> &types)
|
||||
{
|
||||
bool block = blockSignals(true);
|
||||
QSignalBlocker blocker(this);
|
||||
m_typeData = types;
|
||||
for (const CppTypeData &typeData : types)
|
||||
m_ui->comboBox->addItem(typeData.typeName);
|
||||
|
||||
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(m_ui->comboBox->count() > 0);
|
||||
invalidate();
|
||||
blockSignals(block);
|
||||
}
|
||||
|
||||
QString AddNewBackendDialog::importString() const
|
||||
|
@@ -257,14 +257,12 @@ void QmlJSEditorWidget::updateOutlineIndexNow()
|
||||
emit outlineModelIndexChanged(m_outlineModelIndex);
|
||||
|
||||
if (comboIndex.isValid()) {
|
||||
bool blocked = m_outlineCombo->blockSignals(true);
|
||||
QSignalBlocker blocker(m_outlineCombo);
|
||||
|
||||
// There is no direct way to select a non-root item
|
||||
m_outlineCombo->setRootModelIndex(comboIndex.parent());
|
||||
m_outlineCombo->setCurrentIndex(comboIndex.row());
|
||||
m_outlineCombo->setRootModelIndex(QModelIndex());
|
||||
|
||||
m_outlineCombo->blockSignals(blocked);
|
||||
}
|
||||
}
|
||||
} // namespace Internal
|
||||
|
@@ -85,14 +85,15 @@ int QmlProfilerNotesModel::addQmlNote(int typeId, int collapsedRow, qint64 start
|
||||
|
||||
void QmlProfilerNotesModel::loadData()
|
||||
{
|
||||
blockSignals(true);
|
||||
{
|
||||
QSignalBlocker blocker(this);
|
||||
for (int i = 0; i != m_notes.size(); ++i) {
|
||||
QmlNote ¬e = m_notes[i];
|
||||
note.setLoaded(addQmlNote(note.typeIndex(), note.collapsedRow(), note.startTime(),
|
||||
note.duration(), note.text()) != -1);
|
||||
}
|
||||
resetModified();
|
||||
blockSignals(false);
|
||||
}
|
||||
emit changed(-1, -1, -1);
|
||||
}
|
||||
|
||||
|
@@ -309,14 +309,13 @@ void QnxToolChainConfigWidget::applyImpl()
|
||||
void QnxToolChainConfigWidget::discardImpl()
|
||||
{
|
||||
// subwidgets are not yet connected!
|
||||
bool blocked = blockSignals(true);
|
||||
QSignalBlocker blocker(this);
|
||||
QnxToolChain *tc = static_cast<QnxToolChain *>(toolChain());
|
||||
m_compilerCommand->setFileName(tc->compilerCommand());
|
||||
m_sdpPath->setPath(tc->sdpPath());
|
||||
m_abiWidget->setAbis(tc->supportedAbis(), tc->targetAbi());
|
||||
if (!m_compilerCommand->path().isEmpty())
|
||||
m_abiWidget->setEnabled(true);
|
||||
blockSignals(blocked);
|
||||
}
|
||||
|
||||
bool QnxToolChainConfigWidget::isDirtyImpl() const
|
||||
|
@@ -51,7 +51,6 @@ void NavigatorSlider::zoomOut()
|
||||
|
||||
void NavigatorSlider::setSliderValue(int val)
|
||||
{
|
||||
m_ui.m_slider->blockSignals(true);
|
||||
QSignalBlocker blocker(m_ui.m_slider);
|
||||
m_ui.m_slider->setValue(val);
|
||||
m_ui.m_slider->blockSignals(false);
|
||||
}
|
||||
|
@@ -193,8 +193,7 @@ void StateProperties::setContentVisibility(bool visible)
|
||||
void StateProperties::updateContent()
|
||||
{
|
||||
if (!m_contentEdit->hasFocus()) {
|
||||
m_contentEdit->blockSignals(true);
|
||||
QSignalBlocker blocker(m_contentEdit);
|
||||
m_contentEdit->setPlainText(content());
|
||||
m_contentEdit->blockSignals(false);
|
||||
}
|
||||
}
|
||||
|
@@ -84,9 +84,8 @@ void TextItem::checkText()
|
||||
|
||||
void TextItem::setText(const QString &t)
|
||||
{
|
||||
blockSignals(true);
|
||||
QSignalBlocker blocker(this);
|
||||
setPlainText(t);
|
||||
blockSignals(false);
|
||||
}
|
||||
|
||||
void TextItem::focusInEvent(QFocusEvent *event)
|
||||
|
@@ -242,9 +242,8 @@ void CodeStyleSelectorWidget::slotComboBoxActivated(int index)
|
||||
ICodeStylePreferences *delegate =
|
||||
m_ui->delegateComboBox->itemData(index).value<ICodeStylePreferences *>();
|
||||
|
||||
const bool wasBlocked = blockSignals(true);
|
||||
QSignalBlocker blocker(this);
|
||||
m_codeStyle->setCurrentDelegate(delegate);
|
||||
blockSignals(wasBlocked);
|
||||
}
|
||||
|
||||
void CodeStyleSelectorWidget::slotCurrentDelegateChanged(ICodeStylePreferences *delegate)
|
||||
|
@@ -59,12 +59,11 @@ TabSettingsWidget::~TabSettingsWidget()
|
||||
|
||||
void TabSettingsWidget::setTabSettings(const TextEditor::TabSettings& s)
|
||||
{
|
||||
const bool wasBlocked = blockSignals(true);
|
||||
QSignalBlocker blocker(this);
|
||||
ui->tabPolicy->setCurrentIndex(s.m_tabPolicy);
|
||||
ui->tabSize->setValue(s.m_tabSize);
|
||||
ui->indentSize->setValue(s.m_indentSize);
|
||||
ui->continuationAlignBehavior->setCurrentIndex(s.m_continuationAlignBehavior);
|
||||
blockSignals(wasBlocked);
|
||||
}
|
||||
|
||||
TabSettings TabSettingsWidget::tabSettings() const
|
||||
|
@@ -42,9 +42,8 @@ enum { spacing = 2 };
|
||||
|
||||
static void inline setComboBlocked(QComboBox *cb, int index)
|
||||
{
|
||||
const bool blocked = cb->blockSignals(true);
|
||||
QSignalBlocker blocker(cb);
|
||||
cb->setCurrentIndex(index);
|
||||
cb->blockSignals(blocked);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@@ -943,9 +943,8 @@ void VcsBaseEditorWidget::slotCursorPositionChanged()
|
||||
if (section != -1) {
|
||||
QComboBox *entriesComboBox = d->entriesComboBox();
|
||||
if (entriesComboBox->currentIndex() != section) {
|
||||
const bool blocked = entriesComboBox->blockSignals(true);
|
||||
QSignalBlocker blocker(entriesComboBox);
|
||||
entriesComboBox->setCurrentIndex(section);
|
||||
entriesComboBox->blockSignals(blocked);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -181,9 +181,8 @@ void VcsBaseEditorConfig::mapSetting(QAction *button, bool *setting)
|
||||
if (!d->m_settingMapping.contains(button) && button) {
|
||||
d->m_settingMapping.insert(button, Internal::SettingMappingData(setting));
|
||||
if (setting) {
|
||||
button->blockSignals(true);
|
||||
QSignalBlocker blocker(button);
|
||||
button->setChecked(*setting);
|
||||
button->blockSignals(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -193,11 +192,10 @@ void VcsBaseEditorConfig::mapSetting(QComboBox *comboBox, QString *setting)
|
||||
if (!d->m_settingMapping.contains(comboBox) && comboBox) {
|
||||
d->m_settingMapping.insert(comboBox, Internal::SettingMappingData(setting));
|
||||
if (setting) {
|
||||
comboBox->blockSignals(true);
|
||||
QSignalBlocker blocker(comboBox);
|
||||
const int itemIndex = comboBox->findData(*setting);
|
||||
if (itemIndex != -1)
|
||||
comboBox->setCurrentIndex(itemIndex);
|
||||
comboBox->blockSignals(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -212,9 +210,8 @@ void VcsBaseEditorConfig::mapSetting(QComboBox *comboBox, int *setting)
|
||||
if (!setting || *setting < 0 || *setting >= comboBox->count())
|
||||
return;
|
||||
|
||||
comboBox->blockSignals(true);
|
||||
QSignalBlocker blocker(comboBox);
|
||||
comboBox->setCurrentIndex(*setting);
|
||||
comboBox->blockSignals(false);
|
||||
}
|
||||
|
||||
void VcsBaseEditorConfig::handleArgumentsChanged()
|
||||
|
Reference in New Issue
Block a user