digiKam
dconfigdlgview.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-11-03
7  * Description : A dialog base class which can handle multiple pages.
8  *
9  * Copyright (C) 2009-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
10  * Copyright (C) 2006 by Tobias Koenig <tokoe at kde dot org>
11  *
12  * This program is free software; you can redistribute it
13  * and/or modify it under the terms of the GNU General
14  * Public License as published by the Free Software Foundation;
15  * either version 2, or (at your option)
16  * any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * ============================================================ */
24 
25 #ifndef DIGIKAM_DCONFIG_DLG_VIEW_H
26 #define DIGIKAM_DCONFIG_DLG_VIEW_H
27 
28 // Qt includes
29 
30 #include <QWidget>
31 
32 // Local includes
33 
34 #include "digikam_export.h"
35 
36 class QAbstractItemDelegate;
37 class QAbstractItemView;
38 class QModelIndex;
39 class QAbstractItemModel;
40 
41 namespace Digikam
42 {
43 
45 class DConfigDlgModel;
46 
58 class DIGIKAM_EXPORT DConfigDlgView : public QWidget
59 {
60  Q_OBJECT
61  Q_PROPERTY(FaceType faceType READ faceType WRITE setFaceType)
62  Q_DECLARE_PRIVATE(DConfigDlgView)
63 
64 public:
65 
83  enum FaceType
84  {
89  Tabbed
90  };
91  Q_ENUM(FaceType)
92 
93 public:
94 
98  explicit DConfigDlgView(QWidget* const parent = nullptr);
99 
103  ~DConfigDlgView() override;
104 
110  void setModel(QAbstractItemModel* model);
111 
115  QAbstractItemModel* model() const;
116 
120  void setFaceType(FaceType faceType);
121 
125  FaceType faceType() const;
126 
131  void setCurrentPage(const QModelIndex& index);
132 
137  QModelIndex currentPage() const;
138 
143  void setItemDelegate(QAbstractItemDelegate* delegate);
144 
148  QAbstractItemDelegate* itemDelegate() const;
149 
154  void setDefaultWidget(QWidget* widget);
155 
156 Q_SIGNALS:
157 
162  void currentPageChanged(const QModelIndex& current, const QModelIndex& previous);
163 
164 protected:
165 
173  virtual QAbstractItemView* createView();
174 
181  virtual bool showPageHeader() const;
182 
190  virtual Qt::Alignment viewPosition() const;
191 
192  DConfigDlgView(DConfigDlgViewPrivate& dd, QWidget* const parent);
193 
194 protected:
195 
197 
198 private:
199 
200  Q_PRIVATE_SLOT(d_func(), void _k_rebuildGui())
201  Q_PRIVATE_SLOT(d_func(), void _k_modelChanged())
202  Q_PRIVATE_SLOT(d_func(), void _k_pageSelected(const QItemSelection&, const QItemSelection&))
203  Q_PRIVATE_SLOT(d_func(), void _k_dataChanged(const QModelIndex&, const QModelIndex&))
204 };
205 
206 } // namespace Digikam
207 
208 #endif // DIGIKAM_DCONFIG_DLG_VIEW_H
A base class for a model used by DConfigDlgView.
Definition: dconfigdlgmodels.h:56
Definition: dconfigdlgview_p.h:77
A base class which can handle multiple pages.
Definition: dconfigdlgview.h:59
void currentPageChanged(const QModelIndex &current, const QModelIndex &previous)
DConfigDlgViewPrivate *const d_ptr
Definition: dconfigdlgview.h:196
FaceType
Definition: dconfigdlgview.h:84
@ Tree
Definition: dconfigdlgview.h:88
@ List
Definition: dconfigdlgview.h:87
@ Auto
Definition: dconfigdlgview.h:85
@ Plain
Definition: dconfigdlgview.h:86
Definition: datefolderview.cpp:43