Qt 4.8
Public Functions | Static Public Functions | Public Variables | List of all members
QDeclarativeTextInputPrivate Class Reference

#include <qdeclarativetextinput_p_p.h>

Inheritance diagram for QDeclarativeTextInputPrivate:
QDeclarativeImplicitSizePaintedItemPrivate QDeclarativePaintedItemPrivate QDeclarativeItemPrivate QGraphicsItemPrivate

Public Functions

int calculateTextWidth ()
 
bool determineHorizontalAlignment ()
 
void focusChanged (bool hasFocus)
 
void init ()
 
void mirrorChange ()
 
 QDeclarativeTextInputPrivate ()
 
bool sendMouseEventToInputContext (QGraphicsSceneMouseEvent *event, QEvent::Type eventType)
 
bool setHAlign (QDeclarativeTextInput::HAlignment, bool forceAlign=false)
 
void startCreatingCursor ()
 
void updateHorizontalScroll ()
 
void updateInputMethodHints ()
 This handler is called when the Return or Enter key is pressed. More...
 
int xToPos (int x, QTextLine::CursorPosition betweenOrOn=QTextLine::CursorBetweenCharacters) const
 
 ~QDeclarativeTextInputPrivate ()
 
- Public Functions inherited from QDeclarativeImplicitSizePaintedItemPrivate
virtual void implicitHeightChanged ()
 
virtual void implicitWidthChanged ()
 
 QDeclarativeImplicitSizePaintedItemPrivate ()
 
- Public Functions inherited from QDeclarativePaintedItemPrivate
 QDeclarativePaintedItemPrivate ()
 
- Public Functions inherited from QDeclarativeItemPrivate
QDeclarativeStateGroup_states ()
 
void addItemChangeListener (QDeclarativeItemChangeListener *listener, ChangeTypes types)
 
AnchorLinesanchorLines () const
 
QDeclarativeAnchorsanchors ()
 
QDeclarativeAnchorLine baseline () const
 
QDeclarativeAnchorLine bottom () const
 
QPointF computeTransformOrigin () const
 
QDeclarativeListProperty< QObjectdata ()
 
virtual void focusScopeItemChange (bool isSubFocusItem)
 Subclasses can reimplement this function to be notified when an item becomes a focusScopeItem (or is no longer a focusScopeItem). More...
 
qreal height () const
 
QDeclarativeAnchorLine horizontalCenter () const
 
virtual qreal implicitHeight () const
 
virtual qreal implicitWidth () const
 
void init (QDeclarativeItem *parent)
 
bool isMirrored () const
 
QDeclarativeAnchorLine left () const
 
 QDeclarativeItemPrivate ()
 
void removeItemChangeListener (QDeclarativeItemChangeListener *, ChangeTypes types)
 
void resetHeight ()
 
void resetWidth ()
 
void resolveLayoutMirror ()
 
QDeclarativeListProperty< QObjectresources ()
 
QDeclarativeAnchorLine right () const
 
void setHeight (qreal)
 
void setImplicitLayoutMirror (bool mirror, bool inherit)
 
void setLayoutMirror (bool mirror)
 
virtual void setPosHelper (const QPointF &pos)
 Sets the position pos. More...
 
void setState (const QString &)
 
void setWidth (qreal)
 
virtual void siblingOrderChange ()
 Subclasses can reimplement this function to be notified when its siblingIndex order is changed. More...
 
QString state () const
 
QDeclarativeListProperty< QDeclarativeStatestates ()
 
QDeclarativeAnchorLine top () const
 
virtual void transformChanged ()
 
QDeclarativeListProperty< QDeclarativeTransitiontransitions ()
 
QDeclarativeAnchorLine verticalCenter () const
 
qreal width () const
 
- Public Functions inherited from QGraphicsItemPrivate
void addChild (QGraphicsItem *child)
 QGraphicsScenePrivate::registerTopLevelItem(). More...
 
void appendGraphicsTransform (QGraphicsTransform *t)
 
qreal calcEffectiveOpacity () const
 
void childrenBoundingRectHelper (QTransform *x, QRectF *rect, QGraphicsItem *topMostEffectItem)
 Returns the bounding rect of this item's children (excluding itself). More...
 
bool childrenClippedToShape () const
 
bool childrenCombineOpacity () const
 
QDeclarativeListProperty< QGraphicsObjectchildrenList ()
 Returns a list of this item's children. More...
 
void clearFocusHelper (bool giveFocusToParent)
 
void clearSubFocus (QGraphicsItem *rootItem=0, QGraphicsItem *stopItem=0)
 
qreal combineOpacityFromParent (qreal parentOpacity) const
 
void combineTransformFromParent (QTransform *x, const QTransform *viewTransform=0) const
 Combines this item's position and transform onto transform. More...
 
void combineTransformToParent (QTransform *x, const QTransform *viewTransform=0) const
 Combines this item's position and transform onto transform. More...
 
int depth () const
 
