Problems with showFullScreen!



  • Hello everybody,

    This is my first post in this forum, I'm facing a problem when i try to show a full screen desktop application, sometimes my MainWindow fit more than screen size or sometimes it moves to another coordinates, leaving some blank space.!http://s30.postimg.org/csr8siyf5/captura1.png()!

    I tryed my application under Linux and Windows, it works correctly in:

    -Windows 8
    -Windows 7
    -Lubuntu 12.04
    -Fedora (XCFE Desktop)

    it has some problems at show full screen in:

    -Fedora GNOME
    -Ubuntu GNOME
    -Windows XP
    -Xubuntu
    -Fedora (LXCE)

    Thanks a lot
    German Zapata.



  • Welcome to Qt DevNet!

    From MainWindow try
    @
    this->setWindowState(this->windowState() | Qt::WindowFullScreen);
    @



  • Thanks for your response andreyc.
    Still getting the same problem. I put that on the constructor and on a slot that receives pressed event of the top buttons. @ui->gbNewUser->setVisible(true);
    ui->gbInfoUser->setVisible(false);
    ui->gbNewAccount->setVisible(false);
    ui->gbSorteo->setVisible(false);
    ui->gbStock->setVisible(false);@

    This is how my logic works, when an specific buttom is pushed one groupBox is showed and the rest groupBox are hidden.

    Could it be the problem?

    Thanks,
    German Zapata



  • Does this small app work?

    • fullScreenWindow.pro
      @
      QT += widgets
      TARGET = fullScreenWindow
      TEMPLATE = app
      SOURCES += main.cpp
      @

    • main.cpp
      @
      #include <QApplication>
      #include <QMainWindow>
      #include <QShortcut>

    int main(int argc, char argv[])
    {
    QApplication a(argc, argv);
    QMainWindow w;
    QShortcut
    q = new QShortcut(QKeySequence("q"), &w);
    QObject::connect(q, &QShortcut::activated, &w, &QMainWindow::close);
    w.setWindowState(w.windowState() | Qt::WindowFullScreen);
    w.show();

    return a.exec&#40;&#41;;
    

    }
    @

    [EDIT]: added .pro file



  • Yes it works, my application also works correctly in some states, i have just an specific group box that makes this problem occur, the main difference between this specific group box and the others is that this specific groupBox is overcharged of Labels, TextEdits, etc. The others are working like a charm.



  • I don't think that amount of the Labels, TextEdits, etc may change the MainWindow state or position.

    Try to disable all "bad" GroupBoxes except one and check the main window state and coordinates before and after switching to and from "bad" GroupBox.

    Do you build the UI in the code or in a designer?



  • I used the designer.



  • Did you use "QStackedWidget":http://qt-project.org/doc/qt-5/QStackedWidget.html or you put all GroupBoxes into one central widget of main window and then hide, show the Groupboxes on the signals from the buttons?



  • I used, the second alternative, si there any problem with it?



  • [quote author="bladice" date="1406764299"]I used, the second alternative, si there any problem with it?[/quote]No, there is nothing wrong with it. It requires more attention though.

    Did you try to check main window state and coordinates before and after switching between the GroupBoxes?



  • yes i checked an it report me real coordinates, so if it moves, it starts at coordinates different to 0,0. I would check QStackedWidgets. This is a minor problem rigth now, but it isn't the first time that i got this problem.



  • Usually such unexpected behavior is a sign of some hidden issues like incorrect calculation or walking pointer.
    When you decide to dig it deeper I would suggest to take one of "bad" group box and copy it to a separate application, just UI without business logic and see how it will behave.


Log in to reply
 

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