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. Move between windows
Qt 6.11 is out! See what's new in the release blog

Move between windows

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 1.5k Views 1 Watching
  • 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.
  • J Offline
    J Offline
    jrspepe
    wrote on last edited by
    #1

    Hi

    I'm new in QT. I'm trying to make an application with four differents windows. At start, the application show a login page. When log is sucessfull, I want to show the principal window. In this window, there are two buttons for go to the other two windows. I don't want open a new window, I want to change the window.

    how can I move to another window? I have to use QT only c++.
    I think that QWizard is not a good idea because from principal window I can go to two differents windows, and in QWizard this is not possible .

    P.D.: Sorry for my bad English, but I only speak a bit of English. Thanks

    1 Reply Last reply
    0
    • T Offline
      T Offline
      thEClaw
      wrote on last edited by
      #2

      I suggest you take a look at "QGuiApplication::topLevelWindows":http://qt-project.org/doc/qt-5.1/qtgui/qguiapplication.html#topLevelWindows (or "QGuiApplication::allWindows":http://qt-project.org/doc/qt-5.1/qtgui/qguiapplication.html#allWindows ) and "QWidget::setFocus":http://qt-project.org/doc/qt-5.1/qtwidgets/qwidget.html#setFocus.

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

        Hi and welcome to devnet,

        Basically you could need to start with a custom "QDialog":http://qt-project.org/doc/qt-4.8/qdialog.html for the login (or a "QInputDialog":http://qt-project.org/doc/qt-4.8/qinputdialog.html if you only need a password), if it's successful, show your main widget that could be a "QWidget":http://qt-project.org/doc/qt-4.8/qwidget.html containing e.g. a "QStackedWidget":http://qt-project.org/doc/qt-4.8/qstackedwidget.html for your two other window and underneath the two buttons to switch them. A "QTabWidget":http://qt-project.org/doc/qt-4.8/qtabwidget.html could also be alternative depending on your use case.

        There are also other possibilities

        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

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved