Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
textedit_taskmenu.cpp
Go to the documentation of this file.
1
// Copyright (C) 2016 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3
// Qt-Security score:significant reason:default
4
5
#
include
"textedit_taskmenu.h"
6
7
#
include
<
QtDesigner
/
abstractformwindow
.
h
>
8
9
#
include
<
QtGui
/
qaction
.
h
>
10
11
#
include
<
QtCore
/
qcoreevent
.
h
>
12
#
include
<
QtCore
/
qdebug
.
h
>
13
14
QT_BEGIN_NAMESPACE
15
16
using
namespace
Qt::StringLiterals;
17
18
namespace
qdesigner_internal
{
19
20
TextEditTaskMenu
::
TextEditTaskMenu
(QTextEdit *textEdit, QObject *parent) :
21
QDesignerTaskMenu
(
textEdit
,
parent
),
22
m_format
(
Qt
::
RichText
),
23
m_property
(u"html"_s),
24
m_windowTitle
(
tr
(
"Edit HTML"
)),
25
m_editTextAction
(
new
QAction
(
tr
(
"Change HTML..."
),
this
))
26
{
27
initialize();
28
}
29
30
TextEditTaskMenu
::
TextEditTaskMenu
(QPlainTextEdit *textEdit, QObject *parent) :
31
QDesignerTaskMenu
(
textEdit
,
parent
),
32
m_format
(
Qt
::
PlainText
),
33
m_property
(u"plainText"_s),
34
m_windowTitle
(
tr
(
"Edit Text"
)),
35
m_editTextAction
(
new
QAction
(
tr
(
"Change Plain Text..."
),
this
))
36
{
37
initialize();
38
}
39
40
41
void
TextEditTaskMenu
::initialize()
42
{
43
connect(m_editTextAction, &QAction::triggered,
this
, &TextEditTaskMenu::editText);
44
m_taskActions.append(m_editTextAction);
45
46
QAction *sep =
new
QAction(
this
);
47
sep->setSeparator(
true
);
48
m_taskActions.append(sep);
49
}
50
51
TextEditTaskMenu
::~
TextEditTaskMenu
() =
default
;
52
53
QAction
*
TextEditTaskMenu
::
preferredEditAction
()
const
54
{
55
return
m_editTextAction;
56
}
57
58
QList
<
QAction
*>
TextEditTaskMenu
::
taskActions
()
const
59
{
60
return
m_taskActions + QDesignerTaskMenu::taskActions();
61
}
62
63
void
TextEditTaskMenu
::editText()
64
{
65
changeTextProperty(m_property, m_windowTitle, MultiSelectionMode, m_format);
66
}
67
68
}
69
QT_END_NAMESPACE
qdesigner_internal::TextEditTaskMenu
Definition
textedit_taskmenu.h:21
qdesigner_internal::TextEditTaskMenu::preferredEditAction
QAction * preferredEditAction() const override
Definition
textedit_taskmenu.cpp:53
qdesigner_internal::TextEditTaskMenu::taskActions
QList< QAction * > taskActions() const override
Definition
textedit_taskmenu.cpp:58
qdesigner_internal::TextEditTaskMenu::~TextEditTaskMenu
~TextEditTaskMenu() override
qdesigner_internal::TextEditTaskMenu::TextEditTaskMenu
TextEditTaskMenu(QPlainTextEdit *button, QObject *parent=nullptr)
Definition
textedit_taskmenu.cpp:30
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
qdesigner_internal
Auxiliary methods to store/retrieve settings.
Definition
buddyeditor.cpp:67
qttools
src
designer
src
components
taskmenu
textedit_taskmenu.cpp
Generated on
for Qt by
1.16.1