Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.15.7, 6.2.1
-
None
-
41c35b04d5ebddb4738df984bfdfee2dcd075e64 (qt/qtdeclarative/dev)
Description
import QtQuick 2.0 Rectangle { width: 200 height: 40 TextInput { cursorDelegate: Rectangle { border.color: "red"; color: "lightsteelblue"; opacity: 0.5; width: 10 } anchors.centerIn: parent text: "some text" width: 0 clip: true focus: true } }
You'll only see a 1-pixel line, because clipRect() is called too early before the cursorItem gets instantiated, so TextInput pads it by only one pixel:
QRectF QQuickTextInput::clipRect() const { Q_D(const QQuickTextInput); int cursorWidth = d->cursorItem ? d->cursorItem->width() : 1; // Could include font max left/right bearings to either side of rectangle. QRectF r = QQuickImplicitSizeItem::clipRect(); r.setRight(r.right() + cursorWidth); qDebug() << "cursor" << d->cursorItem << "w" << cursorWidth << "clip would be" << QQuickImplicitSizeItem::clipRect() << "now" << r;; return r; }
Attachments
Issue Links
- relates to
-
QTBUG-35646 Setting clip property true on TextInput hides cursor on an empty input.
- Closed
For Gerrit Dashboard: QTBUG-98140 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
380660,5 | Update TextInput after cursorDelegate instantiated, if clipped | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |