• Skip to content
  • Skip to link menu
KDE 4.6 API Reference
  • KDE API Reference
  • kdelibs
  • KDE Home
  • Contact Us
 

KDEUI

kviewstatesaver.h

Go to the documentation of this file.
00001 /*
00002     Copyright (C) 2010 Klarälvdalens Datakonsult AB,
00003         a KDAB Group company, info@kdab.net,
00004         author Stephen Kelly <stephen@kdab.com>
00005 
00006     This library is free software; you can redistribute it and/or modify it
00007     under the terms of the GNU Library General Public License as published by
00008     the Free Software Foundation; either version 2 of the License, or (at your
00009     option) any later version.
00010 
00011     This library is distributed in the hope that it will be useful, but WITHOUT
00012     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00013     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00014     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 the
00018     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00019     02110-1301, USA.
00020 */
00021 
00022 #ifndef KVIEWSTATESAVER_H
00023 #define KVIEWSTATESAVER_H
00024 
00025 #include <QtCore/QObject>
00026 #include <QtCore/QPair>
00027 
00028 #include "kdeui_export.h"
00029 
00030 class QAbstractItemView;
00031 class QItemSelectionModel;
00032 class QAbstractItemModel;
00033 class QAbstractScrollArea;
00034 class QModelIndex;
00035 class QStringList;
00036 
00037 class KConfigGroup;
00038 
00039 class KViewStateSaverPrivate;
00040 
00169 class KDEUI_EXPORT KViewStateSaver : public QObject
00170 {
00171   Q_OBJECT
00172 public:
00176   explicit KViewStateSaver(QObject *parent = 0);
00177 
00181   ~KViewStateSaver();
00182 
00186   QAbstractItemView* view() const;
00187 
00191   void setView(QAbstractItemView *view);
00192 
00196   QItemSelectionModel* selectionModel() const;
00197 
00201   void setSelectionModel( QItemSelectionModel *selectionModel );
00202 
00206   void saveState(KConfigGroup &configGroup);
00207 
00211   void restoreState(const KConfigGroup &configGroup);
00212 
00216   QStringList selectionKeys() const;
00217 
00221   QStringList expansionKeys() const;
00222 
00226   QString currentIndexKey() const;
00227 
00231   QPair<int, int> scrollState() const;
00232 
00236   void restoreSelection( const QStringList &indexStrings );
00237 
00241   void restoreCurrentItem( const QString &indexString );
00242 
00246   void restoreExpanded( const QStringList &indexStrings );
00247 
00252   void restoreScrollState( int verticalScoll, int horizontalScroll );
00253 
00254 protected:
00258   virtual QModelIndex indexFromConfigString(const QAbstractItemModel *model, const QString &key) const = 0;
00259 
00263   virtual QString indexToConfigString(const QModelIndex &index) const = 0;
00264 
00265 private:
00266   //@cond PRIVATE
00267   Q_DECLARE_PRIVATE(KViewStateSaver)
00268   KViewStateSaverPrivate * const d_ptr;
00269   Q_PRIVATE_SLOT( d_func(), void rowsInserted( const QModelIndex&, int, int ) )
00270   Q_PRIVATE_SLOT( d_func(), void restoreScrollBarState() )
00271   //@endcond
00272 };
00273 
00274 #endif

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.7.3
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal