| 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 |
* SPDX-FileCopyrightText: 2009-2010 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de> |
| 10 |
* SPDX-FileCopyrightText: 2010-2011 by Andi Clemens <andi dot clemens at gmail dot com> |
| 11 |
* SPDX-FileCopyrightText: 2009-2026 by Gilles Caulier <caulier dot gilles at gmail dot com> |
| 12 |
* |
| 13 |
* SPDX-License-Identifier: GPL-2.0-or-later |
| 14 |
* |
| 15 |
* ============================================================ */ |
| 16 |
|
| 17 |
#pragma once |
| 18 |
|
| 19 |
// Local includes |
| 20 |
|
| 21 |
#include "abstractcountingalbumtreeview.h" |
| 22 |
|
| 23 |
namespace Digikam |
| 24 |
{ |
| 25 |
|
| 26 |
class AbstractCheckableAlbumTreeView : public AbstractCountingAlbumTreeView |
| 27 |
{ |
| 28 |
Q_OBJECT |
| 29 |
|
| 30 |
public: |
| 31 |
|
| 32 |
/** |
| 33 |
* @note Models of these view _can_ be checkable, they need _not_. You need to enable it on the model. |
| 34 |
*/ |
| 35 |
explicit AbstractCheckableAlbumTreeView(QWidget* const parent, Flags flags); |
| 36 |
~AbstractCheckableAlbumTreeView() override; |
| 37 |
|
| 38 |
/** |
| 39 |
* @brief Manage check state through the model directly. |
| 40 |
*/ |
| 41 |
AbstractCheckableAlbumModel* checkableAlbumModel() const; |
| 42 |
CheckableAlbumFilterModel* checkableAlbumFilterModel() const; |
| 43 |
|
| 44 |
/** |
| 45 |
* @brief Enable checking on middle mouse button click (default: on). |
| 46 |
*/ |
| 47 |
void setCheckOnMiddleClick(bool doThat); |
| 48 |
|
| 49 |
/** |
| 50 |
* @brief Tells if the check state is restored while loading / saving state. |
| 51 |
* |
| 52 |
* @return true if restoring check state is active |
| 53 |
*/ |
| 54 |
bool isRestoreCheckState() const; |
| 55 |
|
| 56 |
/** |
| 57 |
* @brief Set whether to restore check state or not. |
| 58 |
* |
| 59 |
* @param restore if true, restore check state |
| 60 |
*/ |
| 61 |
void setRestoreCheckState(bool restore); |
| 62 |
|
| 63 |
void doLoadState() override; |
| 64 |
void doSaveState() override; |
| 65 |
|
| 66 |
protected: |
| 67 |
|
| 68 |
void middleButtonPressed(Album* a) override; |
| 69 |
void rowsInserted(const QModelIndex& parent, int start, int end) override; |
| 70 |
|
| 71 |
void setAlbumModel(AbstractCheckableAlbumModel* const model); |
| 72 |
virtual void setCheckableAlbumFilterModel(CheckableAlbumFilterModel* const filterModel); |
| 73 |
|
| 74 |
private: |
| 75 |
|
| 76 |
void restoreCheckStateForHierarchy(const QModelIndex& index); |
| 77 |
void restoreCheckState(const QModelIndex& index); |
| 78 |
|
| 79 |
private: |
| 80 |
|
| 81 |
class Private; |
| 82 |
Private* const d = nullptr; |
| 83 |
}; |
| 84 |
|
| 85 |
} // namespace Digikam |