Qt 4.8
qdeclarativetextinput_p_p.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtDeclarative module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #ifndef QDECLARATIVETEXTINPUT_P_H
43 #define QDECLARATIVETEXTINPUT_P_H
44 
45 #include "private/qdeclarativetextinput_p.h"
46 
47 #include "private/qdeclarativeimplicitsizeitem_p_p.h"
48 
49 #include <qdeclarative.h>
50 
51 #include <QPointer>
52 
53 #include <private/qlinecontrol_p.h>
54 
55 //
56 // W A R N I N G
57 // -------------
58 //
59 // This file is not part of the Qt API. It exists purely as an
60 // implementation detail. This header file may change from version to
61 // version without notice, or even be removed.
62 //
63 // We mean it.
64 
65 #ifndef QT_NO_LINEEDIT
66 
68 
70 {
72 public:
74  color((QRgb)0), style(QDeclarativeText::Normal),
75  styleColor((QRgb)0), hAlign(QDeclarativeTextInput::AlignLeft),
76  mouseSelectionMode(QDeclarativeTextInput::SelectCharacters), inputMethodHints(Qt::ImhNone),
77  hscroll(0), oldScroll(0), oldValidity(false), focused(false), focusOnPress(true),
78  showInputPanelOnFocus(true), clickCausedFocus(false), cursorVisible(false),
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  }
89 
91  {
92  }
93 
95  {
97  QRect cr = q->boundingRect().toRect();
98  x-= cr.x() - hscroll;
99  return control->xToPos(x, betweenOrOn);
100  }
101 
102  void init();
103  void startCreatingCursor();
104  void focusChanged(bool hasFocus);
105  void updateHorizontalScroll();
106  bool determineHorizontalAlignment();
107  bool setHAlign(QDeclarativeTextInput::HAlignment, bool forceAlign = false);
108  void mirrorChange();
109  int calculateTextWidth();
110  bool sendMouseEventToInputContext(QGraphicsSceneMouseEvent *event, QEvent::Type eventType);
111  void updateInputMethodHints();
112 
114 
124  Qt::InputMethodHints inputMethodHints;
128 
132  int oldWidth;
133  int hscroll;
135  bool oldValidity:1;
136  bool focused:1;
137  bool focusOnPress:1;
141  bool autoScroll:1;
143  bool canPaste:1;
146 
148  return t->d_func();
149  }
150 };
151 
153 
154 #endif // QT_NO_LINEEDIT
155 
156 #endif
157 
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
unsigned int QRgb
Definition: qrgb.h:53
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
EventRef event
QDeclarativeTextInput::SelectionMode mouseSelectionMode
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:214
The QGraphicsSceneMouseEvent class provides mouse events in the graphics view framework.
int xToPos(int x, QTextLine::CursorPosition betweenOrOn=QTextLine::CursorBetweenCharacters) const
QDeclarativeTextInput::HAlignment hAlign
void init(QDeclarativeItem *parent)
#define Q_Q(Class)
Definition: qglobal.h:2483
QPointer< QDeclarativeItem > cursorItem
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
virtual void focusChanged(bool)
#define Q_DECLARE_PUBLIC(Class)
Definition: qglobal.h:2477
Type
This enum type defines the valid event types in Qt.
Definition: qcoreevent.h:62
The QFont class specifies a font used for drawing text.
Definition: qfont.h:64
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
Definition: qnamespace.h:54
#define Q_AUTOTEST_EXPORT
Definition: qglobal.h:1510
QPointer< QDeclarativeComponent > cursorComponent
QDeclarativeText::TextStyle style