bool discardUpdateRequest (bool ignoreVisibleBit=false, bool ignoreDirtyBit=false, bool ignoreOpacity=false) const
 Returns true if we can discard an update request; otherwise false. More...
 
QRectF effectiveBoundingRect (QGraphicsItem *topMostEffectItem=0) const
 Returns the effective bounding rect of the item. More...
 
QRectF effectiveBoundingRect (const QRectF &rect) const
 Returns the effective bounding rect of the given item space rect. More...
 
qreal effectiveOpacity () const
 
void ensureSceneTransform ()
 
void ensureSceneTransformRecursive (QGraphicsItem **topMostDirtyItem)
 
void ensureSequentialSiblingIndex ()
 Ensures that the list of children is sorted by insertion order, and that the siblingIndexes are packed (no gaps), and start at 0. More...
 
void ensureSortedChildren ()
 
QVariant extra (Extra type) const
 
QGraphicsItemCacheextraItemCache () const
 
QPointF genericMapFromScene (const QPointF &pos, const QWidget *viewport) const
 Maps the point pos from scene to item coordinates. More...
 
bool hasTranslateOnlySceneTransform ()
 
void initStyleOption (QStyleOptionGraphicsItem *option, const QTransform &worldTransform, const QRegion &exposedRegion, bool allItems=false) const
 
virtual QVariant inputMethodQueryHelper (Qt::InputMethodQuery query) const
 This helper function helped us add input method query support in Qt 4. More...
 
void invalidateChildGraphicsEffectsRecursively (InvalidateReason reason)
 
void invalidateChildrenSceneTransform ()
 
void invalidateDepthRecursively ()
 
void invalidateParentGraphicsEffectsRecursively ()
 
bool isFullyTransparent () const
 
bool isInvisible () const
 
bool isOpacityNull () const
 
virtual bool isProxyWidget () const
 
bool itemIsUntransformable () const
 
void markParentDirty (bool updateBoundingRect=false)
 
QGraphicsItemCachemaybeExtraItemCache () const
 
void prependGraphicsTransform (QGraphicsTransform *t)
 
 QGraphicsItemPrivate ()
 
void remapItemPos (QEvent *event, QGraphicsItem *item)
 Maps any item pos properties of event to item's coordinate system. More...
 
void removeChild (QGraphicsItem *child)
 QGraphicsScenePrivate::unregisterTopLevelItem(). More...
 
void removeExtraItemCache ()
 
void resetFocusProxy ()
 Sets the focusProxy pointer to 0 for all items that have this item as their focusProxy. More...
 
void resolveDepth ()
 Resolves the stacking depth of this object and all its ancestors. More...
 
virtual void resolveFont (uint inheritedMask)
 
virtual void resolvePalette (uint inheritedMask)
 
QRectF sceneEffectiveBoundingRect () const
 Returns the effective bounding rect of this item in scene coordinates, by combining sceneTransform() with boundingRect(), taking into account the effect that the item might have. More...
 
void sendScenePosChange ()
 
void setEnabledHelper (bool newEnabled, bool explicitly, bool update=true)
 Sets this item's visibility to newEnabled. More...
 
void setExtra (Extra type, const QVariant &value)
 
void setFocusHelper (Qt::FocusReason focusReason, bool climb, bool focusFromHide)
 
void setIsMemberOfGroup (bool enabled)
 Propagates item group membership. More...
 
