KDDockWidgets API Documentation 2.0
Loading...
Searching...
No Matches
qtwidgets/Action.cpp
Go to the documentation of this file.
1/*
2 This file is part of KDDockWidgets.
3
4 SPDX-FileCopyrightText: 2020 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
5 Author: SĂ©rgio Martins <sergio.martins@kdab.com>
6
7 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
8
9 Contact KDAB at <info@kdab.com> for commercial licensing options.
10*/
11
12
13#include "Action_p.h"
14#include "core/Action_p.h"
15#include "core/Logging_p.h"
16
17using namespace KDDockWidgets::QtWidgets;
18
19Action::Action(Core::DockWidget *dw, const char *debugName)
20 : Core::Action(dw, debugName)
21{
22 setCheckable(true);
23 connect(this, &QAction::toggled, this, [this](bool checked) {
24 if (m_lastCheckedState != checked) {
25 m_lastCheckedState = checked;
26 if (!signalsBlocked()) {
27 KDDW_TRACE("Action::toggled({}) ; dw={} ; {}", checked, ( void * )d->dockWidget, d->debugName);
28 d->toggled.emit(checked);
29 }
30 }
31 });
32}
33
34Action::~Action() = default;
35
36void Action::setIcon(const KDDockWidgets::Icon &icon)
37{
38 QAction::setIcon(icon);
39}
40
41KDDockWidgets::Icon Action::icon() const
42{
43 return QAction::icon();
44}
45
46void Action::setText(const QString &text)
47{
48 QAction::setText(text);
49}
50
51void Action::setToolTip(const QString &text)
52{
54}
55
56QString Action::toolTip() const
57{
58 return QAction::toolTip();
59}
60
61void Action::setEnabled(bool enabled)
62{
63 QAction::setEnabled(enabled);
64}
65
66bool Action::isEnabled() const
67{
68 return QAction::isEnabled();
69}
70
71bool Action::isChecked() const
72{
73 return QAction::isChecked();
74}
75
76void Action::setChecked(bool checked)
77{
78 QAction::setChecked(checked);
79}
80
81bool Action::blockSignals(bool b)
82{
83 return QAction::blockSignals(b);
84}
85
86#ifdef DOCKS_DEVELOPER_MODE
87void Action::trigger()
88{
90}
91#endif
The DockWidget base-class. DockWidget and Core::DockWidget are only split in two so we can share some...
void connect(T &&future, QObjectSubclass *context, Callback func)
Definition qcorotask.h:721
bool isChecked() const const
void setEnabled(bool)
void setIcon(const QIcon &icon)
void setText(const QString &text)
void toggled(bool checked)
void setToolTip(const QString &tip)
void trigger()
bool blockSignals(bool block)

© Klarälvdalens Datakonsult AB (KDAB)
"The Qt, C++ and OpenGL Experts"
https://www.kdab.com/
KDDockWidgets
Advanced Dock Widget Framework for Qt
https://www.kdab.com/development-resources/qt-tools/kddockwidgets/
Generated by doxygen 1.9.8