File indexing completed on 2025-01-19 03:53:21
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2009-03-25 0007 * Description : Tree View for album models 0008 * 0009 * SPDX-FileCopyrightText: 2009-2010 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de> 0010 * SPDX-FileCopyrightText: 2010-2011 by Andi Clemens <andi dot clemens at gmail dot com> 0011 * SPDX-FileCopyrightText: 2009-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0012 * 0013 * SPDX-License-Identifier: GPL-2.0-or-later 0014 * 0015 * ============================================================ */ 0016 0017 #ifndef DIGIKAM_ABSTRACT_CHECKABLE_ALBUM_TREE_VIEW_H 0018 #define DIGIKAM_ABSTRACT_CHECKABLE_ALBUM_TREE_VIEW_H 0019 0020 // Local includes 0021 0022 #include "abstractcountingalbumtreeview.h" 0023 0024 namespace Digikam 0025 { 0026 0027 class AbstractCheckableAlbumTreeView : public AbstractCountingAlbumTreeView 0028 { 0029 Q_OBJECT 0030 0031 public: 0032 0033 /// Models of these view _can_ be checkable, they need _not_. You need to enable it on the model. 0034 0035 explicit AbstractCheckableAlbumTreeView(QWidget* const parent, Flags flags); 0036 0037 ~AbstractCheckableAlbumTreeView() override; 0038 0039 /// Manage check state through the model directly 0040 AbstractCheckableAlbumModel* albumModel() const; 0041 CheckableAlbumFilterModel* albumFilterModel() const; 0042 0043 AbstractCheckableAlbumModel* checkableModel() const 0044 { 0045 return albumModel(); 0046 } 0047 0048 CheckableAlbumFilterModel* checkableAlbumFilterModel() const 0049 { 0050 return albumFilterModel(); 0051 } 0052 0053 /// Enable checking on middle mouse button click (default: on) 0054 void setCheckOnMiddleClick(bool doThat); 0055 0056 /** 0057 * Tells if the check state is restored while loading / saving state. 0058 * 0059 * @return true if restoring check state is active 0060 */ 0061 bool isRestoreCheckState() const; 0062 0063 /** 0064 * Set whether to restore check state or not. 0065 * 0066 * @param restore if true, restore check state 0067 */ 0068 void setRestoreCheckState(bool restore); 0069 0070 void doLoadState() override; 0071 void doSaveState() override; 0072 0073 protected: 0074 0075 void middleButtonPressed(Album* a) override; 0076 void rowsInserted(const QModelIndex& parent, int start, int end) override; 0077 0078 private: 0079 0080 void restoreCheckStateForHierarchy(const QModelIndex& index); 0081 void restoreCheckState(const QModelIndex& index); 0082 0083 private: 0084 0085 class Private; 0086 Private* d; 0087 }; 0088 0089 } // namespace Digikam 0090 0091 #endif // DIGIKAM_ABSTRACT_CHECKABLE_ALBUM_TREE_VIEW_H