LeechCraft 0.6.70-17609-g3dde4097dd
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
autoresizemixin.h
Go to the documentation of this file.
1/**********************************************************************
2 * LeechCraft - modular cross-platform feature rich internet client.
3 * Copyright (C) 2006-2014 Georg Rudoy
4 *
5 * Distributed under the Boost Software License, Version 1.0.
6 * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7 **********************************************************************/
8
9#pragma once
10
11#include <functional>
12#include <QObject>
13#include <QPoint>
14#include <QRect>
15#include "guiconfig.h"
16
17class QWidget;
18class QWindow;
19
20namespace LC::Util
21{
44 class AutoResizeMixin : public QObject
45 {
46 const QPoint OrigPoint_;
47
48 const std::function<void (QPoint)> Mover_;
49 public:
52 using RectGetter_f = std::function<QRect ()>;
53 private:
54 const RectGetter_f Rect_;
55 public:
68 UTIL_GUI_API AutoResizeMixin (const QPoint& point, RectGetter_f rect, QWidget *widget);
69
82 UTIL_GUI_API AutoResizeMixin (const QPoint& point, RectGetter_f rect, QWindow *window);
83
86 bool eventFilter (QObject*, QEvent*) override;
87 private:
88 void Refit (const QSize&);
89 };
90}
std::function< QRect()> RectGetter_f
A function type used to get the rect to fit widget in.
UTIL_GUI_API AutoResizeMixin(const QPoint &point, RectGetter_f rect, QWidget *widget)
Constructs the resize mixin.
bool eventFilter(QObject *, QEvent *) override
Listens for resize events and refits the widget.
#define UTIL_GUI_API
Definition guiconfig.h:16