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
lineedit_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
7
8#include <QtDesigner/abstractformwindow.h>
9
10#include <QtWidgets/qstyle.h>
11#include <QtWidgets/qstyleoption.h>
12
13#include <QtGui/qaction.h>
14
16
17using namespace Qt::StringLiterals;
18
19namespace qdesigner_internal {
20
21// -------- LineEditTaskMenuInlineEditor
23{
24public:
25 LineEditTaskMenuInlineEditor(QLineEdit *button, QObject *parent);
26
27protected:
28 QRect editRectangle() const override;
29};
30
35
37{
38 QStyleOption opt;
39 opt.initFrom(widget());
40 return opt.rect;
41}
42
43// --------------- LineEditTaskMenu
44LineEditTaskMenu::LineEditTaskMenu(QLineEdit *lineEdit, QObject *parent) :
45 QDesignerTaskMenu(lineEdit, parent),
46 m_editTextAction(new QAction(tr("Change text..."), this))
47{
48 TaskMenuInlineEditor *editor = new LineEditTaskMenuInlineEditor(lineEdit, this);
49 connect(m_editTextAction, &QAction::triggered, editor, &LineEditTaskMenuInlineEditor::editText);
50 m_taskActions.append(m_editTextAction);
51
52 QAction *sep = new QAction(this);
53 sep->setSeparator(true);
54 m_taskActions.append(sep);
55}
56
58{
59 return m_editTextAction;
60}
61
63{
64 return m_taskActions + QDesignerTaskMenu::taskActions();
65}
66
67}
68
69QT_END_NAMESPACE
LineEditTaskMenuInlineEditor(QLineEdit *button, QObject *parent)
QList< QAction * > taskActions() const override
QAction * preferredEditAction() const override
Combined button and popup list for selecting options.
Auxiliary methods to store/retrieve settings.