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. Blank window using two screens
Forum Updated to NodeBB v4.3 + New Features

Blank window using two screens

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 402 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.
  • ivanicyI Offline
    ivanicyI Offline
    ivanicy
    wrote on last edited by
    #1

    Hello!!

    This is a little strange issue. I am using two screens, and I have an application that opens different windows.

    One of these windows, has a little problem. These are the steps for reproduce the issue:

    1. Open the window.
    2. Move the window to the second screen.
    3. Close the window.
    4. Open the window again. The window appears blank and when I click the area in which there is a widget, the window shows normal again.

    Could you help me with this??

    Thank you very much!

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

      Which Qt version do you use? Can you please provide a minimal, compilable example to reproduce the problem / we can see what you're actually doing?

      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
      • ivanicyI Offline
        ivanicyI Offline
        ivanicy
        wrote on last edited by
        #3

        I found a solution:

        Use this code in the part where you want to show the window:

        if (QApplication::desktop()->screenCount() > 1) {
            myWindow->setGeometry(
                QStyle::alignedRect(Qt::LeftToRight, 
                                    Qt::AlignCenter, 
                                    myWindow->size(), 
                                    QApplication::desktop()->availableGeometry(0)));
        }
        myWindow->show();
        

        This solves my problem

        1 Reply Last reply
        1

        • Login

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