digiKam
abstractcheckablealbumtreeview.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2009-03-25
7  * Description : Tree View for album models
8  *
9  * Copyright (C) 2009-2010 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
10  * Copyright (C) 2010-2011 by Andi Clemens <andi dot clemens at gmail dot com>
11  * Copyright (C) 2009-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
12  *
13  * This program is free software; you can redistribute it
14  * and/or modify it under the terms of the GNU General
15  * Public License as published by the Free Software Foundation;
16  * either version 2, or (at your option)
17  * any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU General Public License for more details.
23  *
24  * ============================================================ */
25 
26 #ifndef DIGIKAM_ABSTRACT_CHECKABLE_ALBUM_TREE_VIEW_H
27 #define DIGIKAM_ABSTRACT_CHECKABLE_ALBUM_TREE_VIEW_H
28 
29 // Local includes
30 
32 
33 namespace Digikam
34 {
35 
37 {
38  Q_OBJECT
39 
40 public:
41 
43 
44  explicit AbstractCheckableAlbumTreeView(QWidget* const parent, Flags flags);
45 
47 
51 
53  {
54  return albumModel();
55  }
56 
58  {
59  return albumFilterModel();
60  }
61 
63  void setCheckOnMiddleClick(bool doThat);
64 
70  bool isRestoreCheckState() const;
71 
77  void setRestoreCheckState(bool restore);
78 
79  void doLoadState() override;
80  void doSaveState() override;
81 
82 protected:
83 
84  void middleButtonPressed(Album* a) override;
85  void rowsInserted(const QModelIndex& parent, int start, int end) override;
86 
87 private:
88 
89  void restoreCheckStateForHierarchy(const QModelIndex& index);
90  void restoreCheckState(const QModelIndex& index);
91 
92 private:
93 
94  class Private;
95  Private* d;
96 };
97 
98 } // namespace Digikam
99 
100 #endif // DIGIKAM_ABSTRACT_CHECKABLE_ALBUM_TREE_VIEW_H
Definition: abstractalbummodel.h:358
Definition: abstractcheckablealbumtreeview.h:37
AbstractCheckableAlbumTreeView(QWidget *const parent, Flags flags)
Models of these view can be checkable, they need not. You need to enable it on the model.
Definition: abstractcheckablealbumtreeview.cpp:63
void doLoadState() override
Definition: abstractcheckablealbumtreeview.cpp:139
void setCheckOnMiddleClick(bool doThat)
Enable checking on middle mouse button click (default: on)
Definition: abstractcheckablealbumtreeview.cpp:91
bool isRestoreCheckState() const
Definition: abstractcheckablealbumtreeview.cpp:129
void doSaveState() override
Definition: abstractcheckablealbumtreeview.cpp:238
void rowsInserted(const QModelIndex &parent, int start, int end) override
Definition: abstractcheckablealbumtreeview.cpp:190
CheckableAlbumFilterModel * checkableAlbumFilterModel() const
Definition: abstractcheckablealbumtreeview.h:57
AbstractCheckableAlbumModel * checkableModel() const
Definition: abstractcheckablealbumtreeview.h:52
AbstractCheckableAlbumModel * albumModel() const
Manage check state through the model directly.
Definition: abstractcheckablealbumtreeview.cpp:81
CheckableAlbumFilterModel * albumFilterModel() const
Definition: abstractcheckablealbumtreeview.cpp:86
~AbstractCheckableAlbumTreeView() override
Definition: abstractcheckablealbumtreeview.cpp:76
void middleButtonPressed(Album *a) override
Definition: abstractcheckablealbumtreeview.cpp:96
void setRestoreCheckState(bool restore)
Definition: abstractcheckablealbumtreeview.cpp:134
Definition: abstractcountingalbumtreeview.h:37
Abstract base class for all album types.
Definition: album.h:67
Definition: albumfiltermodel.h:294
Definition: datefolderview.cpp:43