void setParentItemHelper (QGraphicsItem *parent, const QVariant *newParentVariant, const QVariant *thisPointerVariant)
 Make sure not to trigger any pure virtual function calls (e. More...
 
void setSubFocus (QGraphicsItem *rootItem=0, QGraphicsItem *stopItem=0)
 
void setTransformHelper (const QTransform &transform)
 Sets the transform transform. More...
 
void setVisibleHelper (bool newVisible, bool explicitly, bool update=true)
 Sets this item's visibility to newVisible. More...
 
virtual void subFocusItemChange ()
 Subclasses can reimplement this function to be notified when subFocusItem changes. More...
 
QTransform transformToParent () const
 
void unsetExtra (Extra type)
 
void updateAncestorFlag (QGraphicsItem::GraphicsItemFlag childFlag, AncestorFlag flag=NoFlag, bool enabled=false, bool root=true)
 Propagates the ancestor flag flag with value enabled to all this item's children. More...
 
void updateAncestorFlags ()
 
void updateChildWithGraphicsEffectFlagRecursively ()
 
void updatePaintedViewBoundingRects (bool updateChildren)
 
virtual void updateSceneTransformFromParent ()
 
virtual ~QGraphicsItemPrivate ()
 

Static Public Functions

static QDeclarativeTextInputPrivateget (QDeclarativeTextInput *t)
 
- Static Public Functions inherited from QDeclarativeItemPrivate
static void data_append (QDeclarativeListProperty< QObject > *, QObject *)
 
static QObjectdata_at (QDeclarativeListProperty< QObject > *, int)
 
static void data_clear (QDeclarativeListProperty< QObject > *)
 
static int data_count (QDeclarativeListProperty< QObject > *)
 
static qint64 elapsed (QElapsedTimer &)
 
static QDeclarativeItemPrivateget (QDeclarativeItem *item)
 
static void parentProperty (QObject *o, void *rv, QDeclarativeNotifierEndpoint *e)
 
static void resources_append (QDeclarativeListProperty< QObject > *, QObject *)
 
static QObjectresources_at (QDeclarativeListProperty< QObject > *, int)
 
static void resources_clear (QDeclarativeListProperty< QObject > *)
 
static int resources_count (QDeclarativeListProperty< QObject > *)
 
static qint64 restart (QElapsedTimer &)
 
static void setConsistentTime (qint64 t)
 
static void start (QElapsedTimer &)
 
static void transform_append (QDeclarativeListProperty< QGraphicsTransform > *list, QGraphicsTransform *)
 
static QGraphicsTransformtransform_at (QDeclarativeListProperty< QGraphicsTransform > *list, int)
 
static void transform_clear (QDeclarativeListProperty< QGraphicsTransform > *list)
 
static int transform_count (QDeclarativeListProperty< QGraphicsTransform > *list)
 
- Static Public Functions inherited from QGraphicsItemPrivate
static void children_append (QDeclarativeListProperty< QGraphicsObject > *list, QGraphicsObject *item)
 
static QGraphicsObjectchildren_at (QDeclarativeListProperty< QGraphicsObject > *list, int)
 
static void children_clear (QDeclarativeListProperty< QGraphicsObject > *list)
 
static int children_count (QDeclarativeListProperty< QGraphicsObject > *list)
 
static const QGraphicsItemPrivateget (const QGraphicsItem *item)
 
static QGraphicsItemPrivateget (QGraphicsItem *item)
 
static bool insertionOrder (QGraphicsItem *a, QGraphicsItem *b)
 
static bool isOpacityNull (qreal opacity)
 
static bool movableAncestorIsSelected (const QGraphicsItem *item)
 

Public Variables

bool autoScroll:1
 
bool canPaste:1
 
bool clickCausedFocus:1
 
QColor color
 
QLineControlcontrol
 
QPointer< QDeclarativeComponentcursorComponent
 
QPointer< QDeclarativeItemcursorItem
 
bool cursorVisible:1
 
bool focused:1
 
bool focusOnPress:1
 
QFont font
 
QDeclarativeTextInput::HAlignment hAlign
 
bool hAlignImplicit:1
 
int hscroll
 
Qt::InputMethodHints inputMethodHints
 
int lastSelectionEnd
 
int lastSelectionStart
 
QDeclarativeTextInput::SelectionMode mouseSelectionMode
 
int oldHeight
 
int oldScroll
 
bool oldValidity:1
 
int oldWidth
 
QPointF pressPos
 
bool selectByMouse:1
 
QColor selectedTextColor
 
QColor selectionColor
 
bool selectPressed:1
 
bool showInputPanelOnFocus:1
 
QFont sourceFont
 
QDeclarativeText::TextStyle style
 
QColor styleColor
 
- Public Variables inherited from QDeclarativePaintedItemPrivate
bool cachefrozen
 
qreal contentsScale
 
QSize contentsSize
 
QColor fillColor
 
QList< ImageCacheItem * > imagecache
 
int max_imagecache_size
 
bool smoothCache
 
- Public Variables inherited from QDeclarativeItemPrivate
AnchorLines_anchorLines
 
QDeclarativeAnchors_anchors
 
QDeclarativeContents_contents
 
QDeclarativeStateGroup_stateGroup
 
QDeclarativeLayoutMirroringAttachedattachedLayoutDirection
 
QDeclarativeNullableValue< qrealbaselineOffset
 
QPODVector< ChangeListener, 4 > changeListeners
 
bool componentComplete:1
 
bool doneEventPreHandler: 1
 
bool effectiveLayoutMirror:1
 
bool hadActiveFocus:1
 
bool hadFocus:1
 
bool heightValid:1
 
bool inheritedLayoutMirror:1
 
bool inheritMirrorFromItem:1
 
bool inheritMirrorFromParent:1
 
bool isMirrorImplicit:1
 
bool keepMouse:1
 
QDeclarativeItemKeyFilterkeyHandler
 
qreal mHeight
 
qreal mImplicitHeight
 
qreal mImplicitWidth
 
qreal mWidth
 
QDeclarativeItem::TransformOrigin origin:5
 
QDeclarativeNotifier parentNotifier
 
bool smooth:1
 
bool transformOriginDirty: 1
 
bool widthValid:1
 
- Public Variables inherited from QGraphicsItemPrivate
quint32 acceptDrops: 1
 
quint32 acceptedMouseButtons: 5
 
quint32 acceptedTouchBeginEvent: 1
 
quint32 acceptsHover: 1
 
quint32 acceptTouchEvents: 1
 
quint32 allChildrenDirty: 1
 
quint32 ancestorFlags: 4
 
quint32 cacheMode: 2
 
QList< QGraphicsItem * > children
 
QRectF childrenBoundingRect
 
quint32 dirty: 1
 
quint32 dirtyChildren: 1
 
quint32 dirtyChildrenBoundingRect: 1
 
quint32 dirtySceneTransform: 1
 
quint32 enabled: 1
 
quint32 explicitActivate: 1
 
quint32 explicitlyDisabled: 1
 
quint32 explicitlyHidden: 1
 
QList< ExtraStructextras
 
quint32 filtersDescendantEvents: 1
 
quint32 flags: 19
 
QGraphicsItemfocusProxy
 
QList< QGraphicsItem ** > focusProxyRefs
 
QGraphicsItemfocusScopeItem
 
quint32 fullUpdatePending: 1
 
quint32 geometryChanged: 1
 
QMap< Qt::GestureType, Qt::GestureFlags > gestureContext
 
int globalStackingOrder
 
QGraphicsEffectgraphicsEffect
 
quint32 handlesChildEvents: 1
 
quint32 hasBoundingRegionGranularity: 1
 
quint32 hasCursor: 1
 
quint32 holesInSiblingIndex: 1
 
quint32 ignoreOpacity: 1
 
quint32 ignoreVisible: 1
 
Qt::InputMethodHints imHints
 
quint32 inDestructor: 1
 
int index
 
quint32 inSetPosHelper: 1
 
quint32 isDeclarativeItem: 1
 
quint32 isMemberOfGroup: 1
 
quint32 isObject: 1
 
quint32 isWidget: 1
 
int itemDepth
 
quint32 itemDiscovered: 1
 
quint32 localCollisionHack: 1
 
quint32 mayHaveChildWithGraphicsEffect: 1
 
quint32 mouseSetsFocus: 1
 
quint32 needSortChildren: 1
 
QRectF needsRepaint
 
quint32 notifyBoundingRectChanged: 1
 
quint32 notifyInvalidated: 1
 
qreal opacity
 
quint32 padding: 21
 
QMap< QWidget *, QRectpaintedViewBoundingRects
 
quint32 paintedViewBoundingRectsNeedRepaint: 1
 
QGraphicsItem::PanelModality panelModality
 
QGraphicsItemparent
 
quint32 pendingPolish: 1
 
QPointF pos
 
QGraphicsItemq_ptr
 
QGraphicsScenescene
 
quint32 scenePosDescendants: 1
 
QTransform sceneTransform
 
quint32 sceneTransformTranslateOnly: 1
 
quint32 selected: 1
 
quint32 sendParentChangeNotification: 1
 
quint32 sequentialOrdering: 1
 
int siblingIndex
 
QGraphicsItemsubFocusItem
 
TransformDatatransformData
 
quint32 updateDueToGraphicsEffect: 1
 
quint32 visible: 1
 
quint32 wantsActive: 1
 
qreal z
 

Additional Inherited Members

- Public Types inherited from QDeclarativeItemPrivate
enum  ChangeType {
  Geometry = 0x01, SiblingOrder = 0x02, Visibility = 0x04, Opacity = 0x08,
  Destroyed = 0x10
}
 
- Public Types inherited from QGraphicsItemPrivate
enum  AncestorFlag {
  NoFlag = 0, AncestorHandlesChildEvents = 0x1, AncestorClipsChildren = 0x2, AncestorIgnoresTransformations = 0x4,
  AncestorFiltersChildEvents = 0x8
}
 
enum  Extra {
  ExtraToolTip, ExtraCursor, ExtraCacheData, ExtraMaxDeviceCoordCacheSize,
  ExtraBoundingRegionGranularity
}
 
enum  InvalidateReason { OpacityChanged }
 
- Static Public Variables inherited from QDeclarativeItemPrivate
static qint64 consistentTime = -1
 

Detailed Description

Definition at line 69 of file qdeclarativetextinput_p_p.h.

Constructors and Destructors

◆ QDeclarativeTextInputPrivate()

QDeclarativeTextInputPrivate::QDeclarativeTextInputPrivate ( )
inline

Definition at line 73 of file qdeclarativetextinput_p_p.h.

73  : control(new QLineControl),
77  hscroll(0), oldScroll(0), oldValidity(false), focused(false), focusOnPress(true),
79  autoScroll(true), selectByMouse(false), canPaste(false), hAlignImplicit(true),
80  selectPressed(false)
81  {
82 #ifdef Q_OS_SYMBIAN
83  if (QSysInfo::symbianVersion() >= QSysInfo::SV_SF_1) {
84  showInputPanelOnFocus = false;
85  }
86 #endif
87 
88  }
unsigned int QRgb
Definition: qrgb.h:53
QDeclarativeTextInput::SelectionMode mouseSelectionMode
QDeclarativeTextInput::HAlignment hAlign
QDeclarativeText::TextStyle style

◆ ~QDeclarativeTextInputPrivate()

QDeclarativeTextInputPrivate::~QDeclarativeTextInputPrivate ( )
inline

Definition at line 90 of file qdeclarativetextinput_p_p.h.

91  {
92  }

Functions

◆ calculateTextWidth()

int QDeclarativeTextInputPrivate::calculateTextWidth ( )

Definition at line 1421 of file qdeclarativetextinput.cpp.

1422 {
1423  return qRound(control->naturalTextWidth());
1424 }
qreal naturalTextWidth() const
Q_DECL_CONSTEXPR int qRound(qreal d)
Definition: qglobal.h:1203

◆ determineHorizontalAlignment()

bool QDeclarativeTextInputPrivate::determineHorizontalAlignment ( )

Definition at line 455 of file qdeclarativetextinput.cpp.

456 {
457  if (hAlignImplicit) {
458  // if no explicit alignment has been set, follow the natural layout direction of the text
459  QString text = control->text();
460  if (text.isEmpty())
461  text = control->preeditAreaText();
462  bool isRightToLeft = text.isEmpty()
464  : text.isRightToLeft();
466  }
467  return false;
468 }
QString text() const
The QString class provides a Unicode character string.
Definition: qstring.h:83
QString preeditAreaText() const
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
bool isRightToLeft() const
Returns true if the string is read right to left.
Definition: qstring.cpp:7528
bool setHAlign(QDeclarativeTextInput::HAlignment, bool forceAlign=false)
static Qt::LayoutDirection keyboardInputDirection()
Returns the current keyboard input direction.
#define text
Definition: qobjectdefs.h:80

◆ focusChanged()

void QDeclarativeTextInputPrivate::focusChanged ( bool  hasFocus)
virtual

Reimplemented from QDeclarativeItemPrivate.

Definition at line 1180 of file qdeclarativetextinput.cpp.

1181 {
1183  focused = hasFocus;
1184  q->setCursorVisible(hasFocus && scene && scene->hasFocus());
1185  if(!hasFocus && control->passwordEchoEditing())
1186  control->updatePasswordEchoEditing(false);//QLineControl sets it on key events, but doesn't deal with focus events
1187  if (!hasFocus)
1188  control->deselect();
1190 }
QGraphicsScene * scene
#define Q_Q(Class)
Definition: qglobal.h:2483
bool passwordEchoEditing() const
virtual void focusChanged(bool)
bool hasFocus() const
Returns true if the scene has focus; otherwise returns false.
void updatePasswordEchoEditing(bool editing)
Sets the password echo editing to editing.

◆ get()

static QDeclarativeTextInputPrivate* QDeclarativeTextInputPrivate::get ( QDeclarativeTextInput t)
inlinestatic

Definition at line 147 of file qdeclarativetextinput_p_p.h.

147  {
148  return t->d_func();
149  }

◆ init()

void QDeclarativeTextInputPrivate::init ( )

Definition at line 2042 of file qdeclarativetextinput.cpp.

2043 {
2045  control->setParent(q);
2046  control->setCursorWidth(1);
2048  q->setSmooth(smooth);
2049  q->setAcceptedMouseButtons(Qt::LeftButton);
2050  q->setFlag(QGraphicsItem::ItemHasNoContents, false);
2052  q->connect(control, SIGNAL(cursorPositionChanged(int,int)),
2053  q, SLOT(cursorPosChanged()));
2054  q->connect(control, SIGNAL(selectionChanged()),
2055  q, SLOT(selectionChanged()));
2056  q->connect(control, SIGNAL(textChanged(QString)),
2057  q, SLOT(q_textChanged()));
2058  q->connect(control, SIGNAL(accepted()),
2059  q, SIGNAL(accepted()));
2060  q->connect(control, SIGNAL(updateNeeded(QRect)),
2061  q, SLOT(updateRect(QRect)));
2062 #ifndef QT_NO_CLIPBOARD
2063  q->connect(q, SIGNAL(readOnlyChanged(bool)),
2064  q, SLOT(q_canPasteChanged()));
2065  q->connect(QApplication::clipboard(), SIGNAL(dataChanged()),
2066  q, SLOT(q_canPasteChanged()));
2068 #endif // QT_NO_CLIPBOARD
2069  q->connect(control, SIGNAL(updateMicroFocus()),
2070  q, SLOT(updateCursorRectangle()));
2071  q->connect(control, SIGNAL(displayTextChanged(QString)),
2072  q, SLOT(updateRect()));
2073  q->updateSize();
2075  lastSelectionStart = 0;
2076  lastSelectionEnd = 0;
2077  QPalette p = control->palette();
2081 }
int length() const
Returns the number of characters in this string.
Definition: qstring.h:696
#define SLOT(a)
Definition: qobjectdefs.h:226
The QString class provides a Unicode character string.
Definition: qstring.h:83
const QColor & color(ColorGroup cg, ColorRole cr) const
Returns the color in the specified color group, used for the given color role.
Definition: qpalette.h:107
void setParent(QObject *)
Makes the object a child of parent.
Definition: qobject.cpp:1950
#define Q_Q(Class)
Definition: qglobal.h:2483
#define SIGNAL(a)
Definition: qobjectdefs.h:227
bool hasAcceptableInput() const
static QClipboard * clipboard()
Returns a pointer to the application global clipboard.
const QPalette & palette() const
bool isReadOnly() const
void setPasswordCharacter(const QChar &character)
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
void setCursorWidth(int value)
QString text(Mode mode=Clipboard) const
Returns the clipboard text as plain text, or an empty string if the clipboard does not contain any te...
Definition: qclipboard.cpp:357
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55
The QPalette class contains color groups for each widget state.
Definition: qpalette.h:61

◆ mirrorChange()

void QDeclarativeTextInputPrivate::mirrorChange ( )
virtual

Reimplemented from QDeclarativeItemPrivate.

Definition at line 470 of file qdeclarativetextinput.cpp.

◆ sendMouseEventToInputContext()

bool QDeclarativeTextInputPrivate::sendMouseEventToInputContext ( QGraphicsSceneMouseEvent event,
QEvent::Type  eventType 
)

Definition at line 1330 of file qdeclarativetextinput.cpp.

1332 {
1333 #if !defined QT_NO_IM
1335 
1336  QWidget *widget = event->widget();
1337  // event->widget() is null, if this is delayed event from QDeclarativeFlickable.
1338  if (!widget && qApp) {
1339  QGraphicsView *view = qobject_cast<QGraphicsView*>(qApp->focusWidget());
1340  if (view && view->scene() && view->scene() == q->scene())
1341  widget = view->viewport();
1342  }
1343 
1344  if (widget && control->composeMode()) {
1345  int tmp_cursor = xToPos(event->pos().x());
1346  int mousePos = tmp_cursor - control->cursor();
1347  if (mousePos < 0 || mousePos > control->preeditAreaText().length()) {
1348  mousePos = -1;
1349  // don't send move events outside the preedit area
1350  if (eventType == QEvent::MouseMove)
1351  return true;
1352  }
1353 
1354  QInputContext *qic = widget->inputContext();
1355  if (qic) {
1357  eventType,
1358  widget->mapFromGlobal(event->screenPos()),
1359  event->screenPos(),
1360  event->button(),
1361  event->buttons(),
1362  event->modifiers());
1363  // may be causing reset() in some input methods
1364  qic->mouseHandler(mousePos, &mouseEvent);
1365  event->setAccepted(mouseEvent.isAccepted());
1366  }
1367  if (!control->preeditAreaText().isEmpty())
1368  return true;
1369  }
1370 #else
1371  Q_UNUSED(event);
1372  Q_UNUSED(eventType)
1373 #endif
1374 
1375  return false;
1376 }
T qobject_cast(QObject *object)
Definition: qobject.h:375
QPoint screenPos() const
Returns the mouse cursor position in screen coordinates.
int cursor() const
QPointer< QWidget > widget
int length() const
Returns the number of characters in this string.
Definition: qstring.h:696
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
int xToPos(int x, QTextLine::CursorPosition betweenOrOn=QTextLine::CursorBetweenCharacters) const
bool composeMode() const
QString preeditAreaText() const
qreal x() const
Returns the x-coordinate of this point.
Definition: qpoint.h:282
#define Q_Q(Class)
Definition: qglobal.h:2483
QWidget * viewport() const
Returns the viewport widget.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
#define qApp
virtual void mouseHandler(int x, QMouseEvent *event)
This function can be reimplemented in a subclass to handle mouse press, release, double-click, and move events within the preedit text.
QInputContext * inputContext()
This function returns the QInputContext for this widget.
Definition: qwidget.cpp:474
The QMouseEvent class contains parameters that describe a mouse event.
Definition: qevent.h:85
static void mouseEvent(MouseAction action, QWidget *widget, Qt::MouseButton button, Qt::KeyboardModifiers stateKey, QPoint pos, int delay=-1)
Definition: qtestmouse.h:71
QPoint mapFromGlobal(const QPoint &) const
Translates the global screen coordinate pos to widget coordinates.
The QGraphicsView class provides a widget for displaying the contents of a QGraphicsScene.
Definition: qgraphicsview.h:64
QPointF pos() const
Returns the mouse cursor position in item coordinates.
The QInputContext class abstracts the input method dependent data and composing state.
Definition: qinputcontext.h:83
QGraphicsScene * scene() const
Returns a pointer to the scene that is currently visualized in the view.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setHAlign()

