push Button seems disabled



  • Hey Guys,

    I try to create a simple pushButton, but it does not work.
    I have a MainWindow, that calls customPlot, which plots real time data.
    Now I wanna create a pushButton, that starts plotting these data.

    MainWindow::MainWindow(QWidget *parent): QMainWindow(parent), ui (new Ui::MainWindow)
    {
         ui->setupUi(this);
    }
    
    void MainWindow:: on_pushButton_clicked()
    {
         open_serial();
         setupDemo();  //starts the plot
    }
    

    The push Button is above the graph, but if I run the programm the Button looks disabled, so that I cannot click on it.
    What does it mean, if the pushButton text is grey so that is looks disabled.
    I also checked the checkbox "enable" in the GUI, which is also enabled.
    No error is displayed.

    Thanks for your help.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Is your QPushButton in a layout in another widget that is disabled ?



  • Does you MainWindow.h have Q_Object macro defined?
    Is on_pushButton_clicked a slot? is it connected?



  • The MainWindow object above the central widget wasn't enabled. I thought I checked it, but didn't.
    So thanks for the answers.


Log in to reply
 

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