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. Bringing back the parent form(login window) after logging out

Bringing back the parent form(login window) after logging out

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 1.6k 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.
  • P Offline
    P Offline
    Pastardo
    wrote on last edited by
    #1

    I've successfully setup a login form that opens a new form into a menu after a login. I added a log out button, but I can't find any way to bring back the login form which is the main window.

    I've tried setting the main window as the parent of the new form but it the new form just displays the layout in the same window, not opening a new one.
    I've also tried the regular way of opening a new form, instantiating a new object of the mainwindow then calling show(), but that doesn't seem to work either.

    I searched the problem up for hours but to no result. Any idea how to make that function work?

    jsulmJ 1 Reply Last reply
    0
    • P Pastardo

      I've successfully setup a login form that opens a new form into a menu after a login. I added a log out button, but I can't find any way to bring back the login form which is the main window.

      I've tried setting the main window as the parent of the new form but it the new form just displays the layout in the same window, not opening a new one.
      I've also tried the regular way of opening a new form, instantiating a new object of the mainwindow then calling show(), but that doesn't seem to work either.

      I searched the problem up for hours but to no result. Any idea how to make that function work?

      jsulmJ Online
      jsulmJ Online
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Pastardo Your description is not very clear.
      Can you maybe post your code?
      "opens a new form into a menu after a login" - what does that mean? "into a menu"?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • P Offline
        P Offline
        Pastardo
        wrote on last edited by
        #3

        Apologies for the vague description. What I meant is that after a successful login, the program opens up a new form. Problem is, I have no idea how to get back to the main window after hiding it. I set up a "log out" button but I couldn't find a way to call the previous form to show again.

        Anyways, I've found a plausible solution. I discovered that using QWidgets are not the best way to open a new window (or maybe I'm just a noob at using it).
        The new form's layout would always appear inside the main window whenever I called "show()" on it. What I did was switch from using QWidget to QDialog and it seems to work just fine now.

        Still, thank you for the response!

        jsulmJ 1 Reply Last reply
        0
        • P Pastardo

          Apologies for the vague description. What I meant is that after a successful login, the program opens up a new form. Problem is, I have no idea how to get back to the main window after hiding it. I set up a "log out" button but I couldn't find a way to call the previous form to show again.

          Anyways, I've found a plausible solution. I discovered that using QWidgets are not the best way to open a new window (or maybe I'm just a noob at using it).
          The new form's layout would always appear inside the main window whenever I called "show()" on it. What I did was switch from using QWidget to QDialog and it seems to work just fine now.

          Still, thank you for the response!

          jsulmJ Online
          jsulmJ Online
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Pastardo I suggest to use https://doc.qt.io/qt-5/qstackedwidget.html then you can easily navigate between different parts of your UI.

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          2

          • Login

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