Add comments
Signed-off-by: Danilo Aimini <82231674+AMZN-daimini@users.noreply.github.com>
This commit is contained in:
@@ -80,6 +80,14 @@ namespace AzQtComponents
|
||||
QPoint midPoint = targetRect.topLeft() + QPoint(targetRect.width() / 2, targetRect.height() / 2);
|
||||
QScreen* pointScreen = QApplication::screenAt(midPoint);
|
||||
QRect rect(targetRect);
|
||||
|
||||
// On environment with multiple screens with different scaling settings, the screen coordinate system may have gaps
|
||||
// due to the screen real estate shrinking according to the scale. When that happens, if a widget is moved into the gap
|
||||
// it will resize and translate with undefined behavior, causing a lot of jitter and flashes.
|
||||
// To prevent this, whenever the widget would end up outside screen boundaries, we resize the widget to be twice its
|
||||
// original size so that the center of the widget is back inside the screen boundaries, and set the ghost widget
|
||||
// to paint the widget pixmap at half the previous size to make the process seamless.
|
||||
// This makes the dragging a lot smoother in most situations.
|
||||
PaintMode paintMode = PaintMode::FULL;
|
||||
|
||||
if (!pointScreen || pointScreen != screen)
|
||||
|
||||
@@ -46,11 +46,12 @@ namespace AzQtComponents
|
||||
bool m_visible = false; // maintain our own flag, so that we're always ready to render ignoring Qt's widget caching system
|
||||
bool m_clipToWidgets = false;
|
||||
|
||||
//! Determines the way the ghost widget pixmap should be painted on the widget.
|
||||
enum class PaintMode
|
||||
{
|
||||
FULL = 0,
|
||||
BOTTOMLEFT,
|
||||
BOTTOMRIGHT
|
||||
FULL = 0, //!< Paint the pixmap on the full widget
|
||||
BOTTOMLEFT, //!< Paint the pixmap on the bottom left quarter of the widget, halving its size
|
||||
BOTTOMRIGHT //!< Paint the pixmap on the bottom right quarter of the widget, halving its size
|
||||
};
|
||||
|
||||
PaintMode m_paintMode = PaintMode::FULL;
|
||||
|
||||
Reference in New Issue
Block a user