Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. multiple resize callbacks on QWindow when user drags corner

multiple resize callbacks on QWindow when user drags corner

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 219 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    scott_craig
    wrote on last edited by scott_craig
    #1

    When debugging an overriden resizeEvent for a QWindow derived class, if you drag a corner of the screen, it emits two resize events. If I maximize or minimize from the bar, its only one resize event. Any way to make it only one?

    The values are also very odd. For the first resize event the dimensions for dragging down from the top on width() and height are 1920x1079. The second resize event dimensions are 1920x1080.

    Edit* It sends two events, with one actually decreasing height by 1 pixel, then the second event has the same dimensions as the old. So it goes down by one pixel and back up.

    Are there any extraneous events that can trigger multiple resize events?

    void window::resizeEvent(QResizeEvent* ev) {
    const int w = width();
    const int h = height();
    }

    This is kind of an issue for me since recreating the graphics canvas twice is not performant.

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Don't redraw on a resize event but use a QTimer so you repaint only when e.g. the size did not change for 50ms or so.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      2

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved