Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qquickplaceholdertext.cpp
Go to the documentation of this file.
1
// Copyright (C) 2017 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
// Qt-Security score:significant reason:default
4
5
#
include
"qquickplaceholdertext_p.h"
6
7
#
include
<
QtQuick
/
private
/
qquicktext_p_p
.
h
>
8
#
include
<
QtQuick
/
private
/
qquicktextinput_p_p
.
h
>
9
#
include
<
QtQuick
/
private
/
qquicktextedit_p_p
.
h
>
10
11
QT_BEGIN_NAMESPACE
12
13
QQuickPlaceholderText::QQuickPlaceholderText(QQuickItem *parent) : QQuickText(parent)
14
{
15
}
16
17
void
QQuickPlaceholderText::componentComplete()
18
{
19
QQuickText::componentComplete();
20
21
auto
control = textControl();
22
if
(control)
23
connect(control, SIGNAL(effectiveHorizontalAlignmentChanged()),
this
, SLOT(updateAlignment()));
24
updateAlignment();
25
}
26
27
/*!
28
\internal
29
30
The control that we're representing. This exists because
31
parentItem() is not always the control - it may be a Flickable
32
in the case of TextArea.
33
*/
34
QQuickItem *QQuickPlaceholderText::textControl()
const
35
{
36
return
qobject_cast<QQuickItem *>(parent());
37
}
38
39
void
QQuickPlaceholderText::updateAlignment()
40
{
41
if
(QQuickTextInput *input = qobject_cast<QQuickTextInput *>(parentItem())) {
42
if
(QQuickTextInputPrivate::get(input)->hAlignImplicit)
43
resetHAlign();
44
else
45
setHAlign(
static_cast
<HAlignment>(input->hAlign()));
46
}
else
if
(QQuickTextEdit *edit = qobject_cast<QQuickTextEdit *>(parentItem())) {
47
if
(QQuickTextEditPrivate::get(edit)->hAlignImplicit)
48
resetHAlign();
49
else
50
setHAlign(
static_cast
<HAlignment>(edit->hAlign()));
51
}
else
{
52
resetHAlign();
53
}
54
}
55
56
QT_END_NAMESPACE
57
58
#
include
"moc_qquickplaceholdertext_p.cpp"
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
qtdeclarative
src
quickcontrolsimpl
qquickplaceholdertext.cpp
Generated on
for Qt by
1.18.0