File indexing completed on 2025-07-06 04:14:47

0001 /*
0002     SPDX-FileCopyrightText: 2004 David Faure <faure@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #ifndef KDEVPLATFORM_OVERLAYWIDGET_H
0008 #define KDEVPLATFORM_OVERLAYWIDGET_H
0009 
0010 #include <QWidget>
0011 
0012 namespace KDevelop {
0013 
0014 /**
0015  * This is a widget that can align itself with another one, without using a layout,
0016  * so that it can actually be on top of other widgets.
0017  * Currently the only supported type of alignment is "right aligned, on top of the other widget".
0018  */
0019 class OverlayWidget : public QWidget
0020 {
0021     Q_OBJECT
0022 
0023 public:
0024     OverlayWidget( QWidget* alignWidget, QWidget* parent, const char* name = nullptr );
0025     ~OverlayWidget() override;
0026 
0027     QWidget * alignWidget() { return mAlignWidget; }
0028     void setAlignWidget( QWidget * alignWidget );
0029 
0030 protected:
0031     void resizeEvent( QResizeEvent* ev ) override;
0032     bool eventFilter( QObject* o, QEvent* e) override;
0033 
0034 private:
0035     void reposition();
0036 
0037 private:
0038     QWidget * mAlignWidget;
0039 };
0040 
0041 } // namespace
0042 
0043 #endif /* OVERLAYWIDGET_H */
0044