digiKam
albumselectcombobox.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-05-09
7  * Description : A combo box for selecting albums
8  *
9  * Copyright (C) 2008-2011 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) 2012-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_ALBUM_SELECT_COMBO_BOX_H
27 #define DIGIKAM_ALBUM_SELECT_COMBO_BOX_H
28 
29 // Local includes
30 
31 #include "comboboxutilities.h"
32 
33 class QSortFilterProxyModel;
34 
35 namespace Digikam
36 {
37 
38 class AlbumFilterModel;
39 class AbstractCheckableAlbumModel;
40 
42 {
43  Q_OBJECT
44 
45 public:
46 
47  explicit AlbumSelectComboBox(QWidget* const parent = nullptr);
48  ~AlbumSelectComboBox() override;
49 
57  void setDefaultAlbumModel();
58  void setDefaultTagModel();
60  AlbumFilterModel* filterModel = nullptr);
61 
65  void setCheckable(bool checkable);
66  bool isCheckable() const;
67 
71  void setCloseOnActivate(bool close);
72 
77  void setShowCheckStateSummary(bool show);
78 
84  void setNoSelectionText(const QString& text);
85 
90 
94  QSortFilterProxyModel* filterModel() const;
95 
96 public Q_SLOTS:
97 
98  void hidePopup() override;
99 
104  virtual void updateText();
105 
106 protected:
107 
108  void installView(QAbstractItemView* view = nullptr) override;
109 
110 private:
111 
112  class Private;
113  Private* const d;
114 };
115 
116 // ------------------------------------------------------------------------------------
117 
119 class AlbumModel;
120 class AlbumTreeView;
123 class TagModel;
124 class TagTreeView;
125 
127 {
128  Q_OBJECT
129 
130 public:
131 
138  explicit AbstractAlbumTreeViewSelectComboBox(QWidget* const parent = nullptr);
139 
145  void setTreeView(AbstractAlbumTreeView* const treeView);
146 
153 
154 protected:
155 
156  void installView(QAbstractItemView* view = nullptr) override;
157  void sendViewportEventToView(QEvent* e) override;
158 
159 protected:
160 
162 };
163 
164 // ------------------------------------------------------------------------------------
165 
167 {
168  Q_OBJECT
169 
170 public:
171 
172  explicit AlbumTreeViewSelectComboBox(QWidget* const parent = nullptr);
173 
174  void setDefaultModel();
177  AlbumTreeView* view() const;
178 };
179 
180 // ------------------------------------------------------------------------------------
181 
183 {
184  Q_OBJECT
185 
186 public:
187 
188  explicit TagTreeViewSelectComboBox(QWidget* const parent = nullptr);
189 
190  void setDefaultModel();
192  TagPropertiesFilterModel* filteredModel = nullptr,
194  TagTreeView* view() const;
195 };
196 
197 } // namespace Digikam
198 
199 #endif // DIGIKAM_ALBUM_SELECT_COMBO_BOX_H
Definition: albumselectcombobox.h:127
void installView(QAbstractItemView *view=nullptr) override
Definition: albumselectcombobox.cpp:313
void addCheckUncheckContextMenuActions()
Definition: albumselectcombobox.cpp:367
void setTreeView(AbstractAlbumTreeView *const treeView)
Definition: albumselectcombobox.cpp:330
AbstractAlbumTreeViewSelectComboBox(QWidget *const parent=nullptr)
Definition: albumselectcombobox.cpp:307
AbstractAlbumTreeView * m_treeView
Definition: albumselectcombobox.h:161
void sendViewportEventToView(QEvent *e) override
Definition: albumselectcombobox.cpp:323
Definition: abstractalbumtreeview.h:63
Definition: abstractalbummodel.h:358
Definition: albumfiltermodel.h:45
Definition: albummodel.h:40
Definition: albumselectcombobox.h:42
void setDefaultAlbumModel()
Definition: albumselectcombobox.cpp:95
~AlbumSelectComboBox() override
Definition: albumselectcombobox.cpp:90
void setCloseOnActivate(bool close)
Definition: albumselectcombobox.cpp:184
void setDefaultTagModel()
Definition: albumselectcombobox.cpp:102
void hidePopup() override
Definition: albumselectcombobox.cpp:236
void setCheckable(bool checkable)
Definition: albumselectcombobox.cpp:147
virtual void updateText()
Definition: albumselectcombobox.cpp:244
QSortFilterProxyModel * filterModel() const
Definition: albumselectcombobox.cpp:231
void installView(QAbstractItemView *view=nullptr) override
Definition: albumselectcombobox.cpp:134
AlbumSelectComboBox(QWidget *const parent=nullptr)
Definition: albumselectcombobox.cpp:77
AbstractCheckableAlbumModel * model() const
Definition: albumselectcombobox.cpp:226
bool isCheckable() const
Definition: albumselectcombobox.cpp:158
void setShowCheckStateSummary(bool show)
Definition: albumselectcombobox.cpp:220
void setNoSelectionText(const QString &text)
Definition: albumselectcombobox.cpp:214
void setAlbumModels(AbstractCheckableAlbumModel *model, AlbumFilterModel *filterModel=nullptr)
Definition: albumselectcombobox.cpp:108
Definition: albumselectcombobox.h:167
void setAlbumModels(AlbumModel *model, CheckableAlbumFilterModel *filterModel=nullptr)
Definition: albumselectcombobox.cpp:393
AlbumTreeView * view() const
Definition: albumselectcombobox.cpp:383
AlbumTreeViewSelectComboBox(QWidget *const parent=nullptr)
Definition: albumselectcombobox.cpp:378
void setDefaultModel()
Definition: albumselectcombobox.cpp:388
Definition: albumtreeview.h:37
Definition: albumfiltermodel.h:294
Definition: albummodel.h:63
Definition: albumfiltermodel.h:376
Definition: albumselectcombobox.h:183
TagTreeViewSelectComboBox(QWidget *const parent=nullptr)
Definition: albumselectcombobox.cpp:421
void setAlbumModels(TagModel *model, TagPropertiesFilterModel *filteredModel=nullptr, CheckableAlbumFilterModel *filterModel=nullptr)
Definition: albumselectcombobox.cpp:436
void setDefaultModel()
Definition: albumselectcombobox.cpp:431
TagTreeView * view() const
Definition: albumselectcombobox.cpp:426
Definition: tagtreeview.h:37
QTreeView * view() const
Definition: comboboxutilities.cpp:383
Definition: comboboxutilities.h:272
Definition: datefolderview.cpp:43