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. URGENT : How to Show Another Window From MainWindow in QT using c++
Forum Updated to NodeBB v4.3 + New Features

URGENT : How to Show Another Window From MainWindow in QT using c++

Scheduled Pinned Locked Moved Solved General and Desktop
qt creator
42 Posts 6 Posters 9.4k Views 2 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.
  • N nagesh
    27 Apr 2021, 23:35

    @Jasmin-Quinn okay fine, I repeat that my first post is the solution to this application integration.

    I repost the working solution. (I tried integrating github project which is working fine )

    Solution as per the existing implementation of chessboard application (Just to make the integration works fine)
    1)Copy the required files(chess project files) to the existing project.

    2)In Mainwindow.cpp create the global game object pointer;
    Game *game=nullptr;
    //make sure Game *game; exists only in the Mainwindow.cpp
    //Earlier crash was because there were two instance game * one in Manwindow.h as member variable and other with main.cpp.

    3)In Mainwindow.cpp include the game.h file
    #include "game.h"

    4)In on_lancer_partie_clicked() create the instance of it
    game = new Game();
    game->show();
    game->displayMainMenu();

    Note: Assumption that github code remains unaltered.

    J Offline
    J Offline
    Jasmin Quinn
    wrote on 28 Apr 2021, 10:22 last edited by
    #41

    @nagesh IT WORKKKSSS Thank youu !! How did i not think of that

    1 Reply Last reply
    0
    • A Offline
      A Offline
      Anonymous_Banned275
      wrote on 28 Apr 2021, 17:38 last edited by
      #42

      Is it correct to say that now the "main project" has all the code of "chess" added so basically there is only one application running?

      The objective to "have two windows" has been met, however, adding more "child applications" using same philosophy of "cut and paste" is not what " reusing code " means to me.

      1 Reply Last reply
      0

      41/42

      28 Apr 2021, 10:22

      • Login

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