digiKam
Loading...
Searching...
No Matches
labelstreeview.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 : 2014-05-17
7 * Description : Album Labels Tree View.
8 *
9 * SPDX-FileCopyrightText: 2014-2015 by Mohamed_Anwer <m_dot_anwer at gmx dot com>
10 * SPDX-FileCopyrightText: 2014-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
11 *
12 * SPDX-License-Identifier: GPL-2.0-or-later
13 *
14 * ============================================================ */
15
16#pragma once
17
18// Qt includes
19
20#include <QTreeWidget>
21
22// Local includes
23
24#include "coredbconstants.h"
25#include "album.h"
26#include "statesavingobject.h"
27#include "itemlisterrecord.h"
28
29namespace Digikam
30{
31
32class LabelsTreeView : public QTreeWidget, public StateSavingObject
33{
34 Q_OBJECT
35
36public:
37
38 enum Labels
39 {
42 Colors
43 };
44
45public:
46
47 explicit LabelsTreeView(QWidget* const parent = nullptr, bool setCheckable = false);
48 ~LabelsTreeView() override;
49
54 bool isCheckable() const;
55
59 bool isLoadingState() const;
60
65 QPixmap goldenStarPixmap(bool fillin=true) const;
66
74 QPixmap colorRectPixmap(const QColor& color) const;
75
84 QHash<Labels, QList<int> > selectedLabels();
85
90 void doLoadState() override;
91 void doSaveState() override;
92
101 void restoreSelectionFromHistory(QHash<Labels, QList<int> > neededLabels);
102
107 void setCurrentAlbum();
108
109private:
110
114 void initTreeView();
115 void initRatingsTree();
116 void initPicksTree();
117 void initColorsTree();
118
122 QTreeWidgetItem* getOrCreateItem(QTreeWidgetItem* const parent);
123
124private Q_SLOTS:
125
126 void slotSettingsChanged();
127
128Q_SIGNALS:
129
131
132private:
133
134 class Private;
135 Private* const d = nullptr;
136};
137
138} // namespace Digikam
Definition labelstreeview.h:33
void doLoadState() override
Loading and saving state function inherited from StateSavingObject.
Definition labelstreeview.cpp:273
QHash< Labels, QList< int > > selectedLabels()
Provide the current selection from the tree-view hierarchy.
Definition labelstreeview.cpp:214
QPixmap colorRectPixmap(const QColor &color) const
Creates a 30*30 rectangular pixmap with specific color.
Definition labelstreeview.cpp:198
Labels
Definition labelstreeview.h:39
@ Ratings
Definition labelstreeview.h:40
@ Colors
Definition labelstreeview.h:42
@ Picks
Definition labelstreeview.h:41
void setCurrentAlbum()
Emits a signal to the search handler to set the Current album from currently selected labels.
Definition labelstreeview.cpp:381
void doSaveState() override
Definition labelstreeview.cpp:353
void restoreSelectionFromHistory(QHash< Labels, QList< int > > neededLabels)
Restores the selection state from the AlbumHistory class.
Definition labelstreeview.cpp:535
QPixmap goldenStarPixmap(bool fillin=true) const
Definition labelstreeview.cpp:168
~LabelsTreeView() override
Definition labelstreeview.cpp:128
bool isCheckable() const
Definition labelstreeview.cpp:133
bool isLoadingState() const
Definition labelstreeview.cpp:138
Definition statesavingobject.h:66
Definition datefolderview.cpp:34