Krita Source Code Documentation
Loading...
Searching...
No Matches
SyncButtonAndAction.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2015 Dmitry Kazakov <dimula73@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7#ifndef SYNC_BUTTON_AND_ACTION_H
8#define SYNC_BUTTON_AND_ACTION_H
9
10#include <QPointer>
11#include <QAbstractButton>
12#include "kis_action.h"
13
14#include "kritalayerdocker_export.h"
15
16class KRITALAYERDOCKER_EXPORT SyncButtonAndAction : public QObject
17{
18 Q_OBJECT
19public:
20 SyncButtonAndAction(KisAction *action, QAbstractButton *button, QObject *parent)
21 : QObject(parent),
22 m_action(action),
23 m_button(button)
24 {
25 connect(m_action, SIGNAL(changed()), SLOT(slotActionChanged()));
26 connect(m_button, SIGNAL(clicked()), m_action, SLOT(trigger()));
27 m_button->setIcon(m_action->icon());
28 m_button->setText(m_action->text());
29 }
30
31private Q_SLOTS:
33 if (m_action && m_button &&
34 m_action->isEnabled() != m_button->isEnabled()) {
35
36 m_button->setEnabled(m_action->isEnabled());
37 }
38 }
39
40private:
43};
44
45#endif /* __SYNC_BUTTON_AND_ACTION_H */
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
QPointer< QAbstractButton > m_button
SyncButtonAndAction(KisAction *action, QAbstractButton *button, QObject *parent)
QPointer< KisAction > m_action
QString button(const QWheelEvent &ev)