1
/****************************************************************************
3
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4
** Contact: http://www.qt-project.org/legal
6
** This file is part of the QtQml module of the Qt Toolkit.
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.
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.
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.
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.
40
****************************************************************************/
42
#ifndef QQUICKTEXTEDIT_P_P_H
43
#define QQUICKTEXTEDIT_P_P_H
49
// This file is not part of the Qt API. It exists purely as an
50
// implementation detail. This header file may change from version to
51
// version without notice, or even be removed.
56
#include "qquicktextedit_p.h"
57
#include "qquickimplicitsizeitem_p_p.h"
58
#include "qquicktextcontrol_p.h"
60
#include <QtQml/qqml.h>
64
class QQuickTextDocumentWithImageResources;
65
class QQuickTextControl;
66
class QQuickTextEditPrivate : public QQuickImplicitSizeItemPrivate
69
Q_DECLARE_PUBLIC(QQuickTextEdit)
71
typedef QQuickTextEdit Public;
73
QQuickTextEditPrivate()
74
: color(QRgb(0xFF000000)), selectionColor(QRgb(0xFF000080)), selectedTextColor(QRgb(0xFFFFFFFF))
75
, textMargin(0.0), xoff(0), yoff(0), font(sourceFont), cursorComponent(0), cursorItem(0), document(0), control(0)
76
, lastSelectionStart(0), lastSelectionEnd(0), lineCount(0)
77
, hAlign(QQuickTextEdit::AlignLeft), vAlign(QQuickTextEdit::AlignTop)
78
, format(QQuickTextEdit::PlainText), wrapMode(QQuickTextEdit::NoWrap)
79
, renderType(QQuickTextEdit::QtRendering)
80
, contentDirection(Qt::LayoutDirectionAuto)
81
, mouseSelectionMode(QQuickTextEdit::SelectCharacters)
83
, inputMethodHints(Qt::ImhNone)
85
, updateType(UpdatePaintNode)
86
, documentDirty(true), dirty(false), richText(false), cursorVisible(false), cursorPending(false)
87
, focusOnPress(true), persistentSelection(false), requireImplicitWidth(false)
88
, selectByMouse(false), canPaste(false), canPasteValid(false), hAlignImplicit(true)
89
, textCached(true), inLayout(false)
93
static QQuickTextEditPrivate *get(QQuickTextEdit *item) {
94
return static_cast<QQuickTextEditPrivate *>(QObjectPrivate::get(item)); }
98
void updateDefaultTextOption();
99
void relayoutDocument();
100
bool determineHorizontalAlignment();
101
bool setHAlign(QQuickTextEdit::HAlignment, bool forceAlign = false);
103
qreal getImplicitWidth() const;
104
Qt::LayoutDirection textDirection(const QString &text) const;
106
void setNativeCursorEnabled(bool enabled) { control->setCursorWidth(enabled ? 1 : 0); }
109
QColor selectionColor;
110
QColor selectedTextColor;
123
QQmlComponent* cursorComponent;
124
QQuickItem* cursorItem;
125
QQuickTextDocumentWithImageResources *document;
126
QQuickTextControl *control;
128
int lastSelectionStart;
129
int lastSelectionEnd;
134
UpdateOnlyPreprocess,
138
QQuickTextEdit::HAlignment hAlign;
139
QQuickTextEdit::VAlignment vAlign;
140
QQuickTextEdit::TextFormat format;
141
QQuickTextEdit::WrapMode wrapMode;
142
QQuickTextEdit::RenderType renderType;
143
Qt::LayoutDirection contentDirection;
144
QQuickTextEdit::SelectionMode mouseSelectionMode;
146
Qt::InputMethodHints inputMethodHints;
148
UpdateType updateType;
150
bool documentDirty : 1;
153
bool cursorVisible : 1;
154
bool cursorPending : 1;
155
bool focusOnPress : 1;
156
bool persistentSelection : 1;
157
bool requireImplicitWidth:1;
158
bool selectByMouse:1;
160
bool canPasteValid:1;
161
bool hAlignImplicit:1;
168
#endif // QQUICKTEXTEDIT_P_P_H