Deep copy of QTabWidget pages advise/workaround?



  • Hi,

    I've used Qt Creator (Designer) to design the QMainWindow with a child QTabWidget that has different designs of QWidget pages. Each page has a different mix of buttons, comboboxes, labels and QTableWidget tables

    When I run my Python app, I load the Qt front end in and I delete the tab pages to start from a blank QTabWidget. Then I want to be able to have multiple instances of my QWidget pages to appear that I designed earlier. I guess I want to be able to do a deep copy of these QWidget pages (that keeps all the layouts, buttons, comboboxes and QTableWidget tables that I designed) so that I can load them with different data. What's the best approach to do this?

    Thanks for your help.



  • Hi,

    You need to create a separate ui form for each of your tab widgets and,
    use QUiLoader::load to instanciate the widget you want.


  • Moderators

    @TonyB123 Simply create so many of your widgets as you need, there is no need for deep copy.
    C++ version:

    MyWidget *widget1 = new MyWidget(this);
    MyWidget *widget2 = new MyWidget(this);
    ...
    

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.