Warning, file /office/calligra/libs/main/KoDocumentSectionPropertyAction_p.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 Copyright (c) 2006 Gábor Lehel <illissius@gmail.com> 0003 0004 This library is free software; you can redistribute it and/or 0005 modify it under the terms of the GNU Library General Public 0006 License as published by the Free Software Foundation; either 0007 version 2 of the License, or (at your option) any later version. 0008 0009 This library is distributed in the hope that it will be useful, 0010 but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0012 Library General Public License for more details. 0013 0014 You should have received a copy of the GNU Library General Public License 0015 along with this library; see the file COPYING.LIB. If not, write to 0016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0017 Boston, MA 02110-1301, USA. 0018 */ 0019 0020 #ifndef KO_DOCUMENT_SECTION_PROPERTY_ACTION_P_H 0021 #define KO_DOCUMENT_SECTION_PROPERTY_ACTION_P_H 0022 0023 #include "KoDocumentSectionModel.h" 0024 #include "KoDocumentSectionView.h" 0025 0026 #include <QPersistentModelIndex> 0027 #include <QAction> 0028 0029 /** 0030 * Internal class for the KoDocumentSectionView widget. Provides a 0031 * toggle action for a particular property associated with a document 0032 * section, such as visible, selected, locked. Property actions have 0033 * associated on/off icons to show their state in the 0034 * KoDocumentSectionView. 0035 */ 0036 class KoDocumentSectionView::PropertyAction: public QAction 0037 { 0038 typedef QAction super; 0039 Q_OBJECT 0040 Model::Property m_property; 0041 int m_num; 0042 QPersistentModelIndex m_index; 0043 0044 Q_SIGNALS: 0045 void toggled( bool on, const QPersistentModelIndex &index, int property ); 0046 0047 public: 0048 PropertyAction( int num, const Model::Property &p, const QPersistentModelIndex &index, QObject *parent = 0 ) 0049 : QAction( parent ), m_property( p ), m_num( num ), m_index( index ) 0050 { 0051 connect( this, SIGNAL(triggered(bool)), this, SLOT(slotTriggered()) ); 0052 setText( m_property.name ); 0053 setIcon( m_property.state.toBool() ? m_property.onIcon : m_property.offIcon ); 0054 } 0055 0056 private Q_SLOTS: 0057 void slotTriggered() 0058 { 0059 m_property.state = !m_property.state.toBool(); 0060 setIcon( m_property.state.toBool() ? m_property.onIcon : m_property.offIcon ); 0061 emit toggled( m_property.state.toBool(), m_index, m_num ); 0062 } 0063 }; 0064 0065 #endif