Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Mainwindow layout change
Qt 6.11 is out! See what's new in the release blog

Mainwindow layout change

Scheduled Pinned Locked Moved Mobile and Embedded
5 Posts 3 Posters 5.0k 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    Actually i face a problem while going form one Mainwindow to another Mainwindow..
    suppose i have mainwindow name Mainwindow1 and another mainwindow name Mainwindow2...now on the pushbutton of Mainwindow1 when i want to go to Mainwindow2 then it works but the layout of the mainwindow changes..its size decreses..

    the code i have wrritten in pushbutton of Mainwindow is..

    @void MainWindow1:n_Clicked_pushButton()
    {
    MainWindow2 *m=new Mainwindow();
    m.showFullscreen();
    }@
    but when i perform same task by using diaglog its works fine..so whats the problem..if anyone please suggest..

    with regards
    Anshuman

    1 Reply Last reply
    0
    • ZlatomirZ Offline
      ZlatomirZ Offline
      Zlatomir
      wrote on last edited by
      #2

      I can't say i understood your problem, but in the second main-window do you have a "container" QWidget as a parent of the rest of the Widgets (and layouts) and add that in the main-window using setCentralWidget?

      And a second issue is that code you wrote will leak - the pointer m will get out of scope when the function ends and you can't delete the allocated MainWindow2 object (and you don't pass a parent that will delete that for you)

      Also you have a typo: MainWindow 2 *m=new Mainwindow();

      https://forum.qt.io/category/41/romanian

      1 Reply Last reply
      0
      • G Offline
        G Offline
        giesbert
        wrote on last edited by
        #3

        There are more typos, the code should be:

        @
        void MainWindow1:n_Clicked_pushButton()
        {
        MainWindow2 *m=new MainWindow2();
        m->showFullscreen();
        }
        @

        Nokia Certified Qt Specialist.
        Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #4

          thanks Gerolf..
          But i had try that also...result is same..is there any way to resolve this

          1 Reply Last reply
          0
          • ? Offline
            ? Offline
            A Former User
            wrote on last edited by
            #5

            thanks Zlatomir

            its working..by using setCentralWidget.....

            with regards
            Anshuman

            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