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. [Solved]How to combine the ui file generated by QtDesigner?
Forum Updated to NodeBB v4.3 + New Features

[Solved]How to combine the ui file generated by QtDesigner?

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

    !https://farm8.staticflickr.com/7322/12221083224_3a43f30650.jpg(MainWindow.ui)!
    !https://farm4.staticflickr.com/3765/12220862673_a83b959a02.jpg(page1.ui)!
    !https://farm8.staticflickr.com/7422/12221203884_00049523cc.jpg(project layout)!

    I want to add the page1.ui into the QTabWidget of the MainWindow.ui
    anyway to do that by QtDesigner(without manual hand codings)?
    if this is impossible, which kind of solutions would you pick?

    1 Reply Last reply
    0
    • X Offline
      X Offline
      XelaG
      wrote on last edited by
      #2

      I think it's not possible to do it with the designer but it's pretty easy to do it with manual coding.

      @ page1 *ptPage1;
      ptPage1 = new page1( ui->tabWidget );
      ui->tabWidget->addTab(ptPage1, "Page1");@

      "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - Martin Golding

      1 Reply Last reply
      0
      • S Offline
        S Offline
        stereomatching
        wrote on last edited by
        #3

        I find out one of the solution from "method 1":http://www.qtcentre.org/threads/57871-How-to-combine-the-ui-file-generated-by-QtDesigner

        bq. Add a widget to the tab in MainWindow.
        Then right click and "promote" it. In the dialog specify the include for the class that will implement page1.ui and promote.
        The class name of the widget will change to the class name you have specified.
        When uic generates the code for MainWindow, it will generate an include for the specified header and instantiate the specified class in place of the widget.

        1 Reply Last reply
        0
        • X Offline
          X Offline
          XelaG
          wrote on last edited by
          #4

          Yes right, I though you wanted to include your page into the tab and see it under the designer. With promote it is shown only at runtime. but it does the job.

          "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - Martin Golding

          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