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. Opening a new form with a push_button
Forum Updated to NodeBB v4.3 + New Features

Opening a new form with a push_button

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 509 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.
  • Gerrit ZijlstraG Offline
    Gerrit ZijlstraG Offline
    Gerrit Zijlstra
    wrote on last edited by
    #1

    I'm trying to open a new form with a push Button. i've seen examples on YouTube but can't get it working.

    My main form is called: srm.ui
    It has a button 'PB_driver_settings' And I want to open the form drivers.ui when I press the button.

    In my srm.h I have included ui_drivers.h
    and added a line in the private section:
    private:
    Ui::SRM *ui;
    Ui_driver_update driver_update;

    What should I do to make the correct call.
    I don't know the argument to add.
    void SRM::on_PB_Driver_Settings_clicked()
    {
    driver_update.setupUi();
    }

    I exampled I saw a call to a function .show() but that is not working either.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      asanka424
      wrote on last edited by
      #2

      You don't need to include ui_* include files.

      include drivers.h file in your srm.h file (you can do forward declaration but for simplicity lets not do that.

      #include "driver.h"
      

      Define a variable (preferrabley private) for Driver object.

      Driver *driverWindow;
      

      In SRM's constructor create the driverWindow object

      driverWindow = new Driver(this);
      

      and your slot:

      void SRM::on_PB_Driver_Settings_clicked()
      {
            driverWindow->exec();
      }
      
      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