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
tablewidget_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
"tablewidget_taskmenu.h"
6
#
include
"tablewidgeteditor.h"
7
8
#
include
<
QtDesigner
/
abstractformwindow
.
h
>
9
10
#
include
<
QtWidgets
/
qtablewidget
.
h
>
11
#
include
<
QtWidgets
/
qlineedit
.
h
>
12
#
include
<
QtWidgets
/
qstyle
.
h
>
13
#
include
<
QtWidgets
/
qstyleoption
.
h
>
14
15
#
include
<
QtGui
/
qaction
.
h
>
16
17
#
include
<
QtCore
/
qcoreevent
.
h
>
18
#
include
<
QtCore
/
qvariant
.
h
>
19
#
include
<
QtCore
/
qdebug
.
h
>
20
21
QT_BEGIN_NAMESPACE
22
23
namespace
qdesigner_internal
{
24
25
TableWidgetTaskMenu
::TableWidgetTaskMenu(QTableWidget *button, QObject *parent)
26
: QDesignerTaskMenu(button, parent),
27
m_tableWidget(button),
28
m_editItemsAction(
new
QAction(tr(
"Edit Items..."
),
this
))
29
{
30
connect(m_editItemsAction, &QAction::triggered,
this
, &TableWidgetTaskMenu::editItems);
31
m_taskActions.append(m_editItemsAction);
32
33
QAction *sep =
new
QAction(
this
);
34
sep->setSeparator(
true
);
35
m_taskActions.append(sep);
36
}
37
38
39
TableWidgetTaskMenu
::~
TableWidgetTaskMenu
() =
default
;
40
41
QAction
*
TableWidgetTaskMenu
::
preferredEditAction
()
const
42
{
43
return
m_editItemsAction;
44
}
45
46
QList
<
QAction
*>
TableWidgetTaskMenu
::
taskActions
()
const
47
{
48
return
m_taskActions + QDesignerTaskMenu::taskActions();
49
}
50
51
void
TableWidgetTaskMenu
::editItems()
52
{
53
m_formWindow = QDesignerFormWindowInterface::findFormWindow(m_tableWidget);
54
if
(m_formWindow.isNull())
55
return
;
56
57
Q_ASSERT(m_tableWidget !=
nullptr
);
58
59
TableWidgetEditorDialog
dlg(m_formWindow, m_tableWidget->window());
60
TableWidgetContents
oldCont = dlg.fillContentsFromTableWidget(m_tableWidget);
61
if
(dlg.exec() == QDialog::Accepted) {
62
TableWidgetContents
newCont = dlg.contents();
63
if
(newCont != oldCont) {
64
ChangeTableContentsCommand *cmd =
new
ChangeTableContentsCommand(m_formWindow);
65
cmd->init(m_tableWidget, oldCont, newCont);
66
m_formWindow->commandHistory()->push(cmd);
67
}
68
}
69
}
70
71
void
TableWidgetTaskMenu
::updateSelection()
72
{
73
if
(m_editor)
74
m_editor->deleteLater();
75
}
76
77
}
// namespace qdesigner_internal
78
79
QT_END_NAMESPACE
qdesigner_internal::TableWidgetEditorDialog
Definition
tablewidgeteditor.h:78
qdesigner_internal::TableWidgetTaskMenu
Definition
tablewidget_taskmenu.h:22
qdesigner_internal::TableWidgetTaskMenu::taskActions
QList< QAction * > taskActions() const override
Definition
tablewidget_taskmenu.cpp:46
qdesigner_internal::TableWidgetTaskMenu::~TableWidgetTaskMenu
~TableWidgetTaskMenu() override
qdesigner_internal::TableWidgetTaskMenu::preferredEditAction
QAction * preferredEditAction() const override
Definition
tablewidget_taskmenu.cpp:41
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
qdesigner_internal::TableWidgetContents
Definition
qdesigner_command_p.h:865
qttools
src
designer
src
components
taskmenu
tablewidget_taskmenu.cpp
Generated on
for Qt by
1.18.0