Remove dead code from QQuickTextControl.
authorAndrew den Exter <andrew.den-exter@nokia.com>
Wed, 27 Jun 2012 06:37:17 +0000 (16:37 +1000)
committerQt by Nokia <qt-info@nokia.com>
Wed, 4 Jul 2012 01:27:34 +0000 (03:27 +0200)
Either unused functions, or code paths for signals that aren't
connected to anything.

Change-Id: Ide24f1263d05f93917a16a3c17cb06a619cd3421
Reviewed-by: Martin Jones <martin.jones@nokia.com>
src/quick/items/qquicktextcontrol.cpp
src/quick/items/qquicktextcontrol_p.h
src/quick/items/qquicktextcontrol_p_p.h

index b390679..e7b8873 100644 (file)
@@ -108,7 +108,6 @@ QQuickTextControlPrivate::QQuickTextControlPrivate()
       acceptRichText(true),
       cursorVisible(false),
       hasFocus(false),
-      isEnabled(true),
       hadSelectionOnMousePress(false),
       wordSelectionEnabled(false),
       hasImState(false),
@@ -737,10 +736,6 @@ void QQuickTextControl::processEvent(QEvent *e, const QMatrix &matrix)
             d->focusEvent(static_cast<QFocusEvent *>(e));
             break;
 
-        case QEvent::EnabledChange:
-            d->isEnabled = e->isAccepted();
-            break;
-
         case QEvent::ShortcutOverride:
             if (d->interactionFlags & Qt::TextEditable) {
                 QKeyEvent* ke = static_cast<QKeyEvent *>(e);
@@ -808,11 +803,6 @@ void QQuickTextControl::timerEvent(QTimerEvent *e)
     if (e->timerId() == d->cursorBlinkTimer.timerId()) {
         d->cursorOn = !d->cursorOn;
 
-        // ###
-//        if (d->cursor.hasSelection())
-//            d->cursorOn &= (QGuiApplication::style()->styleHint(QStyle::SH_BlinkCursorWhenTextSelected)
-//                            != 0);
-
         d->repaintCursor();
     } else if (e->timerId() == d->trippleClickTimer.timerId()) {
         d->trippleClickTimer.stop();
@@ -1058,47 +1048,6 @@ QRectF QQuickTextControl::selectionRect(const QTextCursor &cursor) const
         QTextTable *table = cursor.currentTable();
 
         r = d->doc->documentLayout()->frameBoundingRect(table);
-        /*
-        int firstRow, numRows, firstColumn, numColumns;
-        cursor.selectedTableCells(&firstRow, &numRows, &firstColumn, &numColumns);
-
-        const QTextTableCell firstCell = table->cellAt(firstRow, firstColumn);
-        const QTextTableCell lastCell = table->cellAt(firstRow + numRows - 1, firstColumn + numColumns - 1);
-
-        const QAbstractTextDocumentLayout * const layout = doc->documentLayout();
-
-        QRectF tableSelRect = layout->blockBoundingRect(firstCell.firstCursorPosition().block());
-
-        for (int col = firstColumn; col < firstColumn + numColumns; ++col) {
-            const QTextTableCell cell = table->cellAt(firstRow, col);
-            const qreal y = layout->blockBoundingRect(cell.firstCursorPosition().block()).top();
-
-            tableSelRect.setTop(qMin(tableSelRect.top(), y));
-        }
-
-        for (int row = firstRow; row < firstRow + numRows; ++row) {
-            const QTextTableCell cell = table->cellAt(row, firstColumn);
-            const qreal x = layout->blockBoundingRect(cell.firstCursorPosition().block()).left();
-
-            tableSelRect.setLeft(qMin(tableSelRect.left(), x));
-        }
-
-        for (int col = firstColumn; col < firstColumn + numColumns; ++col) {
-            const QTextTableCell cell = table->cellAt(firstRow + numRows - 1, col);
-            const qreal y = layout->blockBoundingRect(cell.lastCursorPosition().block()).bottom();
-
-            tableSelRect.setBottom(qMax(tableSelRect.bottom(), y));
-        }
-
-        for (int row = firstRow; row < firstRow + numRows; ++row) {
-            const QTextTableCell cell = table->cellAt(row, firstColumn + numColumns - 1);
-            const qreal x = layout->blockBoundingRect(cell.lastCursorPosition().block()).right();
-
-            tableSelRect.setRight(qMax(tableSelRect.right(), x));
-        }
-
-        r = tableSelRect.toRect();
-        */
     } else if (cursor.hasSelection()) {
         const int position = cursor.selectionStart();
         const int anchor = cursor.selectionEnd();
@@ -1223,14 +1172,6 @@ void QQuickTextControlPrivate::mouseMoveEvent(QMouseEvent *e, const QPointF &mou
 {
     Q_Q(QQuickTextControl);
 
-    if (interactionFlags & Qt::LinksAccessibleByMouse) {
-        QString anchor = q->anchorAt(mousePos);
-        if (anchor != highlightedAnchor) {
-            highlightedAnchor = anchor;
-            emit q->linkHovered(anchor);
-        }
-    }
-
     if ((e->buttons() & Qt::LeftButton)) {
         const bool editable = interactionFlags & Qt::TextEditable;
 
@@ -1548,17 +1489,6 @@ void QQuickTextControl::setCursorVisible(bool visible)
             && (d->interactionFlags & (Qt::TextEditable | Qt::TextSelectableByKeyboard)));
 }
 
-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);
index 57c26a1..b1871b7 100644 (file)
@@ -100,7 +100,6 @@ public:
     bool hasImState() const;
     bool cursorVisible() const;
     void setCursorVisible(bool visible);
-    QTextCursor cursorForPosition(const QPointF &pos) const;
     QRectF cursorRect(const QTextCursor &cursor) const;
     QRectF cursorRect() const;
     QRectF selectionRect(const QTextCursor &cursor) const;
@@ -154,7 +153,6 @@ Q_SIGNALS:
     void documentSizeChanged(const QSizeF &);
     void cursorRectangleChanged();
     void linkActivated(const QString &link);
-    void linkHovered(const QString &);
 
 public:
     virtual void processEvent(QEvent *e, const QMatrix &matrix);
index f39bf67..cf60dd9 100644 (file)
@@ -138,7 +138,6 @@ public:
     QTextCursor cursor;
     QTextCursor selectedWordOnDoubleClick;
     QTextCursor selectedBlockOnTrippleClick;
-    QString highlightedAnchor; // Anchor below cursor
     QString anchorOnMousePress;
     QString linkToCopy;
 
@@ -158,7 +157,6 @@ public:
     bool acceptRichText : 1;
     bool cursorVisible : 1; // used to hide the cursor in the preedit area
     bool hasFocus : 1;
-    bool isEnabled : 1;
     bool hadSelectionOnMousePress : 1;
     bool wordSelectionEnabled : 1;
     bool hasImState : 1;