bool QDeclarativeTextInputPrivate::setHAlign ( QDeclarativeTextInput::HAlignment  alignment,
bool  forceAlign = false 
)

Definition at line 444 of file qdeclarativetextinput.cpp.

445 {
447  if ((hAlign != alignment || forceAlign) && alignment <= QDeclarativeTextInput::AlignHCenter) { // justify not supported
448  hAlign = alignment;
449  emit q->horizontalAlignmentChanged(alignment);
450  return true;
451  }
452  return false;
453 }
QDeclarativeTextInput::HAlignment hAlign
#define Q_Q(Class)
Definition: qglobal.h:2483
#define emit
Definition: qobjectdefs.h:76

◆ startCreatingCursor()

void QDeclarativeTextInputPrivate::startCreatingCursor ( )

Definition at line 1078 of file qdeclarativetextinput.cpp.

1079 {
1081  if(cursorComponent->isReady()){
1082  q->createCursor();
1083  }else if(cursorComponent->isLoading()){
1084  q->connect(cursorComponent, SIGNAL(statusChanged(int)),
1085  q, SLOT(createCursor()));
1086  }else {//isError
1087  qmlInfo(q, cursorComponent->errors()) << QDeclarativeTextInput::tr("Could not load cursor delegate");
1088  }
1089 }
#define SLOT(a)
Definition: qobjectdefs.h:226
bool isReady() const
Returns true if status() == QDeclarativeComponent::Ready.
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
#define Q_Q(Class)
Definition: qglobal.h:2483
#define SIGNAL(a)
Definition: qobjectdefs.h:227
QList< QDeclarativeError > errors() const
Return the list of errors that occurred during the last compile or create operation.
bool isLoading() const
Returns true if status() == QDeclarativeComponent::Loading.
QDeclarativeInfo qmlInfo(const QObject *me)
QPointer< QDeclarativeComponent > cursorComponent

