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. BUG: After using second monitor, control window won't appear on single monitor mode anymore...

BUG: After using second monitor, control window won't appear on single monitor mode anymore...

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 1.0k 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.
  • D Offline
    D Offline
    derb
    wrote on last edited by
    #1

    hi
    if got a weird and very anoying problem. At home I use to attach my laptop to a second screen so work is more comfortable. but since i did this, as soon as i work only with my laptop screen again, the control panel of a qt window, won't appear anymore. my guess is, that is still kinda opens on the other screen.
    as soon as im attachted to the second monitor again, everything works properly again.
    Does anyone know this problem? maybe a workaround to it?

    thanks for any help

    cheers

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

      Hi and welcome to devnet,

      Do you somewhere store your application geometry ? If so you could check whether the widget is on an available desktop using QDesktopWidget and if not, put it back on the default desktop widget

      Hope it helps

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • D Offline
        D Offline
        derb
        wrote on last edited by
        #3

        Hi SGalst
        No I'm not saving the geometries myself. but I'm just searching for such a file in the qt-files. Hopefully I will find anything there.
        As far as i know, there is no method to position the control frame, is that right?

        1 Reply Last reply
        0
        • raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by
          #4

          in addition to SGaist you could also do this to ensure that all windows of your applications are visible when the screen count changes:
          @
          connect( QApplication::desktop(), SIGNAL(screenCountChanged(int)), this, SLOT(onScreenCountChanged()) );
          ...
          void onScreenCountChanged()
          {
          QRect screenGeom = QApplication::desktop()->screen()->geometry(); //combined geometry of all (virtual) screens
          foreach (QWidget *widget, QApplication::topLevelWidgets())
          {
          QRect widgetGeom = widget->geometry();
          widgetGeom.moveRight( qMin( screenGeom.right(), widgetGeom.right() );
          widgetGeom.moveBottom( qMin( screenGeom.bottom(), widgetGeom.bottom() );
          widgetGeom.moveLeft( qMax( screenGeom.left(), widgetGeom.left() );
          widgetGeom.moveTop( qMax( screenGeom.top(), widgetGeom.top() );
          widget->setGeometry(widgetGeom);
          }
          }
          @
          (You might also consider the frameGeometry() of the widget)

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          1 Reply Last reply
          0
          • D Offline
            D Offline
            derb
            wrote on last edited by
            #5

            hey thanks.
            I guess I did hold back some informations.
            I develope with VS 2010 and use the qt only as plugin of OpenCV. therefor I guess this code might not run, as i don't have the full library support.

            Would it be an idea to create a library for my project using the qtCreator?

            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