Larger user card drag area (#3508)
Co-authored-by: pajlada <rasmus.karlsson@pajlada.com> Co-authored-by: Felanbird <41973452+Felanbird@users.noreply.github.com>
This commit is contained in:
@@ -6,6 +6,8 @@
|
||||
#include <pajlada/signals/scoped-connection.hpp>
|
||||
#include <pajlada/signals/signal.hpp>
|
||||
|
||||
#include <chrono>
|
||||
|
||||
class QCheckBox;
|
||||
|
||||
namespace chatterino {
|
||||
@@ -26,6 +28,9 @@ public:
|
||||
protected:
|
||||
virtual void themeChangedEvent() override;
|
||||
virtual void scaleChangedEvent(float scale) override;
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
void mouseReleaseEvent(QMouseEvent *event) override;
|
||||
void mouseMoveEvent(QMouseEvent *event) override;
|
||||
|
||||
private:
|
||||
void installEvents();
|
||||
@@ -41,6 +46,19 @@ private:
|
||||
QString avatarUrl_;
|
||||
ChannelPtr channel_;
|
||||
|
||||
// isMoving_ is set to true if the user is holding the left mouse button down and has moved the mouse a small amount away from the original click point (startPosDrag_)
|
||||
bool isMoving_ = false;
|
||||
|
||||
// startPosDrag_ is the coordinates where the user originally pressed the mouse button down to start dragging
|
||||
QPoint startPosDrag_;
|
||||
|
||||
// requestDragPos_ is the final screen coordinates where the widget should be moved to.
|
||||
// Takes the relative position of where the user originally clicked the widget into account
|
||||
QPoint requestedDragPos_;
|
||||
|
||||
// dragTimer_ is called ~60 times per second once the user has initiated dragging
|
||||
QTimer dragTimer_;
|
||||
|
||||
pajlada::Signals::NoArgSignal userStateChanged_;
|
||||
|
||||
std::unique_ptr<pajlada::Signals::ScopedConnection> refreshConnection_;
|
||||
|
||||
Reference in New Issue
Block a user