KDEUI
kpagewidgetmodel.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
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