Replace set[Plain]Text(QString()) with clear()

...where applicable. Shorter, faster, more semantic.

Change-Id: Ifb1cf200f489f62a79e12c761e98a846992744dc
Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
Alessandro Portale
2014-07-23 09:53:06 +02:00
committed by hjk
parent cf8a614419
commit 17ce7d4ad5
17 changed files with 27 additions and 27 deletions

View File

@@ -70,7 +70,7 @@ void PluginErrorOverview::showDetails(QListWidgetItem *item)
PluginSpec *spec = item->data(Qt::UserRole).value<PluginSpec *>(); PluginSpec *spec = item->data(Qt::UserRole).value<PluginSpec *>();
m_ui->pluginError->setText(spec->errorString()); m_ui->pluginError->setText(spec->errorString());
} else { } else {
m_ui->pluginError->setText(QString()); m_ui->pluginError->clear();
} }
} }

View File

@@ -249,7 +249,7 @@ void CommandMappings::finish()
void CommandMappings::commandChanged(QTreeWidgetItem *current) void CommandMappings::commandChanged(QTreeWidgetItem *current)
{ {
if (!current || !current->data(0, Qt::UserRole).isValid()) { if (!current || !current->data(0, Qt::UserRole).isValid()) {
d->targetEdit->setText(QString()); d->targetEdit->clear();
d->targetEditGroup->setEnabled(false); d->targetEditGroup->setEnabled(false);
return; return;
} }

View File

@@ -521,11 +521,11 @@ void ExternalToolConfig::showInfoForItem(const QModelIndex &index)
updateButtons(index); updateButtons(index);
ExternalTool *tool = m_model->toolForIndex(index); ExternalTool *tool = m_model->toolForIndex(index);
if (!tool) { if (!tool) {
ui->description->setText(QString()); ui->description->clear();
ui->executable->setPath(QString()); ui->executable->setPath(QString());
ui->arguments->setText(QString()); ui->arguments->clear();
ui->workingDirectory->setPath(QString()); ui->workingDirectory->setPath(QString());
ui->inputText->setPlainText(QString()); ui->inputText->clear();
ui->infoWidget->setEnabled(false); ui->infoWidget->setEnabled(false);
return; return;
} }

View File

@@ -429,7 +429,7 @@ void NewDialog::currentItemChanged(const QModelIndex &index)
} }
} else { } else {
m_ui->templateDescription->setText(QString()); m_ui->templateDescription->clear();
} }
updateOkButton(); updateOkButton();
} }

View File

@@ -512,7 +512,7 @@ void SettingsDialog::currentChanged(const QModelIndex &current)
showCategory(m_proxyModel->mapToSource(current).row()); showCategory(m_proxyModel->mapToSource(current).row());
} else { } else {
m_stackedLayout->setCurrentIndex(0); m_stackedLayout->setCurrentIndex(0);
m_headerLabel->setText(QString()); m_headerLabel->clear();
} }
} }

View File

@@ -211,7 +211,7 @@ void GeneralSettings::resetWarnings()
void GeneralSettings::resetTerminal() void GeneralSettings::resetTerminal()
{ {
if (HostOsInfo::isAnyUnixHost()) if (HostOsInfo::isAnyUnixHost())
m_page->terminalComboBox->lineEdit()->setText(QString()); m_page->terminalComboBox->lineEdit()->clear();
} }
void GeneralSettings::resetFileBrowser() void GeneralSettings::resetFileBrowser()

View File

@@ -751,7 +751,7 @@ void OutputPaneToggleButton::setIconBadgeNumber(int number)
//Do not show yet, we wait until the button has been resized //Do not show yet, we wait until the button has been resized
} else { } else {
m_label->setText(QString()); m_label->clear();
m_label->hide(); m_label->hide();
} }
updateGeometry(); updateGeometry();

View File

