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. How to keep physical window size constant when working with multiple monitors?
Forum Update on Monday, May 27th 2025

How to keep physical window size constant when working with multiple monitors?

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 2 Posters 847 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.
  • Q Offline
    Q Offline
    Qt_User72653
    wrote on last edited by
    #1

    I have a frameless window with a custom drop shadow applied to it, with a fixed sized widget in the window. The issue I'm having is that if I move the window between monitors with different DPIs the window resizes, which results in the drop shadow being drawn in the top left corner of the window, while the widget is drawn on the bottom right. The effect is that the drop shadow is 'split' from the widget when the window is resized.

    Is there any way to prevent a window from being resized in this case? I tried setting the size policy of it but that didn't work.

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      Do you intercept resizeEvent and recalculate the drop shadow ?
      also
      if you do this->setFixedSize(500,500);
      and qDebug () << this->width() << " - " << this->height();
      once moved. What does it say ?
      ( "this" is most likely mainwindow)

      Q 1 Reply Last reply
      1
      • mrjjM mrjj

        Hi
        Do you intercept resizeEvent and recalculate the drop shadow ?
        also
        if you do this->setFixedSize(500,500);
        and qDebug () << this->width() << " - " << this->height();
        once moved. What does it say ?
        ( "this" is most likely mainwindow)

        Q Offline
        Q Offline
        Qt_User72653
        wrote on last edited by Qt_User72653
        #3

        @mrjj said in How to keep physical window size constant when working with multiple monitors?:

        Do you intercept resizeEvent and recalculate the drop shadow ?

        No, I was hoping to just be able to 'cancel' the window resize.

        It looks like my mistake was in thinking that I wouldn't have to manually resize the drop shadow and the window.

        1 Reply Last reply
        0
        • mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          what values did u get from the test ?

          Q 1 Reply Last reply
          0
          • mrjjM mrjj

            what values did u get from the test ?

            Q Offline
            Q Offline
            Qt_User72653
            wrote on last edited by
            #5

            @mrjj

            500 and 500. It wasn't a Qt problem, just my understanding of how to fix the issue.

            1 Reply Last reply
            1
            • mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Hi
              Ok super. just wanted to be sure. i assumed the mere movement would call for
              a recalc since its other monitor.

              1 Reply Last reply
              0

              • Login

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