KDEUI
kpagewidgetmodel.h
Go to the documentation of this file.
00001 /* 00002 This file is part of the KDE Libraries 00003 00004 Copyright (C) 2006 Tobias Koenig (tokoe@kde.org) 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License as published by the Free Software Foundation; either 00009 version 2 of the License, or (at your option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Library General Public License for more details. 00015 00016 You should have received a copy of the GNU Library General Public License 00017 along with this library; see the file COPYING.LIB. If not, write to 00018 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 Boston, MA 02110-1301, USA. 00020 */ 00021 00022 #ifndef KPAGEWIDGETMODEL_H 00023 #define KPAGEWIDGETMODEL_H 00024 00025 #include "kpagemodel.h" 00026 00027 class QWidget; 00028 00029 class KIcon; 00030 00050 class KDEUI_EXPORT KPageWidgetItem : public QObject 00051 { 00052 Q_OBJECT 00053 Q_PROPERTY( QString name READ name WRITE setName ) 00054 Q_PROPERTY( QString header READ header WRITE setHeader ) 00055 Q_PROPERTY( KIcon icon READ icon WRITE setIcon ) 00056 Q_PROPERTY( bool checkable READ isCheckable WRITE setCheckable ) 00057 Q_PROPERTY( bool checked READ isChecked WRITE setChecked ) 00063 Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled) 00064 00065 public: 00071 KPageWidgetItem( QWidget *widget ); 00072 00080 KPageWidgetItem( QWidget *widget, const QString &name ); 00081 00085 ~KPageWidgetItem(); 00086 00090 QWidget* widget() const; 00091 00096 void setName( const QString &name ); 00097 00101 QString name() const; 00102 00113 void setHeader( const QString &header ); 00114 00118 QString header() const; 00119 00124 void setIcon( const KIcon &icon ); 00125 00129 KIcon icon() const; 00130 00136 void setCheckable( bool checkable ); 00137 00141 bool isCheckable() const; 00142 00146 bool isChecked() const; 00147 00151 bool isEnabled() const; 00152 00153 public Q_SLOTS: 00157 void setEnabled(bool); 00158 00162 void setChecked( bool checked ); 00163 00164 Q_SIGNALS: 00169 void changed(); 00170 00175 void toggled( bool checked ); 00176 00177 private: 00178 class Private; 00179 Private* const d; 00180 }; 00181 00182 class KPageWidgetModelPrivate; 00183 00188 class KDEUI_EXPORT KPageWidgetModel : public KPageModel 00189 { 00190 Q_OBJECT 00191 Q_DECLARE_PRIVATE(KPageWidgetModel) 00192 00193 public: 00199 explicit KPageWidgetModel( QObject *parent = 0 ); 00200 00204 ~KPageWidgetModel(); 00205 00214 KPageWidgetItem* addPage( QWidget *widget, const QString &name ); 00215 00221 void addPage( KPageWidgetItem *item ); 00222 00233 KPageWidgetItem* insertPage( KPageWidgetItem *before, QWidget *widget, const QString &name ); 00234 00243 void insertPage( KPageWidgetItem *before, KPageWidgetItem *item ); 00244 00254 KPageWidgetItem* addSubPage( KPageWidgetItem *parent, QWidget *widget, const QString &name ); 00255 00263 void addSubPage( KPageWidgetItem *parent, KPageWidgetItem *item ); 00264 00268 void removePage( KPageWidgetItem *item ); 00269 00273 virtual int columnCount( const QModelIndex &parent = QModelIndex() ) const; 00274 virtual QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const; 00275 virtual bool setData( const QModelIndex &index, const QVariant &value, int role = Qt::EditRole ); 00276 virtual Qt::ItemFlags flags( const QModelIndex &index ) const; 00277 virtual QModelIndex index( int row, int column, const QModelIndex &parent = QModelIndex() ) const; 00278 virtual QModelIndex parent( const QModelIndex &index ) const; 00279 virtual int rowCount( const QModelIndex &parent = QModelIndex() ) const; 00280 00284 KPageWidgetItem *item(const QModelIndex &index) const; 00285 00290 QModelIndex index( const KPageWidgetItem *item ) const; 00291 00292 Q_SIGNALS: 00297 void toggled( KPageWidgetItem *page, bool checked ); 00298 00299 private: 00300 Q_PRIVATE_SLOT(d_func(), void _k_itemChanged()) 00301 Q_PRIVATE_SLOT(d_func(), void _k_itemToggled(bool)) 00302 }; 00303 00304 #endif
KDE 4.6 API Reference