• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.8.3 API Reference
  • 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:
00177   explicit KViewStateSaver(QObject *parent = 0);
00178 
00182   ~KViewStateSaver();
00183 
00187   QAbstractItemView* view() const;
00188 
00192   void setView(QAbstractItemView *view);
00193 
00197   QItemSelectionModel* selectionModel() const;
00198 
00202   void setSelectionModel( QItemSelectionModel *selectionModel );
00203 
00207   void saveState(KConfigGroup &configGroup);
00208 
00212   void restoreState(const KConfigGroup &configGroup);
00213 
00217   QStringList selectionKeys() const;
00218 
00222   QStringList expansionKeys() const;
00223 
00227   QString currentIndexKey() const;
00228 
00232   QPair<int, int> scrollState() const;
00233 
00237   void restoreSelection( const QStringList &indexStrings );
00238 
00242   void restoreCurrentItem( const QString &indexString );
00243 
00247   void restoreExpanded( const QStringList &indexStrings );
00248 
00253   void restoreScrollState( int verticalScoll, int horizontalScroll );
00254 
00255 protected:
00259   virtual QModelIndex indexFromConfigString(const QAbstractItemModel *model, const QString &key) const = 0;
00260 
00264   virtual QString indexToConfigString(const QModelIndex &index) const = 0;
00265 
00266 private:
00267   //@cond PRIVATE
00268   Q_DECLARE_PRIVATE(KViewStateSaver)
00269   KViewStateSaverPrivate * const d_ptr;
00270   Q_PRIVATE_SLOT( d_func(), void rowsInserted( const QModelIndex&, int, int ) )
00271   Q_PRIVATE_SLOT( d_func(), void restoreScrollBarState() )
00272   //@endcond
00273 };
00274 
00275 #endif
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Thu May 10 2012 20:53:07 by doxygen 1.8.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDEUI

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

kdelibs-4.8.3 API Reference

Skip menu "kdelibs-4.8.3 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • 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
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal