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



  • 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


  • Lifetime Qt Champion

    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



  • 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?


  • Moderators

    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)



  • 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?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.