Commit 17ce7d4a authored by Alessandro Portale's avatar Alessandro Portale Committed by hjk

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

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

Change-Id: Ifb1cf200f489f62a79e12c761e98a846992744dc
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent cf8a6144
......@@ -70,7 +70,7 @@ void PluginErrorOverview::showDetails(QListWidgetItem *item)
PluginSpec *spec = item->data(Qt::UserRole).value<PluginSpec *>();
m_ui->pluginError->setText(spec->errorString());
} else {
m_ui->pluginError->setText(QString());
m_ui->pluginError->clear();
}
}
......
......@@ -249,7 +249,7 @@ void CommandMappings::finish()
void CommandMappings::commandChanged(QTreeWidgetItem *current)
{
if (!current || !current->data(0, Qt::UserRole).isValid()) {
d->targetEdit->setText(QString());
d->targetEdit->clear();
d->targetEditGroup->setEnabled(false);
return;
}
......
......@@ -521,11 +521,11 @@ void ExternalToolConfig::showInfoForItem(const QModelIndex &index)
updateButtons(index);
ExternalTool *tool = m_model->toolForIndex(index);
if (!tool) {
ui->description->setText(QString());
ui->description->clear();
ui->executable->setPath(QString());
ui->arguments->setText(QString());
ui->arguments->clear();
ui->workingDirectory->setPath(QString());
ui->inputText->setPlainText(QString());
ui->inputText->clear();
ui->infoWidget->setEnabled(false);
return;
}
......
......@@ -429,7 +429,7 @@ void NewDialog::currentItemChanged(const QModelIndex &index)
}
} else {
m_ui->templateDescription->setText(QString());
m_ui->templateDescription->clear();
}
updateOkButton();
}
......
......@@ -512,7 +512,7 @@ void SettingsDialog::currentChanged(const QModelIndex &current)
showCategory(m_proxyModel->mapToSource(current).row());
} else {
m_stackedLayout->setCurrentIndex(0);
m_headerLabel->setText(QString());
m_headerLabel->clear();
}
}
......
......@@ -211,7 +211,7 @@ void GeneralSettings::resetWarnings()
void GeneralSettings::resetTerminal()
{
if (HostOsInfo::isAnyUnixHost())
m_page->terminalComboBox->lineEdit()->setText(QString());
m_page->terminalComboBox->lineEdit()->clear();
}
void GeneralSettings::resetFileBrowser()
......
......@@ -751,7 +751,7 @@ void OutputPaneToggleButton::setIconBadgeNumber(int number)
//Do not show yet, we wait until the button has been resized
} else {
m_label->setText(QString());
m_label->clear();
m_label->hide();
}
updateGeometry();
......
......@@ -1330,7 +1330,7 @@ void CppCodeModelInspectorDialog::onWorkingCopyDocumentSelected(const QModelInde
m_ui->workingCopySourceEdit->setPlainText(source);
}
} 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_docMacrosModel->clear();
m_ui->docPreprocessedSourceEdit->setPlainText(QString());
m_ui->docPreprocessedSourceEdit->clear();
m_docSymbolsModel->clear();
......@@ -1582,18 +1582,18 @@ void CppCodeModelInspectorDialog::clearProjectPartData()
{
m_partGenericInfoModel->clear();
m_ui->partProjectFilesEdit->setPlainText(QString());
m_ui->partProjectFilesEdit->clear();
m_ui->projectPartTab->setTabText(ProjectPartFilesTab, partTabName(ProjectPartFilesTab));
m_ui->partToolchainDefinesEdit->setPlainText(QString());
m_ui->partProjectDefinesEdit->setPlainText(QString());
m_ui->partToolchainDefinesEdit->clear();
m_ui->partProjectDefinesEdit->clear();
m_ui->projectPartTab->setTabText(ProjectPartDefinesTab, partTabName(ProjectPartDefinesTab));
m_ui->partHeaderPathsEdit->setPlainText(QString());
m_ui->partHeaderPathsEdit->clear();
m_ui->projectPartTab->setTabText(ProjectPartHeaderPathsTab,
partTabName(ProjectPartHeaderPathsTab));
m_ui->partPrecompiledHeadersEdit->setPlainText(QString());
m_ui->partPrecompiledHeadersEdit->clear();
m_ui->projectPartTab->setTabText(ProjectPartPrecompiledHeadersTab,
partTabName(ProjectPartPrecompiledHeadersTab));
}
......
......@@ -1132,7 +1132,7 @@ public:
void setHistoryCompleter(const QString &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
......
......@@ -112,7 +112,7 @@ bool FormWindowFile::setContents(const QByteArray &contents)
if (Designer::Constants::Internal::debug)
qDebug() << Q_FUNC_INFO << contents.size();
document()->setPlainText(QString());
document()->clear();
QTC_ASSERT(m_formWindow, return false);
......
......@@ -525,7 +525,7 @@ void FakeVimOptionPage::setPlainStyle()
m_ui.checkBoxAutoIndent->setChecked(false);
m_ui.checkBoxSmartIndent->setChecked(false);
m_ui.checkBoxIncSearch->setChecked(false);
m_ui.lineEditBackspace->setText(QString());
m_ui.lineEditBackspace->clear();
m_ui.checkBoxPassKeys->setChecked(false);
}
......
......@@ -244,7 +244,7 @@ void ChangeSelectionDialog::recalculateDetails()
const QString ref = change();
if (ref.isEmpty()) {
m_ui->detailsText->setPlainText(QString());
m_ui->detailsText->clear();
return;
}
......
......@@ -73,8 +73,8 @@ QString RemoteAdditionDialog::remoteUrl() const
void RemoteAdditionDialog::clear()
{
m_ui->nameEdit->setText(QString());
m_ui->urlEdit->setText(QString());
m_ui->nameEdit->clear();
m_ui->urlEdit->clear();
}
// --------------------------------------------------------------------------
......
......@@ -130,7 +130,7 @@ void CustomWizardFieldPage::showError(const QString &m)
void CustomWizardFieldPage::clearError()
{
m_errorLabel->setText(QString());
m_errorLabel->clear();
m_errorLabel->setVisible(false);
}
......
......@@ -837,7 +837,7 @@ void QtOptionsPageWidget::updateDescriptionLabel()
m_infoBrowser->setHtml(version->toHtml(true));
setInfoWidgetVisibility();
} else {
m_infoBrowser->setHtml(QString());
m_infoBrowser->clear();
m_ui->versionInfoWidget->setVisible(false);
m_ui->infoWidget->setVisible(false);
m_ui->debuggingHelperWidget->setVisible(false);
......@@ -895,7 +895,7 @@ void QtOptionsPageWidget::updateWidgets()
}
} else {
m_versionUi->nameEdit->clear();
m_versionUi->qmakePath->setText(QString()); // clear()
m_versionUi->qmakePath->clear();
}
const bool enabled = version != 0;
......
......@@ -525,7 +525,7 @@ bool BaseTextDocument::open(QString *errorString, const QString &fileName, const
d->m_document->setModified(false);
const int chunks = content.size();
if (chunks == 0) {
d->m_document->setPlainText(QString());
d->m_document->clear();
} else if (chunks == 1) {
d->m_document->setPlainText(content.at(0));
} else {
......
......@@ -275,7 +275,7 @@ void CallgrindToolPrivate::doClear(bool clearParseData)
m_filterProjectCosts->setChecked(false);
m_proxyModel->setFilterBaseDir(QString());
if (m_searchFilter)
m_searchFilter->setText(QString());
m_searchFilter->clear();
m_proxyModel->setFilterFixedString(QString());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment