From 0f1be99881883b28a80f0e5f276ea3bb544a9611 Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Mon, 12 Mar 2012 12:49:01 +1000 Subject: [PATCH] Remove unused functions from QQuickTextControl. Change-Id: I036a2c2ff05cd94a7c58e29bf8743fef3a550fbd Reviewed-by: Yann Bodson --- src/quick/items/qquicktextcontrol.cpp | 100 -------------------------------- src/quick/items/qquicktextcontrol_p.h | 23 -------- src/quick/items/qquicktextcontrol_p_p.h | 4 -- 3 files changed, 127 deletions(-) diff --git a/src/quick/items/qquicktextcontrol.cpp b/src/quick/items/qquicktextcontrol.cpp index 9a61312..53d736e 100644 --- a/src/quick/items/qquicktextcontrol.cpp +++ b/src/quick/items/qquicktextcontrol.cpp @@ -594,13 +594,6 @@ void QQuickTextControlPrivate::extendBlockwiseSelection(int suggestedNewPosition } } -void QQuickTextControlPrivate::_q_deleteSelected() -{ - if (!(interactionFlags & Qt::TextEditable) || !cursor.hasSelection()) - return; - cursor.removeSelectedText(); -} - void QQuickTextControl::undo() { Q_D(QQuickTextControl); @@ -690,14 +683,6 @@ void QQuickTextControl::paste(QClipboard::Mode mode) } #endif -void QQuickTextControl::clear() -{ - Q_D(QQuickTextControl); - // clears and sets empty content - d->setContent(); -} - - void QQuickTextControl::selectAll() { Q_D(QQuickTextControl); @@ -1527,13 +1512,6 @@ QVariant QQuickTextControl::inputMethodQuery(Qt::InputMethodQuery property) cons } } -void QQuickTextControl::setFocus(bool focus, Qt::FocusReason reason) -{ - QFocusEvent ev(focus ? QEvent::FocusIn : QEvent::FocusOut, - reason); - processEvent(&ev); -} - void QQuickTextControlPrivate::focusEvent(QFocusEvent *e) { Q_Q(QQuickTextControl); @@ -1555,31 +1533,6 @@ void QQuickTextControlPrivate::focusEvent(QFocusEvent *e) } } -QString QQuickTextControlPrivate::anchorForCursor(const QTextCursor &anchorCursor) const -{ - if (anchorCursor.hasSelection()) { - QTextCursor cursor = anchorCursor; - if (cursor.selectionStart() != cursor.position()) - cursor.setPosition(cursor.selectionStart()); - cursor.movePosition(QTextCursor::NextCharacter); - QTextCharFormat fmt = cursor.charFormat(); - if (fmt.isAnchor() && fmt.hasProperty(QTextFormat::AnchorHref)) - return fmt.stringProperty(QTextFormat::AnchorHref); - } - return QString(); -} - -QTextCursor QQuickTextControl::cursorForPosition(const QPointF &pos) const -{ - Q_D(const QQuickTextControl); - int cursorPos = hitTest(pos, Qt::FuzzyHit); - if (cursorPos == -1) - cursorPos = 0; - QTextCursor c(d->doc); - c.setPosition(cursorPos); - return c; -} - QRectF QQuickTextControl::cursorRect(const QTextCursor &cursor) const { Q_D(const QQuickTextControl); @@ -1609,23 +1562,6 @@ QString QQuickTextControl::anchorAt(const QPointF &pos) const return d->doc->documentLayout()->anchorAt(pos); } -QString QQuickTextControl::anchorAtCursor() const -{ - Q_D(const QQuickTextControl); - - return d->anchorForCursor(d->cursor); -} - -int QQuickTextControl::cursorWidth() const -{ -#ifndef QT_NO_PROPERTIES - Q_D(const QQuickTextControl); - return d->doc->documentLayout()->property("cursorWidth").toInt(); -#else - return 1; -#endif -} - void QQuickTextControl::setCursorWidth(int width) { Q_D(QQuickTextControl); @@ -1639,36 +1575,12 @@ void QQuickTextControl::setCursorWidth(int width) d->repaintCursor(); } -bool QQuickTextControl::acceptRichText() const -{ - Q_D(const QQuickTextControl); - return d->acceptRichText; -} - void QQuickTextControl::setAcceptRichText(bool accept) { Q_D(QQuickTextControl); d->acceptRichText = accept; } -void QQuickTextControl::setTextWidth(qreal width) -{ - Q_D(QQuickTextControl); - d->doc->setTextWidth(width); -} - -qreal QQuickTextControl::textWidth() const -{ - Q_D(const QQuickTextControl); - return d->doc->textWidth(); -} - -QSizeF QQuickTextControl::size() const -{ - Q_D(const QQuickTextControl); - return d->doc->size(); -} - void QQuickTextControl::moveCursor(QTextCursor::MoveOperation op, QTextCursor::MoveMode mode) { Q_D(QQuickTextControl); @@ -1700,24 +1612,12 @@ void QQuickTextControl::setCursorIsFocusIndicator(bool b) d->repaintCursor(); } -bool QQuickTextControl::cursorIsFocusIndicator() const -{ - Q_D(const QQuickTextControl); - return d->cursorIsFocusIndicator; -} - void QQuickTextControl::setWordSelectionEnabled(bool enabled) { Q_D(QQuickTextControl); d->wordSelectionEnabled = enabled; } -bool QQuickTextControl::isWordSelectionEnabled() const -{ - Q_D(const QQuickTextControl); - return d->wordSelectionEnabled; -} - QMimeData *QQuickTextControl::createMimeDataFromSelection() const { Q_D(const QQuickTextControl); diff --git a/src/quick/items/qquicktextcontrol_p.h b/src/quick/items/qquicktextcontrol_p.h index 97ecdc4..9e3fc90 100644 --- a/src/quick/items/qquicktextcontrol_p.h +++ b/src/quick/items/qquicktextcontrol_p.h @@ -80,12 +80,6 @@ class Q_AUTOTEST_EXPORT QQuickTextControl : public QObject { Q_OBJECT Q_DECLARE_PRIVATE(QQuickTextControl) -#ifndef QT_NO_TEXTHTMLPARSER - Q_PROPERTY(QString html READ toHtml WRITE setHtml NOTIFY textChanged USER true) -#endif - Q_PROPERTY(bool acceptRichText READ acceptRichText WRITE setAcceptRichText) - Q_PROPERTY(int cursorWidth READ cursorWidth WRITE setCursorWidth) - Q_PROPERTY(Qt::TextInteractionFlags textInteractionFlags READ textInteractionFlags WRITE setTextInteractionFlags) public: explicit QQuickTextControl(QTextDocument *doc, QObject *parent = 0); virtual ~QQuickTextControl(); @@ -104,7 +98,6 @@ public: QString toHtml() const; #endif - QTextCursor cursorForPosition(const QPointF &pos) const; QRectF cursorRect(const QTextCursor &cursor) const; QRectF cursorRect() const; QRectF selectionRect(const QTextCursor &cursor) const; @@ -112,26 +105,15 @@ public: QString anchorAt(const QPointF &pos) const; - QString anchorAtCursor() const; - - int cursorWidth() const; void setCursorWidth(int width); - bool acceptRichText() const; void setAcceptRichText(bool accept); - void setTextWidth(qreal width); - qreal textWidth() const; - QSizeF size() const; - void moveCursor(QTextCursor::MoveOperation op, QTextCursor::MoveMode mode = QTextCursor::MoveAnchor); bool canPaste() const; void setCursorIsFocusIndicator(bool b); - bool cursorIsFocusIndicator() const; - - bool isWordSelectionEnabled() const; void setWordSelectionEnabled(bool enabled); virtual int hitTest(const QPointF &point, Qt::HitTestAccuracy accuracy) const; @@ -151,7 +133,6 @@ public Q_SLOTS: void undo(); void redo(); - void clear(); void selectAll(); Q_SIGNALS: @@ -175,9 +156,6 @@ public: virtual void processEvent(QEvent *e, const QMatrix &matrix); void processEvent(QEvent *e, const QPointF &coordinateOffset = QPointF()); - // control methods - void setFocus(bool focus, Qt::FocusReason = Qt::OtherFocusReason); - virtual QVariant inputMethodQuery(Qt::InputMethodQuery property) const; virtual QMimeData *createMimeDataFromSelection() const; @@ -195,7 +173,6 @@ private: Q_DISABLE_COPY(QQuickTextControl) Q_PRIVATE_SLOT(d_func(), void _q_updateCurrentCharFormatAndSelection()) Q_PRIVATE_SLOT(d_func(), void _q_emitCursorPosChanged(const QTextCursor &)) - Q_PRIVATE_SLOT(d_func(), void _q_deleteSelected()) Q_PRIVATE_SLOT(d_func(), void _q_updateBlock(const QTextBlock &)) Q_PRIVATE_SLOT(d_func(), void _q_documentLayoutChanged()) }; diff --git a/src/quick/items/qquicktextcontrol_p_p.h b/src/quick/items/qquicktextcontrol_p_p.h index 44bc002..9d776ce 100644 --- a/src/quick/items/qquicktextcontrol_p_p.h +++ b/src/quick/items/qquicktextcontrol_p_p.h @@ -106,8 +106,6 @@ public: void extendWordwiseSelection(int suggestedNewPosition, qreal mouseXPosition); void extendBlockwiseSelection(int suggestedNewPosition); - void _q_deleteSelected(); - void _q_setCursorAfterUndoRedo(int undoPosition, int charsAdded, int charsRemoved); QRectF cursorRectPlusUnicodeDirectionMarkers(const QTextCursor &cursor) const; @@ -116,8 +114,6 @@ public: inline QRectF selectionRect() const { return selectionRect(this->cursor); } - QString anchorForCursor(const QTextCursor &anchor) const; - void keyPressEvent(QKeyEvent *e); void mousePressEvent(QMouseEvent *event, const QPointF &pos); void mouseMoveEvent(QMouseEvent *event, const QPointF &pos); -- 2.7.4