@@ -1330,7 +1330,7 @@ void CppCodeModelInspectorDialog::onWorkingCopyDocumentSelected(const QModelInde
m_ui->workingCopySourceEdit->setPlainText(source); m_ui->workingCopySourceEdit->setPlainText(source);
} }
} else { } else {
m_ui->workingCopySourceEdit->setPlainText(QString()); m_ui->workingCopySourceEdit->clear();
} }
} }
@@ -1489,7 +1489,7 @@ void CppCodeModelInspectorDialog::clearDocumentData()
m_ui->docTab->setTabText(DocumentDefinedMacrosTab, docTabName(DocumentDefinedMacrosTab)); m_ui->docTab->setTabText(DocumentDefinedMacrosTab, docTabName(DocumentDefinedMacrosTab));
m_docMacrosModel->clear(); m_docMacrosModel->clear();
m_ui->docPreprocessedSourceEdit->setPlainText(QString()); m_ui->docPreprocessedSourceEdit->clear();
m_docSymbolsModel->clear(); m_docSymbolsModel->clear();
@@ -1582,18 +1582,18 @@ void CppCodeModelInspectorDialog::clearProjectPartData()
{ {
m_partGenericInfoModel->clear(); m_partGenericInfoModel->clear();
m_ui->partProjectFilesEdit->setPlainText(QString()); m_ui->partProjectFilesEdit->clear();
m_ui->projectPartTab->setTabText(ProjectPartFilesTab, partTabName(ProjectPartFilesTab)); m_ui->projectPartTab->setTabText(ProjectPartFilesTab, partTabName(ProjectPartFilesTab));
m_ui->partToolchainDefinesEdit->setPlainText(QString()); m_ui->partToolchainDefinesEdit->clear();
m_ui->partProjectDefinesEdit->setPlainText(QString()); m_ui->partProjectDefinesEdit->clear();
m_ui->projectPartTab->setTabText(ProjectPartDefinesTab, partTabName(ProjectPartDefinesTab)); m_ui->projectPartTab->setTabText(ProjectPartDefinesTab, partTabName(ProjectPartDefinesTab));
m_ui->partHeaderPathsEdit->setPlainText(QString()); m_ui->partHeaderPathsEdit->clear();
m_ui->projectPartTab->setTabText(ProjectPartHeaderPathsTab, m_ui->projectPartTab->setTabText(ProjectPartHeaderPathsTab,
partTabName(ProjectPartHeaderPathsTab)); partTabName(ProjectPartHeaderPathsTab));
m_ui->partPrecompiledHeadersEdit->setPlainText(QString()); m_ui->partPrecompiledHeadersEdit->clear();
m_ui->projectPartTab->setTabText(ProjectPartPrecompiledHeadersTab, m_ui->projectPartTab->setTabText(ProjectPartPrecompiledHeadersTab,
partTabName(ProjectPartPrecompiledHeadersTab)); partTabName(ProjectPartPrecompiledHeadersTab));
} }

View File

@@ -1132,7 +1132,7 @@ public:
void setHistoryCompleter(const QString &key) void setHistoryCompleter(const QString &key)
{ {
m_lineEdit->setHistoryCompleter(key); m_lineEdit->setHistoryCompleter(key);
m_lineEdit->setText(QString()); // Undo "convenient" population with history item. m_lineEdit->clear(); // Undo "convenient" population with history item.
} }
QString text() const QString text() const

View File

@@ -112,7 +112,7 @@ bool FormWindowFile::setContents(const QByteArray &contents)
if (Designer::Constants::Internal::debug) if (Designer::Constants::Internal::debug)
qDebug() << Q_FUNC_INFO << contents.size(); qDebug() << Q_FUNC_INFO << contents.size();
document()->setPlainText(QString()); document()->clear();
QTC_ASSERT(m_formWindow, return false); QTC_ASSERT(m_formWindow, return false);

View File

