Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

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

    General and Desktop
    3
    5
    813
    Loading More Posts
    • 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
      derb last edited by

      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 Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        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 Reply Quote 0
        • D
          derb last edited by

          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 Reply Quote 0
          • raven-worx
            raven-worx Moderators last edited by

            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 Reply Quote 0
            • D
              derb last edited by

              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 Reply Quote 0
              • First post
                Last post