Skip to content

Instantly share code, notes, and snippets.

@anytizer
Created January 3, 2026 23:37
Show Gist options
  • Select an option

  • Save anytizer/1975f84fce26955fa882c02ddc7685bc to your computer and use it in GitHub Desktop.

Select an option

Save anytizer/1975f84fce26955fa882c02ddc7685bc to your computer and use it in GitHub Desktop.
Update cursor while resizing...
// Determine the horizontal position
bool left = x <= MARGIN;
bool right = x >= w - MARGIN;
// Determine the vertical position
bool top = y <= MARGIN;
bool bottom = y >= h - MARGIN;
if (left && top) {
setCursor(Qt::SizeFDiagCursor); // Top-Left corner ( \ )
} else if (right && bottom) {
setCursor(Qt::SizeFDiagCursor); // Bottom-Right corner ( \ )
} else if (right && top) {
setCursor(Qt::SizeBDiagCursor); // Top-Right corner ( / )
} else if (left && bottom) {
setCursor(Qt::SizeBDiagCursor); // Bottom-Left corner ( / )
} else if (left || right) {
setCursor(Qt::SizeHorCursor); // Horizontal edges ( <-> )
} else if (top || bottom) {
setCursor(Qt::SizeVerCursor); // Vertical edges ( ^ v )
} else {
setCursor(Qt::ArrowCursor); // Center of window
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment