Krita Source Code Documentation
Loading...
Searching...
No Matches
NodePropertyAction_p.h
Go to the documentation of this file.
1/*
2 SPDX-FileCopyrightText: 2006 Gábor Lehel <illissius@gmail.com>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#ifndef NODE_PROPERTY_ACTION_P_H
8#define NODE_PROPERTY_ACTION_P_H
9
10#include <kis_node_model.h>
11#include <kis_base_node.h>
12
13#include <QPersistentModelIndex>
14#include <QAction>
15
16#include "NodeView.h"
24class NodeView::PropertyAction: public QAction
25{
26 typedef QAction super;
27 Q_OBJECT
29 int m_num;
30 QPersistentModelIndex m_index;
31
32 Q_SIGNALS:
33 void toggled( bool on, const QPersistentModelIndex &index, int property );
34
35 public:
36 PropertyAction( int num, const KisBaseNode::Property &p, const QPersistentModelIndex &index, QObject *parent = 0 )
37 : QAction( parent ), m_property( p ), m_num( num ), m_index( index )
38 {
39 connect( this, SIGNAL( triggered( bool ) ), this, SLOT( slotTriggered() ) );
40 setText( m_property.name );
41 setIcon( m_property.state.toBool() ? m_property.onIcon : m_property.offIcon );
42 }
43
44 private Q_SLOTS:
46 {
47 m_property.state = !m_property.state.toBool();
48 setIcon( m_property.state.toBool() ? m_property.onIcon : m_property.offIcon );
49 Q_EMIT toggled( m_property.state.toBool(), m_index, m_num );
50 }
51};
52
53#endif
const Params2D p
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
void toggled(bool on, const QPersistentModelIndex &index, int property)
QPersistentModelIndex m_index
KisBaseNode::Property m_property
PropertyAction(int num, const KisBaseNode::Property &p, const QPersistentModelIndex &index, QObject *parent=0)