◆ updateHorizontalScroll()

void QDeclarativeTextInputPrivate::updateHorizontalScroll ( )

Definition at line 1426 of file qdeclarativetextinput.cpp.

1427 {
1429  const int preeditLength = control->preeditAreaText().length();
1430  int cix = qRound(control->cursorToX(control->cursor() + preeditLength));
1431  QRect br(q->boundingRect().toRect());
1432  int widthUsed = calculateTextWidth();
1433 
1434  QDeclarativeTextInput::HAlignment effectiveHAlign = q->effectiveHAlign();
1435  if (autoScroll) {
1436  if (widthUsed <= br.width()) {
1437  // text fits in br; use hscroll for alignment
1438  switch (effectiveHAlign & ~(Qt::AlignAbsolute|Qt::AlignVertical_Mask)) {
1439  case Qt::AlignRight:
1440  hscroll = widthUsed - br.width() - 1;
1441  break;
1442  case Qt::AlignHCenter:
1443  hscroll = (widthUsed - br.width()) / 2;
1444  break;
1445  default:
1446  // Left
1447  hscroll = 0;
1448  break;
1449  }
1450  } else if (cix - hscroll >= br.width()) {
1451  // text doesn't fit, cursor is to the right of br (scroll right)
1452  hscroll = cix - br.width() + 1;
1453  } else if (cix - hscroll < 0 && hscroll < widthUsed) {
1454  // text doesn't fit, cursor is to the left of br (scroll left)
1455  hscroll = cix;
1456  } else if (widthUsed - hscroll < br.width()) {
1457  // text doesn't fit, text document is to the left of br; align
1458  // right
1459  hscroll = widthUsed - br.width() + 1;
1460  }
1461  if (preeditLength > 0) {
1462  // check to ensure long pre-edit text doesn't push the cursor
1463  // off to the left
1464  cix = qRound(control->cursorToX(
1465  control->cursor() + qMax(0, control->preeditCursor() - 1)));
1466  if (cix < hscroll)
1467  hscroll = cix;
1468  }
1469  } else {
1470  switch (effectiveHAlign) {
1472  hscroll = q->width() - widthUsed;
1473  break;
1475  hscroll = (q->width() - widthUsed) / 2;
1476  break;
1477  default:
1478  // Left
1479  hscroll = 0;
1480  break;
1481  }
1482  }
1483 }
int cursor() const
int length() const
Returns the number of characters in this string.
Definition: qstring.h:696
int preeditCursor() const
QString preeditAreaText() const
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
#define Q_Q(Class)
Definition: qglobal.h:2483
qreal cursorToX(int cursor) const
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
Q_DECL_CONSTEXPR int qRound(qreal d)
Definition: qglobal.h:1203

