[Solved] QPushButton change text
-
I am trying to make it so that when the pushButton is clicked the text on it changes. At the moment my programming in the slot is
@Ui_MainWindow::pushButton->setText("helloworld");@
When I compile the code it says: Invalid use of non-static data member 'pushButton'
How do I get around this problem? -
Hello
I think you shouldn't access your pushButton like that, it's not a static member. Try with
@Ui_MainWindow->pushButton->setText("clicked")@
Or
@Ui_MainWindow.pushButton->setText("clicked")@
Whether your Ui_mainWindow is created on heap or stack. Does this work?
Regards.
PS: next time, type your code between "@", that will make things neat and clear.