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

KDEUI

  • sources
  • kde-4.12
  • kdelibs
  • kdeui
  • itemviews
kviewstatesaver.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2010 Klarälvdalens Datakonsult AB,
3  a KDAB Group company, info@kdab.net,
4  author Stephen Kelly <stephen@kdab.com>
5 
6  This library is free software; you can redistribute it and/or modify it
7  under the terms of the GNU Library General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or (at your
9  option) any later version.
10 
11  This library is distributed in the hope that it will be useful, but WITHOUT
12  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
14  License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to the
18  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19  02110-1301, USA.
20 */
21 
22 #ifndef KVIEWSTATESAVER_H
23 #define KVIEWSTATESAVER_H
24 
25 #include <QtCore/QObject>
26 #include <QtCore/QPair>
27 
28 #include "kdeui_export.h"
29 
30 class QAbstractItemView;
31 class QItemSelectionModel;
32 class QAbstractItemModel;
33 class QAbstractScrollArea;
34 class QModelIndex;
35 class QStringList;
36 
37 class KConfigGroup;
38 
39 class KViewStateSaverPrivate;
40 
169 class KDEUI_EXPORT KViewStateSaver : public QObject
170 {
171  Q_OBJECT
172 public:
177  explicit KViewStateSaver(QObject *parent = 0);
178 
182  ~KViewStateSaver();
183 
187  QAbstractItemView* view() const;
188 
192  void setView(QAbstractItemView *view);
193 
197  QItemSelectionModel* selectionModel() const;
198 
202  void setSelectionModel( QItemSelectionModel *selectionModel );
203 
207  void saveState(KConfigGroup &configGroup);
208 
212  void restoreState(const KConfigGroup &configGroup);
213 
217  QStringList selectionKeys() const;
218 
222  QStringList expansionKeys() const;
223 
227  QString currentIndexKey() const;
228 
232  QPair<int, int> scrollState() const;
233 
237  void restoreSelection( const QStringList &indexStrings );
238 
242  void restoreCurrentItem( const QString &indexString );
243 
247  void restoreExpanded( const QStringList &indexStrings );
248 
253  void restoreScrollState( int verticalScoll, int horizontalScroll );
254 
255 protected:
259  virtual QModelIndex indexFromConfigString(const QAbstractItemModel *model, const QString &key) const = 0;
260 
264  virtual QString indexToConfigString(const QModelIndex &index) const = 0;
265 
266 private:
267  //@cond PRIVATE
268  Q_DECLARE_PRIVATE(KViewStateSaver)
269  KViewStateSaverPrivate * const d_ptr;
270  Q_PRIVATE_SLOT( d_func(), void rowsInserted( const QModelIndex&, int, int ) )
271  Q_PRIVATE_SLOT( d_func(), void restoreScrollBarState() )
272  //@endcond
273 };
274 
275 #endif
QItemSelectionModel
QString
QObject
QStringList
QAbstractItemModel
KConfigGroup
kdeui_export.h
QPair< int, int >
KViewStateSaver
Object for saving and restoring state in QTreeViews and QItemSelectionModels.
Definition: kviewstatesaver.h:169
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:49:16 by doxygen 1.8.7 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 API Reference

Skip menu "kdelibs 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
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



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