◆ updateInputMethodHints()

void QDeclarativeTextInputPrivate::updateInputMethodHints ( )

This handler is called when the Return or Enter key is pressed.

TextInput::onAccepted()

Note that if there is a validator or inputMask set on the text input, the handler will only be emitted if the input is in an acceptable state.

Definition at line 978 of file qdeclarativetextinput.cpp.

◆ xToPos()

int QDeclarativeTextInputPrivate::xToPos ( int  x,
QTextLine::CursorPosition  betweenOrOn = QTextLine::CursorBetweenCharacters 
) const
inline

Definition at line 94 of file qdeclarativetextinput_p_p.h.

95  {
97  QRect cr = q->boundingRect().toRect();
98  x-= cr.x() - hscroll;
99  return control->xToPos(x, betweenOrOn);
100  }
#define Q_Q(Class)
Definition: qglobal.h:2483
int xToPos(int x, QTextLine::CursorPosition=QTextLine::CursorBetweenCharacters) const
Returns the cursor position of the given x pixel value in relation to the displayed text...
int x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:252
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58

Properties

◆ autoScroll

bool QDeclarativeTextInputPrivate::autoScroll

Definition at line 141 of file qdeclarativetextinput_p_p.h.

◆ canPaste

bool QDeclarativeTextInputPrivate::canPaste

Definition at line 143 of file qdeclarativetextinput_p_p.h.

◆ clickCausedFocus

bool QDeclarativeTextInputPrivate::clickCausedFocus

Definition at line 139 of file qdeclarativetextinput_p_p.h.

◆ color

QColor QDeclarativeTextInputPrivate::color

Definition at line 117 of file qdeclarativetextinput_p_p.h.

◆ control

QLineControl* QDeclarativeTextInputPrivate::control

Definition at line 113 of file qdeclarativetextinput_p_p.h.

◆ cursorComponent

QPointer<QDeclarativeComponent> QDeclarativeTextInputPrivate::cursorComponent

Definition at line 125 of file qdeclarativetextinput_p_p.h.

◆ cursorItem

QPointer<QDeclarativeItem> QDeclarativeTextInputPrivate::cursorItem

Definition at line 126 of file qdeclarativetextinput_p_p.h.

◆ cursorVisible

bool QDeclarativeTextInputPrivate::cursorVisible

Definition at line 140 of file qdeclarativetextinput_p_p.h.

◆ focused

bool QDeclarativeTextInputPrivate::focused

Definition at line 136 of file qdeclarativetextinput_p_p.h.

◆ focusOnPress

bool QDeclarativeTextInputPrivate::focusOnPress

Definition at line 137 of file qdeclarativetextinput_p_p.h.

