Cockatrice 2026-10-19-Development-3.1.2-beta.2
A virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
resizable_panel.h
Go to the documentation of this file.
1#ifndef COCKATRICE_RESIZABLE_PANEL_H
2#define COCKATRICE_RESIZABLE_PANEL_H
3
4#include <QPoint>
5#include <QString>
6#include <QWidget>
7#include <qtmetamacros.h>
8
10class QFrame;
11class QPushButton;
12class QTimer;
13
14class ResizablePanel : public QWidget
15{
16 Q_OBJECT
17public:
18 explicit ResizablePanel(const QString &typeId,
19 AbstractAnalyticsPanelWidget *analyticsPanel,
20 QWidget *parent = nullptr);
21
22 void setSelected(bool selected);
23 void setHeightFromSaved(int h);
24 int getCurrentHeight() const;
25
26 QSize sizeHint() const override;
27 QSize minimumSizeHint() const override;
28
29 QString getTypeId() const
30 {
31 return typeId;
32 }
33
35
36signals:
38 void dropRequested(ResizablePanel *dragged, ResizablePanel *target, bool insertBefore);
39
40protected:
41 bool eventFilter(QObject *obj, QEvent *event) override;
42 void dragEnterEvent(QDragEnterEvent *event) override;
43 void dragMoveEvent(QDragMoveEvent *event) override;
44 void dragLeaveEvent(QDragLeaveEvent *event) override;
45 void dropEvent(QDropEvent *event) override;
46 void resizeEvent(QResizeEvent *event) override;
47
48private:
49 int getMinimumAllowedHeight() const;
51 void startDrag();
52 void performAutoScroll();
53 void showDropIndicator(double y);
54 void hideDropIndicator();
55
56 QString typeId;
57
58 QFrame *frame;
61 QPushButton *dragButton;
62 QWidget *resizeHandle;
63
65 bool isResizing = false;
66 bool isDraggingPanel = false;
67 double resizeStartY = 0;
69
73};
74
75#endif // COCKATRICE_RESIZABLE_PANEL_H
Definition abstract_analytics_panel_widget.h:18
QPushButton * dragButton
Definition resizable_panel.h:61
QPoint dragStartPos
Definition resizable_panel.h:70
QFrame * dropIndicator
Definition resizable_panel.h:60
QPoint lastDragPos
Definition resizable_panel.h:71
bool isResizing
Definition resizable_panel.h:65
void startDrag()
Definition resizable_panel.cpp:304
void setSelected(bool selected)
Definition resizable_panel.cpp:130
ResizablePanel(const QString &typeId, AbstractAnalyticsPanelWidget *analyticsPanel, QWidget *parent=nullptr)
Definition resizable_panel.cpp:33
void hideDropIndicator()
Definition resizable_panel.cpp:372
AbstractAnalyticsPanelWidget * panel
Definition resizable_panel.h:34
int resizeStartHeight
Definition resizable_panel.h:68
void resizeEvent(QResizeEvent *event) override
Definition resizable_panel.cpp:273
void dragEnterEvent(QDragEnterEvent *event) override
Definition resizable_panel.cpp:227
QTimer * autoScrollTimer
Definition resizable_panel.h:72
void dragMoveEvent(QDragMoveEvent *event) override
Definition resizable_panel.cpp:235
QSize minimumSizeHint() const override
Definition resizable_panel.cpp:158
QWidget * resizeHandle
Definition resizable_panel.h:62
void updateSizeConstraints()
Definition resizable_panel.cpp:297
void dragLeaveEvent(QDragLeaveEvent *event) override
Definition resizable_panel.cpp:248
double resizeStartY
Definition resizable_panel.h:67
void dropEvent(QDropEvent *event) override
Definition resizable_panel.cpp:255
QString typeId
Definition resizable_panel.h:56
int currentHeight
Definition resizable_panel.h:64
QSize sizeHint() const override
Definition resizable_panel.cpp:153
int getMinimumAllowedHeight() const
Definition resizable_panel.cpp:290
QString getTypeId() const
Definition resizable_panel.h:29
QFrame * frame
Definition resizable_panel.h:58
QFrame * selectionOverlay
Definition resizable_panel.h:59
void setHeightFromSaved(int h)
Definition resizable_panel.cpp:140
void dragStarted(ResizablePanel *panel)
int getCurrentHeight() const
Definition resizable_panel.cpp:148
void showDropIndicator(double y)
Definition resizable_panel.cpp:365
void performAutoScroll()
Definition resizable_panel.cpp:332
bool isDraggingPanel
Definition resizable_panel.h:66
bool eventFilter(QObject *obj, QEvent *event) override
Definition resizable_panel.cpp:167
void dropRequested(ResizablePanel *dragged, ResizablePanel *target, bool insertBefore)