Obtain QPushButton created in .ui file from another class

  • I currently have three classes: Page1,Page2 and Page_stackedWidget. On Page1.ui I have a QPushButton along with other widgets. On Page_stackedWidget.ui I created a stackedwidget which I include Page1 and Page2 and when I run the program, it works correctly. However, I would like it so when I press a button that is in page 1 it takes me to page 2. This is what I have for Page_stackedWidget.cpp

    #include "page_stackedwidget.h"
    #include "ui_page_stackedwidget.h"
    Page_stackedWidget::Page_stackedWidget(QWidget *parent) :
    ui(new Ui::Dialog)
    connect(Page1->nextButton, SIGNAL(clicked()),this,SLOT(goToPage2())); 
    void Dialog::goToPage2()

    However, the "nextButton" I created on the .ui file for Page1. I have looked for forums and i have found some similar to my problem but the difference is that their button is created on this file. http://stackoverflow.com/questions/9694474/manipulating-qt-ui-with-different-source-files.

  • Lifetime Qt Champion


    That question is already being answered here

    Let's keep it in only one place, closing this one.

Log in to reply