◆ font

QFont QDeclarativeTextInputPrivate::font

Definition at line 115 of file qdeclarativetextinput_p_p.h.

◆ hAlign

QDeclarativeTextInput::HAlignment QDeclarativeTextInputPrivate::hAlign

Definition at line 122 of file qdeclarativetextinput_p_p.h.

◆ hAlignImplicit

bool QDeclarativeTextInputPrivate::hAlignImplicit

Definition at line 144 of file qdeclarativetextinput_p_p.h.

◆ hscroll

int QDeclarativeTextInputPrivate::hscroll

Definition at line 133 of file qdeclarativetextinput_p_p.h.

◆ inputMethodHints

Qt::InputMethodHints QDeclarativeTextInputPrivate::inputMethodHints

Definition at line 124 of file qdeclarativetextinput_p_p.h.

◆ lastSelectionEnd

int QDeclarativeTextInputPrivate::lastSelectionEnd

Definition at line 130 of file qdeclarativetextinput_p_p.h.

◆ lastSelectionStart

int QDeclarativeTextInputPrivate::lastSelectionStart

Definition at line 129 of file qdeclarativetextinput_p_p.h.

◆ mouseSelectionMode

QDeclarativeTextInput::SelectionMode QDeclarativeTextInputPrivate::mouseSelectionMode

Definition at line 123 of file qdeclarativetextinput_p_p.h.

◆ oldHeight

int QDeclarativeTextInputPrivate::oldHeight

Definition at line 131 of file qdeclarativetextinput_p_p.h.

◆ oldScroll

int QDeclarativeTextInputPrivate::oldScroll

Definition at line 134 of file qdeclarativetextinput_p_p.h.

◆ oldValidity

bool QDeclarativeTextInputPrivate::oldValidity

Definition at line 135 of file qdeclarativetextinput_p_p.h.

◆ oldWidth

int QDeclarativeTextInputPrivate::oldWidth

Definition at line 132 of file qdeclarativetextinput_p_p.h.

◆ pressPos

QPointF QDeclarativeTextInputPrivate::pressPos

Definition at line 127 of file qdeclarativetextinput_p_p.h.

◆ selectByMouse

bool QDeclarativeTextInputPrivate::selectByMouse

Definition at line 142 of file qdeclarativetextinput_p_p.h.

◆ selectedTextColor

QColor QDeclarativeTextInputPrivate::selectedTextColor

Definition at line 119 of file qdeclarativetextinput_p_p.h.

◆ selectionColor

QColor QDeclarativeTextInputPrivate::selectionColor

Definition at line 118 of file qdeclarativetextinput_p_p.h.

◆ selectPressed

bool QDeclarativeTextInputPrivate::selectPressed

Definition at line 145 of file qdeclarativetextinput_p_p.h.

◆ showInputPanelOnFocus

bool QDeclarativeTextInputPrivate::showInputPanelOnFocus

Definition at line 138 of file qdeclarativetextinput_p_p.h.

◆ sourceFont

QFont QDeclarativeTextInputPrivate::sourceFont

Definition at line 116 of file qdeclarativetextinput_p_p.h.

◆ style

QDeclarativeText::TextStyle QDeclarativeTextInputPrivate::style

Definition at line 120 of file qdeclarativetextinput_p_p.h.

◆ styleColor

QColor QDeclarativeTextInputPrivate::styleColor

Definition at line 121 of file qdeclarativetextinput_p_p.h.


The documentation for this class was generated from the following files: