digiKam
Loading...
Searching...
No Matches
thumbbardock.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-15-08
7 * Description : A floatable/dockable widget for thumbnail bars (ThumbBarView
8 * and its descendants), providing i drag handle similar to the
9 * one on toolbars and a standard Action to show/hide the
10 * thumbnail bar. It inherits QDockWidget and can be used in
11 * the dock area's of a QMainWindow.
12 *
13 * SPDX-FileCopyrightText: 2009 by Pieter Edelman <p dot edelman at gmx dot net>
14 *
15 * SPDX-License-Identifier: GPL-2.0-or-later
16 *
17 * ============================================================ */
18
19#pragma once
20
21// Qt includes
22
23#include <QDockWidget>
24#include <QPainter>
25#include <QString>
26#include <QStyle>
27#include <QStyleOptionToolBar>
28#include <QMainWindow>
29#include <QAction>
30
31// Local includes
32
33#include "digikam_export.h"
34
35namespace Digikam
36{
37
41class DragHandle : public QWidget
42{
43 Q_OBJECT
44
45public:
46
47 explicit DragHandle(QDockWidget* const);
48 ~DragHandle() override;
49
50 QSize sizeHint() const override;
51 QSize minimumSizeHint() const override;
52
53protected:
54
55 void paintEvent(QPaintEvent*) override;
56
57private Q_SLOTS:
58
59 void dockLocationChanged(Qt::DockWidgetArea);
60
61private:
62
63 class Private;
64 Private* const d = nullptr;
65};
66
67// --------------------------------------------------------------------------------
68
73class DIGIKAM_EXPORT ThumbBarDock : public QDockWidget
74{
75 Q_OBJECT
76
77public:
78
80 {
84 SHOULD_BE_SHOWN
85 };
86
87public:
88
89 explicit ThumbBarDock(QWidget* const parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags());
90 ~ThumbBarDock() override = default;
91
98 void reInitialize();
99
103 QAction* getToggleAction(QObject* const parent,
104 const QString& caption = QString()) const;
105
116 bool shouldBeVisible() const;
117 void setShouldBeVisible(bool);
118 void restoreVisibility();
119
120 static QPixmap generateFuzzyRect(const QSize& size, const QColor& color, int radius, const QColor& fillColor = Qt::transparent);
121 static QPixmap generateFuzzyRectForGroup(const QSize& size, const QColor& color, int radius);
122
123public Q_SLOTS:
124
125 void showThumbBar(bool);
126
127private:
128
129 Visibility m_visible = SHOULD_BE_SHOWN;
130};
131
132} // namespace Digikam
Definition thumbbardock.h:42
void paintEvent(QPaintEvent *) override
Definition thumbbardock.cpp:63
QSize minimumSizeHint() const override
Definition thumbbardock.cpp:144
QSize sizeHint() const override
Definition thumbbardock.cpp:122
~DragHandle() override
Definition thumbbardock.cpp:58
Definition thumbbardock.h:74
Visibility
Definition thumbbardock.h:80
@ WAS_SHOWN
Definition thumbbardock.h:82
@ SHOULD_BE_HIDDEN
Definition thumbbardock.h:83
@ WAS_HIDDEN
Definition thumbbardock.h:81
~ThumbBarDock() override=default
Definition datefolderview.cpp:34