File indexing completed on 2025-01-05 03:56:39

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2012-01-13
0007  * Description : progress manager
0008  *
0009  * SPDX-FileCopyrightText: 2007-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0010  * SPDX-FileCopyrightText: 2004      by David Faure <faure at kde dot org>
0011  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 #ifndef DIGIKAM_OVERLAY_WIDGET_H
0017 #define DIGIKAM_OVERLAY_WIDGET_H
0018 
0019 // Local includes
0020 
0021 #include "dlayoutbox.h"
0022 #include "digikam_export.h"
0023 
0024 class QResizeEvent;
0025 class QEvent;
0026 
0027 namespace Digikam
0028 {
0029 
0030 /**
0031  * This is a widget that can align itself with another one, without using a layout,
0032  * so that it can actually be on top of other widgets.
0033  * Currently the only supported type of alignment is "right aligned, on top of the other widget".
0034  *
0035  * OverlayWidget inherits DHBox for convenience purposes (layout, and frame)
0036  */
0037 class DIGIKAM_EXPORT OverlayWidget : public DHBox
0038 {
0039     Q_OBJECT
0040 
0041 public:
0042 
0043     explicit OverlayWidget(QWidget* const alignWidget, QWidget* const parent, const QString& name = QString());
0044     ~OverlayWidget() override;
0045 
0046     QWidget* alignWidget() const;
0047     void     setAlignWidget(QWidget* const alignWidget);
0048 
0049 protected:
0050 
0051     void resizeEvent(QResizeEvent* ev)      override;
0052     bool eventFilter(QObject* o, QEvent* e) override;
0053 
0054 private:
0055 
0056     void reposition();
0057 
0058 private:
0059 
0060     QWidget* mAlignWidget;
0061 };
0062 
0063 } // namespace Digikam
0064 
0065 #endif // DIGIKAM_OVERLAY_WIDGET_H