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. Hide and show again fullscreen window
QtWS25 Last Chance

Hide and show again fullscreen window

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 969 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.
  • Z Offline
    Z Offline
    zaic101
    wrote on last edited by
    #1

    What is the expected behavior of the window state when hiding fullscreen window: can flags Qt::WindowFullScreen and Qt::WindowMaximized be changed?

    Simple application with one button, that hides and shows fullscreen window and print FullScreen and Maximized flags:
    @
    #include <QApplication>
    #include <QMainWindow>
    #include <QPushButton>
    #include <QWidget>
    #include <QDebug>
    #include <QHBoxLayout>

    class MainWindow : public QMainWindow
    {
    public:
    explicit MainWindow(QWidget *parent = 0) : QMainWindow(parent) {
    QPushButton *btn = new QPushButton("hideshow");
    connect(btn, &QPushButton::clicked, = {
    hide();
    show();
    qDebug() << isFullScreen() << isMaximized();
    });
    layout()->addWidget(btn);
    }
    virtual ~MainWindow() {}
    };

    int main(int argc, char *argv[])
    {
    QApplication app(argc, argv);
    MainWindow *w = new MainWindow();
    w->showFullScreen();
    return app.exec();
    }
    @

    Expected output for me when I clicked the button twice is:
    true false
    true false
    but actual output is:
    true false
    false true
    i.e. flag WindowMaximized is dropped and window looks like maximized instead of fullscreen.

    Qt version is 5.3.1.

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      If you want it full screen, then use showFullScreen() instead of show() in your slot.

      (Z(:^

      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