mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-23 18:32:55 +00:00
remove unused QTextControl feature
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
79236242c8
commit
e4ee53e73d
3 changed files with 2 additions and 36 deletions
|
@ -103,10 +103,10 @@ QTextControlPrivate::QTextControlPrivate()
|
||||||
hasFocus(false),
|
hasFocus(false),
|
||||||
isEnabled(true),
|
isEnabled(true),
|
||||||
hadSelectionOnMousePress(false),
|
hadSelectionOnMousePress(false),
|
||||||
ignoreUnusedNavigationEvents(false),
|
|
||||||
openExternalLinks(false),
|
openExternalLinks(false),
|
||||||
wordSelectionEnabled(false)
|
wordSelectionEnabled(false)
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
bool QTextControlPrivate::cursorMoveKeyEvent(QKeyEvent *e)
|
bool QTextControlPrivate::cursorMoveKeyEvent(QKeyEvent *e)
|
||||||
{
|
{
|
||||||
|
@ -227,32 +227,15 @@ bool QTextControlPrivate::cursorMoveKeyEvent(QKeyEvent *e)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Except for pageup and pagedown, Mac OS X has very different behavior, we don't do it all, but
|
|
||||||
// here's the breakdown:
|
|
||||||
// Shift still works as an anchor, but only one of the other keys can be down Ctrl (Command),
|
|
||||||
// Alt (Option), or Meta (Control).
|
|
||||||
// Command/Control + Left/Right -- Move to left or right of the line
|
|
||||||
// + Up/Down -- Move to top bottom of the file. (Control doesn't move the cursor)
|
|
||||||
// Option + Left/Right -- Move one word Left/right.
|
|
||||||
// + Up/Down -- Begin/End of Paragraph.
|
|
||||||
// Home/End Top/Bottom of file. (usually don't move the cursor, but will select)
|
|
||||||
|
|
||||||
bool visualNavigation = cursor.visualNavigation();
|
bool visualNavigation = cursor.visualNavigation();
|
||||||
cursor.setVisualNavigation(true);
|
cursor.setVisualNavigation(true);
|
||||||
const bool moved = cursor.movePosition(op, mode);
|
const bool moved = cursor.movePosition(op, mode);
|
||||||
cursor.setVisualNavigation(visualNavigation);
|
cursor.setVisualNavigation(visualNavigation);
|
||||||
q->ensureCursorVisible();
|
q->ensureCursorVisible();
|
||||||
|
|
||||||
bool ignoreNavigationEvents = ignoreUnusedNavigationEvents;
|
|
||||||
bool isNavigationEvent = e->key() == Qt::Key_Up || e->key() == Qt::Key_Down;
|
|
||||||
|
|
||||||
isNavigationEvent = isNavigationEvent || e->key() == Qt::Key_Left || e->key() == Qt::Key_Right;
|
|
||||||
|
|
||||||
if (moved) {
|
if (moved) {
|
||||||
if (cursor.position() != oldCursorPos)
|
if (cursor.position() != oldCursorPos)
|
||||||
emit q->cursorPositionChanged();
|
emit q->cursorPositionChanged();
|
||||||
} else if (ignoreNavigationEvents && isNavigationEvent && oldSelection.anchor() == cursor.anchor()) {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
selectionChanged(/*forceEmitSelectionChanged =*/(mode == QTextCursor::KeepAnchor));
|
selectionChanged(/*forceEmitSelectionChanged =*/(mode == QTextCursor::KeepAnchor));
|
||||||
|
@ -2080,18 +2063,6 @@ bool QTextControl::openExternalLinks() const
|
||||||
return d->openExternalLinks;
|
return d->openExternalLinks;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QTextControl::ignoreUnusedNavigationEvents() const
|
|
||||||
{
|
|
||||||
Q_D(const QTextControl);
|
|
||||||
return d->ignoreUnusedNavigationEvents;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QTextControl::setIgnoreUnusedNavigationEvents(bool ignore)
|
|
||||||
{
|
|
||||||
Q_D(QTextControl);
|
|
||||||
d->ignoreUnusedNavigationEvents = ignore;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QTextControl::moveCursor(QTextCursor::MoveOperation op, QTextCursor::MoveMode mode)
|
void QTextControl::moveCursor(QTextCursor::MoveOperation op, QTextCursor::MoveMode mode)
|
||||||
{
|
{
|
||||||
Q_D(QTextControl);
|
Q_D(QTextControl);
|
||||||
|
|
|
@ -66,7 +66,6 @@ class Q_GUI_EXPORT QTextControl : public QObject
|
||||||
Q_PROPERTY(int cursorWidth READ cursorWidth WRITE setCursorWidth)
|
Q_PROPERTY(int cursorWidth READ cursorWidth WRITE setCursorWidth)
|
||||||
Q_PROPERTY(Qt::TextInteractionFlags textInteractionFlags READ textInteractionFlags WRITE setTextInteractionFlags)
|
Q_PROPERTY(Qt::TextInteractionFlags textInteractionFlags READ textInteractionFlags WRITE setTextInteractionFlags)
|
||||||
Q_PROPERTY(bool openExternalLinks READ openExternalLinks WRITE setOpenExternalLinks)
|
Q_PROPERTY(bool openExternalLinks READ openExternalLinks WRITE setOpenExternalLinks)
|
||||||
Q_PROPERTY(bool ignoreUnusedNavigationEvents READ ignoreUnusedNavigationEvents WRITE setIgnoreUnusedNavigationEvents)
|
|
||||||
public:
|
public:
|
||||||
explicit QTextControl(QObject *parent = nullptr);
|
explicit QTextControl(QObject *parent = nullptr);
|
||||||
explicit QTextControl(const QString &text, QObject *parent = nullptr);
|
explicit QTextControl(const QString &text, QObject *parent = nullptr);
|
||||||
|
@ -135,9 +134,6 @@ public:
|
||||||
void setOpenExternalLinks(bool open);
|
void setOpenExternalLinks(bool open);
|
||||||
bool openExternalLinks() const;
|
bool openExternalLinks() const;
|
||||||
|
|
||||||
void setIgnoreUnusedNavigationEvents(bool ignore);
|
|
||||||
bool ignoreUnusedNavigationEvents() const;
|
|
||||||
|
|
||||||
void moveCursor(QTextCursor::MoveOperation op, QTextCursor::MoveMode mode = QTextCursor::MoveAnchor);
|
void moveCursor(QTextCursor::MoveOperation op, QTextCursor::MoveMode mode = QTextCursor::MoveAnchor);
|
||||||
|
|
||||||
bool canPaste() const;
|
bool canPaste() const;
|
||||||
|
|
|
@ -182,7 +182,6 @@ public:
|
||||||
QString anchorOnMousePress;
|
QString anchorOnMousePress;
|
||||||
bool hadSelectionOnMousePress;
|
bool hadSelectionOnMousePress;
|
||||||
|
|
||||||
bool ignoreUnusedNavigationEvents;
|
|
||||||
bool openExternalLinks;
|
bool openExternalLinks;
|
||||||
|
|
||||||
bool wordSelectionEnabled;
|
bool wordSelectionEnabled;
|
||||||
|
|
Loading…
Add table
Reference in a new issue