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
5
6#include <QtDesigner/abstractformwindow.h>
7
8#include <QtGui/qaction.h>
9
10#include <QtCore/qcoreevent.h>
11#include <QtCore/qdebug.h>
12
14
15using namespace Qt::StringLiterals;
16
17namespace qdesigner_internal {
18
19TextEditTaskMenu::TextEditTaskMenu(QTextEdit *textEdit, QObject *parent) :
22 m_property(u"html"_s),
23 m_windowTitle(tr("Edit HTML")),
24 m_editTextAction(new QAction(tr("Change HTML..."), this))
25{
26 initialize();
27}
28
29TextEditTaskMenu::TextEditTaskMenu(QPlainTextEdit *textEdit, QObject *parent) :
32 m_property(u"plainText"_s),
33 m_windowTitle(tr("Edit Text")),
34 m_editTextAction(new QAction(tr("Change Plain Text..."), this))
35{
36 initialize();
37}
38
39
40void TextEditTaskMenu::initialize()
41{
42 connect(m_editTextAction, &QAction::triggered, this, &TextEditTaskMenu::editText);
43 m_taskActions.append(m_editTextAction);
44
45 QAction *sep = new QAction(this);
46 sep->setSeparator(true);
47 m_taskActions.append(sep);
48}
49
51
53{
54 return m_editTextAction;
55}
56
58{
59 return m_taskActions + QDesignerTaskMenu::taskActions();
60}
61
62void TextEditTaskMenu::editText()
63{
64 changeTextProperty(m_property, m_windowTitle, MultiSelectionMode, m_format);
65}
66
67}
68QT_END_NAMESPACE
QAction * preferredEditAction() const override
QList< QAction * > taskActions() const override
TextEditTaskMenu(QPlainTextEdit *button, QObject *parent=nullptr)
Combined button and popup list for selecting options.
Auxiliary methods to store/retrieve settings.