@@ -525,7 +525,7 @@ void FakeVimOptionPage::setPlainStyle()
m_ui.checkBoxAutoIndent->setChecked(false); m_ui.checkBoxAutoIndent->setChecked(false);
m_ui.checkBoxSmartIndent->setChecked(false); m_ui.checkBoxSmartIndent->setChecked(false);
m_ui.checkBoxIncSearch->setChecked(false); m_ui.checkBoxIncSearch->setChecked(false);
m_ui.lineEditBackspace->setText(QString()); m_ui.lineEditBackspace->clear();
m_ui.checkBoxPassKeys->setChecked(false); m_ui.checkBoxPassKeys->setChecked(false);
} }

View File

@@ -244,7 +244,7 @@ void ChangeSelectionDialog::recalculateDetails()
const QString ref = change(); const QString ref = change();
if (ref.isEmpty()) { if (ref.isEmpty()) {
m_ui->detailsText->setPlainText(QString()); m_ui->detailsText->clear();
return; return;
} }

View File

@@ -73,8 +73,8 @@ QString RemoteAdditionDialog::remoteUrl() const
void RemoteAdditionDialog::clear() void RemoteAdditionDialog::clear()
{ {
m_ui->nameEdit->setText(QString()); m_ui->nameEdit->clear();
m_ui->urlEdit->setText(QString()); m_ui->urlEdit->clear();
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------

View File

@@ -130,7 +130,7 @@ void CustomWizardFieldPage::showError(const QString &m)
void CustomWizardFieldPage::clearError() void CustomWizardFieldPage::clearError()
{ {
m_errorLabel->setText(QString()); m_errorLabel->clear();
m_errorLabel->setVisible(false); m_errorLabel->setVisible(false);
} }

View File

@@ -837,7 +837,7 @@ void QtOptionsPageWidget::updateDescriptionLabel()
m_infoBrowser->setHtml(version->toHtml(true)); m_infoBrowser->setHtml(version->toHtml(true));
setInfoWidgetVisibility(); setInfoWidgetVisibility();
} else { } else {
m_infoBrowser->setHtml(QString()); m_infoBrowser->clear();
m_ui->versionInfoWidget->setVisible(false); m_ui->versionInfoWidget->setVisible(false);
m_ui->infoWidget->setVisible(false); m_ui->infoWidget->setVisible(false);
m_ui->debuggingHelperWidget->setVisible(false); m_ui->debuggingHelperWidget->setVisible(false);
@@ -895,7 +895,7 @@ void QtOptionsPageWidget::updateWidgets()
} }
} else { } else {
m_versionUi->nameEdit->clear(); m_versionUi->nameEdit->clear();
m_versionUi->qmakePath->setText(QString()); // clear() m_versionUi->qmakePath->clear();
} }
const bool enabled = version != 0; const bool enabled = version != 0;

View File

@@ -525,7 +525,7 @@ bool BaseTextDocument::open(QString *errorString, const QString &fileName, const
d->m_document->setModified(false); d->m_document->setModified(false);
const int chunks = content.size(); const int chunks = content.size();
if (chunks == 0) { if (chunks == 0) {
d->m_document->setPlainText(QString()); d->m_document->clear();
} else if (chunks == 1) { } else if (chunks == 1) {
d->m_document->setPlainText(content.at(0)); d->m_document->setPlainText(content.at(0));
} else { } else {

View File

@@ -275,7 +275,7 @@ void CallgrindToolPrivate::doClear(bool clearParseData)
m_filterProjectCosts->setChecked(false); m_filterProjectCosts->setChecked(false);
m_proxyModel->setFilterBaseDir(QString()); m_proxyModel->setFilterBaseDir(QString());
if (m_searchFilter) if (m_searchFilter)
m_searchFilter->setText(QString()); m_searchFilter->clear();
m_proxyModel->setFilterFixedString(QString()); m_proxyModel->setFilterFixedString(QString());
} }