Make compile with Qt 5.4

Partial backport of 5da75dba06

Change-Id: I5d0964818934a2a0fc57c97b229469fd5a6c8131
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
Kevin Funk
2014-09-22 14:02:25 +02:00
committed by hjk
parent 10cb7abe17
commit faeac783f0
2 changed files with 15 additions and 5 deletions

View File

@@ -116,6 +116,16 @@
using namespace Core; using namespace Core;
using namespace Utils; using namespace Utils;
static QString QString_toUpper(const QString &str)
{
return str.toUpper();
}
static QString QString_toLower(const QString &str)
{
return str.toLower();
}
namespace TextEditor { namespace TextEditor {
namespace Internal { namespace Internal {
@@ -1008,12 +1018,12 @@ void BaseTextEditorWidget::moveLineDown()
void BaseTextEditorWidget::uppercaseSelection() void BaseTextEditorWidget::uppercaseSelection()
{ {
transformSelection(&QString::toUpper); transformSelection(&QString_toUpper);
} }
void BaseTextEditorWidget::lowercaseSelection() void BaseTextEditorWidget::lowercaseSelection()
{ {
transformSelection(&QString::toLower); transformSelection(&QString_toLower);
} }
void BaseTextEditorWidget::indent() void BaseTextEditorWidget::indent()
@@ -6555,7 +6565,7 @@ void BaseTextEditorWidget::transformSelection(TransformationMethod method)
} }
QString text = cursor.selectedText(); QString text = cursor.selectedText();
QString transformedText = (text.*method)(); QString transformedText = method(text);
if (transformedText == text) { if (transformedText == text) {
// if the transformation does not do anything to the selection, do no create an undo step // if the transformation does not do anything to the selection, do no create an undo step
@@ -6600,7 +6610,7 @@ void BaseTextEditorWidget::transformBlockSelection(TransformationMethod method)
if (startPos < endPos) { if (startPos < endPos) {
cursor.setPosition(startPos); cursor.setPosition(startPos);
cursor.setPosition(endPos, QTextCursor::KeepAnchor); cursor.setPosition(endPos, QTextCursor::KeepAnchor);
const QString &transformedText = (d->m_document->textAt(startPos, endPos - startPos).*method)(); const QString &transformedText = method(d->m_document->textAt(startPos, endPos - startPos));
if (transformedText != cursor.selectedText()) if (transformedText != cursor.selectedText())
cursor.insertText(transformedText); cursor.insertText(transformedText);
} }

View File

@@ -64,7 +64,7 @@ typedef QList<RefactorMarker> RefactorMarkers;
namespace Internal { namespace Internal {
class BaseTextEditorWidgetPrivate; class BaseTextEditorWidgetPrivate;
class TextEditorOverlay; class TextEditorOverlay;
typedef QString (QString::*TransformationMethod)() const; typedef QString (TransformationMethod)(const QString &);
} }
class ITextMarkable; class ITextMarkable;