mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-24 10:52:56 +00:00
remove redundant QTextCursor::MoveOperation enums [ci reset]
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
aee462b95a
commit
703ef5433e
18 changed files with 39 additions and 237 deletions
|
@ -1290,11 +1290,6 @@ public:
|
|||
LogicalCoordinates
|
||||
};
|
||||
|
||||
enum CursorMoveStyle {
|
||||
LogicalMoveStyle,
|
||||
VisualMoveStyle
|
||||
};
|
||||
|
||||
enum HitTestAccuracy {
|
||||
ExactHit,
|
||||
FuzzyHit
|
||||
|
|
|
@ -130,25 +130,25 @@ bool QTextControlPrivate::cursorMoveKeyEvent(QKeyEvent *e)
|
|||
}
|
||||
#ifndef QT_NO_SHORTCUT
|
||||
if (e == QKeySequence::MoveToNextChar) {
|
||||
op = QTextCursor::Right;
|
||||
op = QTextCursor::NextCharacter;
|
||||
}
|
||||
else if (e == QKeySequence::MoveToPreviousChar) {
|
||||
op = QTextCursor::Left;
|
||||
op = QTextCursor::PreviousCharacter;
|
||||
}
|
||||
else if (e == QKeySequence::SelectNextChar) {
|
||||
op = QTextCursor::Right;
|
||||
op = QTextCursor::NextCharacter;
|
||||
mode = QTextCursor::KeepAnchor;
|
||||
}
|
||||
else if (e == QKeySequence::SelectPreviousChar) {
|
||||
op = QTextCursor::Left;
|
||||
op = QTextCursor::PreviousCharacter;
|
||||
mode = QTextCursor::KeepAnchor;
|
||||
}
|
||||
else if (e == QKeySequence::SelectNextWord) {
|
||||
op = QTextCursor::WordRight;
|
||||
op = QTextCursor::NextWord;
|
||||
mode = QTextCursor::KeepAnchor;
|
||||
}
|
||||
else if (e == QKeySequence::SelectPreviousWord) {
|
||||
op = QTextCursor::WordLeft;
|
||||
op = QTextCursor::PreviousWord;
|
||||
mode = QTextCursor::KeepAnchor;
|
||||
}
|
||||
else if (e == QKeySequence::SelectStartOfLine) {
|
||||
|
@ -192,10 +192,10 @@ bool QTextControlPrivate::cursorMoveKeyEvent(QKeyEvent *e)
|
|||
}
|
||||
}
|
||||
else if (e == QKeySequence::MoveToNextWord) {
|
||||
op = QTextCursor::WordRight;
|
||||
op = QTextCursor::NextWord;
|
||||
}
|
||||
else if (e == QKeySequence::MoveToPreviousWord) {
|
||||
op = QTextCursor::WordLeft;
|
||||
op = QTextCursor::PreviousWord;
|
||||
}
|
||||
else if (e == QKeySequence::MoveToEndOfBlock) {
|
||||
op = QTextCursor::EndOfBlock;
|
||||
|
@ -1227,7 +1227,7 @@ void QTextControlPrivate::keyPressEvent(QKeyEvent *e)
|
|||
else if (e == QKeySequence::DeleteEndOfLine) {
|
||||
QTextBlock block = cursor.block();
|
||||
if (cursor.position() == block.position() + block.length() - 2)
|
||||
cursor.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor);
|
||||
cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor);
|
||||
else
|
||||
cursor.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor);
|
||||
cursor.removeSelectedText();
|
||||
|
|
|
@ -223,7 +223,7 @@ void QTextCursorPrivate::adjustCursor(QTextCursor::MoveOperation m)
|
|||
break;
|
||||
}
|
||||
|
||||
if (m <= QTextCursor::WordLeft) {
|
||||
if (m <= QTextCursor::PreviousWord) {
|
||||
if (i < positionChain.size())
|
||||
position = positionChain.at(i)->firstPosition() - 1;
|
||||
} else {
|
||||
|
@ -259,7 +259,7 @@ void QTextCursorPrivate::adjustCursor(QTextCursor::MoveOperation m)
|
|||
}
|
||||
|
||||
// adjust to cell boundaries
|
||||
if (m <= QTextCursor::WordLeft) {
|
||||
if (m <= QTextCursor::PreviousWord) {
|
||||
position = c_position.firstPosition();
|
||||
if (!before)
|
||||
--position;
|
||||
|
@ -342,25 +342,10 @@ bool QTextCursorPrivate::movePosition(QTextCursor::MoveOperation op, QTextCursor
|
|||
currentCharFormat = -1;
|
||||
bool adjustX = true;
|
||||
QTextBlock blockIt = block();
|
||||
bool visualMovement = priv->defaultCursorMoveStyle == Qt::VisualMoveStyle;
|
||||
|
||||
if (!blockIt.isValid())
|
||||
return false;
|
||||
|
||||
if (blockIt.textDirection() == Qt::RightToLeft) {
|
||||
if (op == QTextCursor::WordLeft)
|
||||
op = QTextCursor::NextWord;
|
||||
else if (op == QTextCursor::WordRight)
|
||||
op = QTextCursor::PreviousWord;
|
||||
|
||||
if (!visualMovement) {
|
||||
if (op == QTextCursor::Left)
|
||||
op = QTextCursor::NextCharacter;
|
||||
else if (op == QTextCursor::Right)
|
||||
op = QTextCursor::PreviousCharacter;
|
||||
}
|
||||
}
|
||||
|
||||
const QTextLayout *layout = blockLayout(blockIt);
|
||||
int relativePos = position - blockIt.position();
|
||||
QTextLine line;
|
||||
|
@ -403,10 +388,6 @@ bool QTextCursorPrivate::movePosition(QTextCursor::MoveOperation op, QTextCursor
|
|||
case QTextCursor::PreviousCharacter:
|
||||
newPosition = priv->previousCursorPosition(position, QTextLayout::SkipCharacters);
|
||||
break;
|
||||
case QTextCursor::Left:
|
||||
newPosition = visualMovement ? priv->leftCursorPosition(position)
|
||||
: priv->previousCursorPosition(position, QTextLayout::SkipCharacters);
|
||||
break;
|
||||
case QTextCursor::StartOfWord: {
|
||||
if (relativePos == 0)
|
||||
break;
|
||||
|
@ -424,7 +405,6 @@ bool QTextCursorPrivate::movePosition(QTextCursor::MoveOperation op, QTextCursor
|
|||
// FALL THROUGH!
|
||||
}
|
||||
case QTextCursor::PreviousWord:
|
||||
case QTextCursor::WordLeft:
|
||||
newPosition = priv->previousCursorPosition(position, QTextLayout::SkipWords);
|
||||
break;
|
||||
case QTextCursor::Up: {
|
||||
|
@ -517,12 +497,7 @@ bool QTextCursorPrivate::movePosition(QTextCursor::MoveOperation op, QTextCursor
|
|||
case QTextCursor::NextCharacter:
|
||||
newPosition = priv->nextCursorPosition(position, QTextLayout::SkipCharacters);
|
||||
break;
|
||||
case QTextCursor::Right:
|
||||
newPosition = visualMovement ? priv->rightCursorPosition(position)
|
||||
: priv->nextCursorPosition(position, QTextLayout::SkipCharacters);
|
||||
break;
|
||||
case QTextCursor::NextWord:
|
||||
case QTextCursor::WordRight:
|
||||
newPosition = priv->nextCursorPosition(position, QTextLayout::SkipWords);
|
||||
break;
|
||||
|
||||
|
@ -611,8 +586,8 @@ bool QTextCursorPrivate::movePosition(QTextCursor::MoveOperation op, QTextCursor
|
|||
|
||||
if (mode == QTextCursor::KeepAnchor) {
|
||||
QTextTable *table = qobject_cast<QTextTable *>(priv->frameAt(position));
|
||||
if (table && ((op >= QTextCursor::PreviousBlock && op <= QTextCursor::WordLeft)
|
||||
|| (op >= QTextCursor::NextBlock && op <= QTextCursor::WordRight))) {
|
||||
if (table && ((op >= QTextCursor::PreviousBlock && op <= QTextCursor::PreviousWord)
|
||||
|| (op >= QTextCursor::NextBlock && op <= QTextCursor::NextWord))) {
|
||||
int oldColumn = table->cellAt(position).column();
|
||||
|
||||
const QTextTableCell otherCell = table->cellAt(newPosition);
|
||||
|
@ -621,7 +596,7 @@ bool QTextCursorPrivate::movePosition(QTextCursor::MoveOperation op, QTextCursor
|
|||
|
||||
int newColumn = otherCell.column();
|
||||
if ((oldColumn > newColumn && op >= QTextCursor::End)
|
||||
|| (oldColumn < newColumn && op <= QTextCursor::WordLeft))
|
||||
|| (oldColumn < newColumn && op <= QTextCursor::PreviousWord))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1128,9 +1103,9 @@ void QTextCursor::setPosition(int pos, MoveMode m)
|
|||
} else { // keep anchor
|
||||
QTextCursor::MoveOperation op;
|
||||
if (pos < d->anchor)
|
||||
op = QTextCursor::Left;
|
||||
op = QTextCursor::PreviousCharacter;
|
||||
else
|
||||
op = QTextCursor::Right;
|
||||
op = QTextCursor::NextCharacter;
|
||||
d->adjustCursor(op);
|
||||
}
|
||||
d->setX();
|
||||
|
@ -2547,26 +2522,4 @@ QTextDocument *QTextCursor::document() const
|
|||
return nullptr; // document went away
|
||||
}
|
||||
|
||||
/*!
|
||||
\enum Qt::CursorMoveStyle
|
||||
\since 4.8
|
||||
|
||||
This enum describes the movement style available to text cursors. The options
|
||||
are:
|
||||
|
||||
\value LogicalMoveStyle Within a left-to-right text block, decrease cursor
|
||||
position when pressing left arrow key, increase cursor position when pressing
|
||||
the right arrow key. If the text block is right-to-left, the opposite behavior
|
||||
applies.
|
||||
\value VisualMoveStyle Pressing the left arrow key will always cause the cursor
|
||||
to move left, regardless of the text's writing direction. Pressing the right
|
||||
arrow key will always cause the cursor to move right.
|
||||
*/
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -85,8 +85,6 @@ public:
|
|||
PreviousBlock,
|
||||
PreviousCharacter,
|
||||
PreviousWord,
|
||||
Left,
|
||||
WordLeft,
|
||||
|
||||
End,
|
||||
Down,
|
||||
|
@ -96,8 +94,6 @@ public:
|
|||
NextBlock,
|
||||
NextCharacter,
|
||||
NextWord,
|
||||
Right,
|
||||
WordRight,
|
||||
|
||||
NextCell,
|
||||
PreviousCell,
|
||||
|
|
|
@ -416,29 +416,6 @@ void QTextDocument::setDefaultTextOption(const QTextOption &option)
|
|||
d->lout->documentChanged(0, 0, d->length());
|
||||
}
|
||||
|
||||
/*!
|
||||
\since 4.8
|
||||
|
||||
The default cursor movement style is used by all QTextCursor objects
|
||||
created from the document. The default is Qt::LogicalMoveStyle.
|
||||
*/
|
||||
Qt::CursorMoveStyle QTextDocument::defaultCursorMoveStyle() const
|
||||
{
|
||||
Q_D(const QTextDocument);
|
||||
return d->defaultCursorMoveStyle;
|
||||
}
|
||||
|
||||
/*!
|
||||
\since 4.8
|
||||
|
||||
Sets the default cursor movement style to the given \a style.
|
||||
*/
|
||||
void QTextDocument::setDefaultCursorMoveStyle(Qt::CursorMoveStyle style)
|
||||
{
|
||||
Q_D(QTextDocument);
|
||||
d->defaultCursorMoveStyle = style;
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn void QTextDocument::markContentsDirty(int position, int length)
|
||||
|
||||
|
|
|
@ -225,9 +225,6 @@ public:
|
|||
QTextOption defaultTextOption() const;
|
||||
void setDefaultTextOption(const QTextOption &option);
|
||||
|
||||
Qt::CursorMoveStyle defaultCursorMoveStyle() const;
|
||||
void setDefaultCursorMoveStyle(Qt::CursorMoveStyle style);
|
||||
|
||||
Q_SIGNALS:
|
||||
void contentsChange(int from, int charsRemoves, int charsAdded);
|
||||
void contentsChanged();
|
||||
|
|
|
@ -182,7 +182,6 @@ QTextDocumentPrivate::QTextDocumentPrivate()
|
|||
|
||||
defaultTextOption.setTabStop(80); // same as in qtextengine.cpp
|
||||
defaultTextOption.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
|
||||
defaultCursorMoveStyle = Qt::LogicalMoveStyle;
|
||||
|
||||
indentWidth = 40;
|
||||
documentMargin = 4;
|
||||
|
@ -1354,20 +1353,6 @@ int QTextDocumentPrivate::previousCursorPosition(int position, QTextLayout::Curs
|
|||
return it.layout()->previousCursorPosition(position-start, mode) + start;
|
||||
}
|
||||
|
||||
int QTextDocumentPrivate::leftCursorPosition(int position) const
|
||||
{
|
||||
QTextBlock it = blocksFind(position);
|
||||
int start = it.position();
|
||||
return it.layout()->previousCursorPosition(position-start) + start;
|
||||
}
|
||||
|
||||
int QTextDocumentPrivate::rightCursorPosition(int position) const
|
||||
{
|
||||
QTextBlock it = blocksFind(position);
|
||||
int start = it.position();
|
||||
return it.layout()->nextCursorPosition(position-start) + start;
|
||||
}
|
||||
|
||||
void QTextDocumentPrivate::changeObjectFormat(QTextObject *obj, int format)
|
||||
{
|
||||
beginEditBlock();
|
||||
|
|
|
@ -223,8 +223,6 @@ public:
|
|||
|
||||
int nextCursorPosition(int position, QTextLayout::CursorMode mode) const;
|
||||
int previousCursorPosition(int position, QTextLayout::CursorMode mode) const;
|
||||
int leftCursorPosition(int position) const;
|
||||
int rightCursorPosition(int position) const;
|
||||
|
||||
void changeObjectFormat(QTextObject *group, int format);
|
||||
|
||||
|
@ -320,7 +318,6 @@ private:
|
|||
|
||||
public:
|
||||
QTextOption defaultTextOption;
|
||||
Qt::CursorMoveStyle defaultCursorMoveStyle;
|
||||
#ifndef QT_NO_CSSPARSER
|
||||
QCss::StyleSheet parsedDefaultStyleSheet;
|
||||
#endif
|
||||
|
|
|
@ -696,9 +696,9 @@ QTextHtmlImporter::ProcessNodeResult QTextHtmlImporter::processSpecialNodes()
|
|||
|
||||
cursor.insertImage(fmt, QTextFrameFormat::Position(currentNode->cssFloat));
|
||||
|
||||
cursor.movePosition(QTextCursor::Left, QTextCursor::KeepAnchor);
|
||||
cursor.movePosition(QTextCursor::PreviousCharacter, QTextCursor::KeepAnchor);
|
||||
cursor.mergeCharFormat(currentNode->charFormat);
|
||||
cursor.movePosition(QTextCursor::Right);
|
||||
cursor.movePosition(QTextCursor::NextCharacter);
|
||||
compressNextWhitespace = CollapseWhiteSpace;
|
||||
|
||||
hasBlock = false;
|
||||
|
|
|
@ -247,7 +247,6 @@ static void init(QTextEngine *e)
|
|||
{
|
||||
e->cacheGlyphs = false;
|
||||
e->forceJustification = false;
|
||||
e->visualMovement = false;
|
||||
|
||||
e->layoutData = 0;
|
||||
|
||||
|
|
|
@ -467,16 +467,10 @@ public:
|
|||
QPointF position;
|
||||
bool cacheGlyphs;
|
||||
bool forceJustification;
|
||||
bool visualMovement;
|
||||
|
||||
mutable LayoutData *layoutData;
|
||||
|
||||
inline bool hasFormats() const { return (block.docHandle() || specialData); }
|
||||
inline bool visualCursorMovement() const
|
||||
{
|
||||
return (visualMovement ||
|
||||
(block.docHandle() ? block.docHandle()->defaultCursorMoveStyle == Qt::VisualMoveStyle : false));
|
||||
}
|
||||
|
||||
struct SpecialData {
|
||||
int preeditPosition;
|
||||
|
|
|
@ -548,34 +548,6 @@ bool QTextLayout::cacheEnabled() const
|
|||
return d->cacheGlyphs;
|
||||
}
|
||||
|
||||
/*!
|
||||
\since 4.8
|
||||
|
||||
Set the cursor movement style. If the QTextLayout is backed by
|
||||
a document, you can ignore this and use the option in QTextDocument,
|
||||
this option is for widgets like QLineEdit or custom widgets without
|
||||
a QTextDocument. Default value is Qt::LogicalMoveStyle.
|
||||
|
||||
\sa cursorMoveStyle()
|
||||
*/
|
||||
void QTextLayout::setCursorMoveStyle(Qt::CursorMoveStyle style)
|
||||
{
|
||||
d->visualMovement = (style == Qt::VisualMoveStyle);
|
||||
}
|
||||
|
||||
/*!
|
||||
\since 4.8
|
||||
|
||||
The cursor movement style of this QTextLayout. The default is
|
||||
Qt::LogicalMoveStyle.
|
||||
|
||||
\sa setCursorMoveStyle()
|
||||
*/
|
||||
Qt::CursorMoveStyle QTextLayout::cursorMoveStyle() const
|
||||
{
|
||||
return d->visualMovement ? Qt::VisualMoveStyle : Qt::LogicalMoveStyle;
|
||||
}
|
||||
|
||||
/*!
|
||||
Begins the layout process.
|
||||
|
||||
|
@ -1150,13 +1122,7 @@ void QTextLayout::drawCursor(QPainter *p, const QPointF &pos, int cursorPosition
|
|||
|
||||
qreal x = position.x() + l.cursorToX(cursorPosition);
|
||||
|
||||
int itm;
|
||||
if (d->visualCursorMovement()) {
|
||||
if (cursorPosition == sl.from + sl.length)
|
||||
cursorPosition--;
|
||||
itm = d->findItem(cursorPosition);
|
||||
} else
|
||||
itm = d->findItem(cursorPosition - 1);
|
||||
int itm = d->findItem(cursorPosition - 1);
|
||||
|
||||
QFixed base = sl.base();
|
||||
QFixed descent = sl.descent;
|
||||
|
@ -2223,9 +2189,8 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const
|
|||
|
||||
x -= line.x;
|
||||
x -= eng->alignLine(line);
|
||||
// qDebug("xToCursor: x=%f, cpos=%d", x.toReal(), cpos);
|
||||
// qDebug("xToCursor: x=%f, cpos=%d", x.toReal(), cpos);
|
||||
|
||||
bool visual = eng->visualCursorMovement();
|
||||
if (x <= 0) {
|
||||
// left of first item
|
||||
int item = firstItem;
|
||||
|
@ -2246,7 +2211,7 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const
|
|||
int item = (i + firstItem);
|
||||
QScriptItem &si = eng->layoutData->items[item];
|
||||
int item_length = eng->length(item);
|
||||
// qDebug(" item %d, visual %d x_remain=%f", i, item, x.toReal());
|
||||
// qDebug(" item %d, visual %d x_remain=%f", i, item, x.toReal());
|
||||
|
||||
int start = qMax(line.from - si.position, 0);
|
||||
int end = qMin(line.from + line_length - si.position, item_length);
|
||||
|
@ -2267,13 +2232,13 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const
|
|||
++g;
|
||||
}
|
||||
}
|
||||
// qDebug(" start=%d, end=%d, gs=%d, ge=%d item_width=%f", start, end, gs, ge, item_width.toReal());
|
||||
// qDebug(" start=%d, end=%d, gs=%d, ge=%d item_width=%f", start, end, gs, ge, item_width.toReal());
|
||||
|
||||
if (pos + item_width < x) {
|
||||
pos += item_width;
|
||||
continue;
|
||||
}
|
||||
// qDebug(" inside run");
|
||||
// qDebug(" inside run");
|
||||
if (si.analysis.flags >= QScriptAnalysis::TabOrObject) {
|
||||
if (cpos == QTextLine::CursorOnCharacter)
|
||||
return si.position;
|
||||
|
@ -2311,11 +2276,6 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const
|
|||
++gs;
|
||||
}
|
||||
if (qAbs(x-pos) < dist) {
|
||||
if (visual) {
|
||||
if (i < nItems - 1) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return eng->positionInLigature(&si, end, x, pos, -1,
|
||||
cpos == QTextLine::CursorOnCharacter);
|
||||
}
|
||||
|
|
|
@ -108,9 +108,6 @@ public:
|
|||
void setCacheEnabled(bool enable);
|
||||
bool cacheEnabled() const;
|
||||
|
||||
void setCursorMoveStyle(Qt::CursorMoveStyle style);
|
||||
Qt::CursorMoveStyle cursorMoveStyle() const;
|
||||
|
||||
void beginLayout();
|
||||
void endLayout();
|
||||
void clearLayout();
|
||||
|
|
|
@ -1484,7 +1484,6 @@ void QLineControl::processKeyEvent(QKeyEvent* event)
|
|||
}
|
||||
|
||||
bool unknown = false;
|
||||
bool visual = cursorMoveStyle() == Qt::VisualMoveStyle;
|
||||
|
||||
if (false) {
|
||||
}
|
||||
|
@ -1549,11 +1548,11 @@ void QLineControl::processKeyEvent(QKeyEvent* event)
|
|||
#endif
|
||||
moveCursor(selectionEnd(), false);
|
||||
} else {
|
||||
cursorForward(0, visual ? 1 : (layoutDirection() == Qt::LeftToRight ? 1 : -1));
|
||||
cursorForward(0, (layoutDirection() == Qt::LeftToRight ? 1 : -1));
|
||||
}
|
||||
}
|
||||
else if (event == QKeySequence::SelectNextChar) {
|
||||
cursorForward(1, visual ? 1 : (layoutDirection() == Qt::LeftToRight ? 1 : -1));
|
||||
cursorForward(1, (layoutDirection() == Qt::LeftToRight ? 1 : -1));
|
||||
}
|
||||
else if (event == QKeySequence::MoveToPreviousChar) {
|
||||
#if defined(QT_NO_COMPLETER)
|
||||
|
@ -1564,11 +1563,11 @@ void QLineControl::processKeyEvent(QKeyEvent* event)
|
|||
#endif
|
||||
moveCursor(selectionStart(), false);
|
||||
} else {
|
||||
cursorForward(0, visual ? -1 : (layoutDirection() == Qt::LeftToRight ? -1 : 1));
|
||||
cursorForward(0, (layoutDirection() == Qt::LeftToRight ? -1 : 1));
|
||||
}
|
||||
}
|
||||
else if (event == QKeySequence::SelectPreviousChar) {
|
||||
cursorForward(1, visual ? -1 : (layoutDirection() == Qt::LeftToRight ? -1 : 1));
|
||||
cursorForward(1, (layoutDirection() == Qt::LeftToRight ? -1 : 1));
|
||||
}
|
||||
else if (event == QKeySequence::MoveToNextWord) {
|
||||
if (echoMode() == QLineEdit::Normal)
|
||||
|
|
|
@ -143,9 +143,6 @@ public:
|
|||
int cursorWidth() const { return m_cursorWidth; }
|
||||
void setCursorWidth(int value) { m_cursorWidth = value; }
|
||||
|
||||
Qt::CursorMoveStyle cursorMoveStyle() const { return m_textLayout.cursorMoveStyle(); }
|
||||
void setCursorMoveStyle(Qt::CursorMoveStyle style) { m_textLayout.setCursorMoveStyle(style); }
|
||||
|
||||
void moveCursor(int pos, bool mark = false);
|
||||
void cursorForward(bool mark, int steps)
|
||||
{
|
||||
|
|
|
@ -922,46 +922,6 @@ void QLineEdit::setDragEnabled(bool b)
|
|||
d->dragEnabled = b;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\property QLineEdit::cursorMoveStyle
|
||||
\brief the movement style of cursor in this line edit
|
||||
\since 4.8
|
||||
|
||||
When this property is set to Qt::VisualMoveStyle, the line edit will use visual
|
||||
movement style. Pressing the left arrow key will always cause the cursor to move
|
||||
left, regardless of the text's writing direction. The same behavior applies to
|
||||
right arrow key.
|
||||
|
||||
When the property is Qt::LogicalMoveStyle (the default), within a LTR text block,
|
||||
increase cursor position when pressing left arrow key, decrease cursor position
|
||||
when pressing the right arrow key. If the text block is right to left, the opposite
|
||||
behavior applies.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\since 4.8
|
||||
|
||||
Returns the movement style for the cursor in the line edit.
|
||||
*/
|
||||
Qt::CursorMoveStyle QLineEdit::cursorMoveStyle() const
|
||||
{
|
||||
Q_D(const QLineEdit);
|
||||
return d->control->cursorMoveStyle();
|
||||
}
|
||||
|
||||
/*!
|
||||
\since 4.8
|
||||
|
||||
Sets the movement style for the cursor in the line edit to the given
|
||||
\a style.
|
||||
*/
|
||||
void QLineEdit::setCursorMoveStyle(Qt::CursorMoveStyle style)
|
||||
{
|
||||
Q_D(QLineEdit);
|
||||
d->control->setCursorMoveStyle(style);
|
||||
}
|
||||
|
||||
/*!
|
||||
\property QLineEdit::acceptableInput
|
||||
\brief whether the input satisfies the inputMask and the
|
||||
|
|
|
@ -63,7 +63,6 @@ class Q_GUI_EXPORT QLineEdit : public QWidget
|
|||
Q_PROPERTY(bool redoAvailable READ isRedoAvailable)
|
||||
Q_PROPERTY(bool acceptableInput READ hasAcceptableInput)
|
||||
Q_PROPERTY(QString placeholderText READ placeholderText WRITE setPlaceholderText)
|
||||
Q_PROPERTY(Qt::CursorMoveStyle cursorMoveStyle READ cursorMoveStyle WRITE setCursorMoveStyle)
|
||||
|
||||
public:
|
||||
explicit QLineEdit(QWidget* parent = nullptr);
|
||||
|
@ -133,9 +132,6 @@ public:
|
|||
void setDragEnabled(bool b);
|
||||
bool dragEnabled() const;
|
||||
|
||||
void setCursorMoveStyle(Qt::CursorMoveStyle style);
|
||||
Qt::CursorMoveStyle cursorMoveStyle() const;
|
||||
|
||||
QString inputMask() const;
|
||||
void setInputMask(const QString &inputMask);
|
||||
bool hasAcceptableInput() const;
|
||||
|
|
|
@ -177,9 +177,9 @@ void tst_QTextCursor::navigation1()
|
|||
|
||||
QTextCursor otherCursor(doc);
|
||||
otherCursor.movePosition(QTextCursor::Start);
|
||||
otherCursor.movePosition(QTextCursor::Right);
|
||||
otherCursor.movePosition(QTextCursor::NextCharacter);
|
||||
cursor = otherCursor;
|
||||
cursor.movePosition(QTextCursor::Right);
|
||||
cursor.movePosition(QTextCursor::NextCharacter);
|
||||
QVERIFY(cursor != otherCursor);
|
||||
otherCursor.insertText("Hey");
|
||||
QVERIFY(cursor.position() == 5);
|
||||
|
@ -195,10 +195,10 @@ void tst_QTextCursor::navigation1()
|
|||
QVERIFY(doc->toPlainText() == "Hello World");
|
||||
|
||||
cursor.movePosition(QTextCursor::Start);
|
||||
cursor.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, 6);
|
||||
cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::MoveAnchor, 6);
|
||||
QVERIFY(cursor.position() == 6);
|
||||
otherCursor = cursor;
|
||||
otherCursor.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, 2);
|
||||
otherCursor.movePosition(QTextCursor::NextCharacter, QTextCursor::MoveAnchor, 2);
|
||||
otherCursor.deletePreviousChar();
|
||||
otherCursor.deletePreviousChar();
|
||||
otherCursor.deletePreviousChar();
|
||||
|
@ -744,7 +744,7 @@ void tst_QTextCursor::checkFrame1()
|
|||
QVERIFY(cursor.selectionStart() == 1);
|
||||
QVERIFY(cursor.selectionEnd() == 1);
|
||||
|
||||
// cursor.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor);
|
||||
// cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor);
|
||||
// QVERIFY(cursor.position() == 2);
|
||||
// QVERIFY(cursor.selectionStart() == 0);
|
||||
// QVERIFY(cursor.selectionEnd() == 2);
|
||||
|
@ -792,7 +792,7 @@ void tst_QTextCursor::checkFrame2()
|
|||
QVERIFY(cursor.selectionStart() == 1);
|
||||
QVERIFY(cursor.selectionEnd() == 2);
|
||||
|
||||
cursor.movePosition(QTextCursor::Left, QTextCursor::KeepAnchor);
|
||||
cursor.movePosition(QTextCursor::PreviousCharacter, QTextCursor::KeepAnchor);
|
||||
QVERIFY(cursor.position() == 0);
|
||||
QVERIFY(cursor.selectionStart() == 0);
|
||||
QVERIFY(cursor.selectionEnd() == 3);
|
||||
|
@ -823,7 +823,7 @@ void tst_QTextCursor::tableMovement()
|
|||
QVERIFY(cursor.position() == 0);
|
||||
cursor.insertText("AA");
|
||||
QVERIFY(cursor.position() == 2);
|
||||
cursor.movePosition(QTextCursor::Left);
|
||||
cursor.movePosition(QTextCursor::PreviousCharacter);
|
||||
|
||||
cursor.insertTable(3, 3);
|
||||
QCOMPARE(cursor.position(), 2);
|
||||
|
@ -831,16 +831,16 @@ void tst_QTextCursor::tableMovement()
|
|||
cursor.movePosition(QTextCursor::Down);
|
||||
QCOMPARE(cursor.position(), 5);
|
||||
|
||||
cursor.movePosition(QTextCursor::Right);
|
||||
cursor.movePosition(QTextCursor::NextCharacter);
|
||||
QCOMPARE(cursor.position(), 6);
|
||||
|
||||
cursor.movePosition(QTextCursor::Up);
|
||||
QCOMPARE(cursor.position(), 3);
|
||||
|
||||
cursor.movePosition(QTextCursor::Right);
|
||||
cursor.movePosition(QTextCursor::NextCharacter);
|
||||
QCOMPARE(cursor.position(), 4);
|
||||
|
||||
cursor.movePosition(QTextCursor::Right);
|
||||
cursor.movePosition(QTextCursor::NextCharacter);
|
||||
QCOMPARE(cursor.position(), 5);
|
||||
|
||||
cursor.movePosition(QTextCursor::Up);
|
||||
|
@ -1133,8 +1133,8 @@ void tst_QTextCursor::blockCharFormatOnSelection()
|
|||
cursor.movePosition(QTextCursor::NextBlock);
|
||||
QVERIFY(cursor.blockCharFormat().foreground().color() == Qt::cyan);
|
||||
|
||||
cursor.movePosition(QTextCursor::Right);
|
||||
cursor.movePosition(QTextCursor::Right);
|
||||
cursor.movePosition(QTextCursor::NextCharacter);
|
||||
cursor.movePosition(QTextCursor::NextCharacter);
|
||||
QVERIFY(cursor.charFormat().foreground().color() == Qt::green);
|
||||
|
||||
cursor.movePosition(QTextCursor::NextBlock);
|
||||
|
|
Loading…
Add table
Reference in a new issue