forked from qt-creator/qt-creator
Replace the PMF to certain QString members with a regular function
Qt 5.4 is adding ref-qualified overloads to toUpper, toLower, trimmed and some others, so the cast becomes ambiguous or just plain wrong. Change-Id: Idff0b3e100f075b9b995aeb84d88575afecb2d6f Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
@@ -264,7 +264,7 @@ static QString fixStringForTags(const QString &string)
|
||||
|
||||
static QStringList trimStringList(const QStringList &stringlist)
|
||||
{
|
||||
return Utils::transform(stringlist, &QString::trimmed);
|
||||
return Utils::transform(stringlist, [](const QString &str) { return str.trimmed(); });
|
||||
}
|
||||
|
||||
static QString relativeOrInstallPath(const QString &path, const QString &manifestPath,
|
||||
|
@@ -133,7 +133,17 @@ using namespace Utils;
|
||||
namespace TextEditor {
|
||||
namespace Internal {
|
||||
|
||||
typedef QString (QString::*TransformationMethod)() const;
|
||||
typedef QString (TransformationMethod)(const QString &);
|
||||
|
||||
static QString QString_toUpper(const QString &str)
|
||||
{
|
||||
return str.toUpper();
|
||||
}
|
||||
|
||||
static QString QString_toLower(const QString &str)
|
||||
{
|
||||
return str.toLower();
|
||||
}
|
||||
|
||||
class BaseTextEditorAnimator : public QObject
|
||||
{
|
||||
@@ -1252,12 +1262,12 @@ void BaseTextEditorWidget::moveLineDown()
|
||||
|
||||
void BaseTextEditorWidget::uppercaseSelection()
|
||||
{
|
||||
d->transformSelection(&QString::toUpper);
|
||||
d->transformSelection(&QString_toUpper);
|
||||
}
|
||||
|
||||
void BaseTextEditorWidget::lowercaseSelection()
|
||||
{
|
||||
d->transformSelection(&QString::toLower);
|
||||
d->transformSelection(&QString_toLower);
|
||||
}
|
||||
|
||||
void BaseTextEditorWidget::indent()
|
||||
@@ -6833,7 +6843,7 @@ void BaseTextEditorWidgetPrivate::transformSelection(TransformationMethod method
|
||||
}
|
||||
|
||||
QString text = cursor.selectedText();
|
||||
QString transformedText = (text.*method)();
|
||||
QString transformedText = method(text);
|
||||
|
||||
if (transformedText == text) {
|
||||
// if the transformation does not do anything to the selection, do no create an undo step
|
||||
@@ -6878,7 +6888,7 @@ void BaseTextEditorWidgetPrivate::transformBlockSelection(TransformationMethod m
|
||||
if (startPos < endPos) {
|
||||
cursor.setPosition(startPos);
|
||||
cursor.setPosition(endPos, QTextCursor::KeepAnchor);
|
||||
const QString &transformedText = (m_document->textAt(startPos, endPos - startPos).*method)();
|
||||
const QString &transformedText = method(m_document->textAt(startPos, endPos - startPos));
|
||||
if (transformedText != cursor.selectedText())
|
||||
cursor.insertText(transformedText);
|
||||
}
|
||||
|
Reference in New Issue
Block a user