mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-09 01:23:57 -07:00
[VDE] Deck Analytics Widgets overhaul (#6463)
* [VDE] Deck Analytics Widgets overhaul Took 2 minutes Took 3 minutes Took 3 minutes * Qt5 version guards. Took 33 minutes Took 3 seconds * Include QtMath Took 3 minutes Took 8 seconds * Use getCards() Took 4 minutes * Non pointer stuff Took 52 seconds * Add a newline to the tooltip Took 2 minutes Took 27 seconds * Fix build failure on macOS 15 * Rename some things. Took 17 minutes Took 11 seconds Took 18 seconds * Address overloads, fix default configuration. Took 1 hour 9 minutes Took 8 seconds * Fix mana curve default config. Took 4 minutes * Namespace to Qt libs Took 5 minutes * Selection overlay is transparent for mouse events. Took 2 minutes * Brace initialize. Took 8 minutes * Debian 11. Took 5 minutes --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de> Co-authored-by: RickyRister <ricky.rister.wang@gmail.com>
This commit is contained in:
parent
36d8280765
commit
df9a8b2272
81 changed files with 4372 additions and 394 deletions
|
|
@ -0,0 +1,79 @@
|
|||
#ifndef COCKATRICE_RESIZABLE_PANEL_H
|
||||
#define COCKATRICE_RESIZABLE_PANEL_H
|
||||
|
||||
#include "abstract_analytics_panel_widget.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDrag>
|
||||
#include <QFrame>
|
||||
#include <QMimeData>
|
||||
#include <QMouseEvent>
|
||||
#include <QPushButton>
|
||||
#include <QScrollArea>
|
||||
#include <QScrollBar>
|
||||
#include <QTimer>
|
||||
#include <QVBoxLayout>
|
||||
#include <QWidget>
|
||||
|
||||
class ResizablePanel : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ResizablePanel(const QString &typeId,
|
||||
AbstractAnalyticsPanelWidget *analyticsPanel,
|
||||
QWidget *parent = nullptr);
|
||||
|
||||
void setSelected(bool selected);
|
||||
void setHeightFromSaved(int h);
|
||||
int getCurrentHeight() const;
|
||||
|
||||
QSize sizeHint() const override;
|
||||
QSize minimumSizeHint() const override;
|
||||
|
||||
QString getTypeId() const
|
||||
{
|
||||
return typeId;
|
||||
}
|
||||
|
||||
AbstractAnalyticsPanelWidget *panel;
|
||||
|
||||
signals:
|
||||
void dragStarted(ResizablePanel *panel);
|
||||
void dropRequested(ResizablePanel *dragged, ResizablePanel *target, bool insertBefore);
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *obj, QEvent *event) override;
|
||||
void dragEnterEvent(QDragEnterEvent *event) override;
|
||||
void dragMoveEvent(QDragMoveEvent *event) override;
|
||||
void dragLeaveEvent(QDragLeaveEvent *event) override;
|
||||
void dropEvent(QDropEvent *event) override;
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
|
||||
private:
|
||||
int getMinimumAllowedHeight() const;
|
||||
void updateSizeConstraints();
|
||||
void startDrag();
|
||||
void performAutoScroll();
|
||||
void showDropIndicator(double y);
|
||||
void hideDropIndicator();
|
||||
|
||||
QString typeId;
|
||||
|
||||
QFrame *frame;
|
||||
QFrame *selectionOverlay;
|
||||
QFrame *dropIndicator;
|
||||
QPushButton *dragButton;
|
||||
QWidget *resizeHandle;
|
||||
|
||||
int currentHeight;
|
||||
bool isResizing = false;
|
||||
bool isDraggingPanel = false;
|
||||
double resizeStartY = 0;
|
||||
int resizeStartHeight = 0;
|
||||
|
||||
QPoint dragStartPos;
|
||||
QPoint lastDragPos;
|
||||
QTimer *autoScrollTimer;
|
||||
};
|
||||
|
||||
#endif // COCKATRICE_RESIZABLE_PANEL_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue