Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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
5
6#include <QtQuick/private/qquicktext_p_p.h>
7#include <QtQuick/private/qquicktextinput_p_p.h>
8#include <QtQuick/private/qquicktextedit_p_p.h>
9
11
15
17{
19
20 auto control = textControl();
21 if (control)
22 connect(control, SIGNAL(effectiveHorizontalAlignmentChanged()), this, SLOT(updateAlignment()));
23 updateAlignment();
24}
25
37
38void QQuickPlaceholderText::updateAlignment()
39{
40 if (QQuickTextInput *input = qobject_cast<QQuickTextInput *>(parentItem())) {
41 if (QQuickTextInputPrivate::get(input)->hAlignImplicit)
43 else
44 setHAlign(static_cast<HAlignment>(input->hAlign()));
45 } else if (QQuickTextEdit *edit = qobject_cast<QQuickTextEdit *>(parentItem())) {
46 if (QQuickTextEditPrivate::get(edit)->hAlignImplicit)
48 else
49 setHAlign(static_cast<HAlignment>(edit->hAlign()));
50 } else {
52 }
53}
54
56
57#include "moc_qquickplaceholdertext_p.cpp"
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
Definition qquickitem.h:63
QQuickItem * parentItem() const
QQuickItem * parent
\qmlproperty Item QtQuick::Item::parent This property holds the visual parent of the item.
Definition qquickitem.h:67
QQuickPlaceholderText(QQuickItem *parent=nullptr)
QQuickItem * textControl() const
void componentComplete() override
\reimp Derived classes should call the base class method before adding their own actions to perform a...
static QQuickTextEditPrivate * get(QQuickTextEdit *item)
static QQuickTextInputPrivate * get(QQuickTextInput *t)
void componentComplete() override
void setHAlign(HAlignment align)
void resetHAlign()
void effectiveHorizontalAlignmentChanged()
Combined button and popup list for selecting options.
#define SLOT(a)
Definition qobjectdefs.h:52
#define SIGNAL(a)
Definition qobjectdefs.h:53
GLenum GLenum GLenum input
QQuickItem * qobject_cast< QQuickItem * >(QObject *o)
Definition qquickitem.h:492
connect(quitButton, &QPushButton::clicked, &app, &QCoreApplication::quit, Qt::QueuedConnection)