Error: no matching function for call to 'QObject::connect
-
Thank you very much for all the help!
The last problem I have is how to pass the label and lineedit to the slot. I don't want to make them global variables. if I create a custom signal with the label and lineedit to match the slot, I'm confused about where to emit the signal.
-
Before that, why do you need the
MainWindowContent
. It looks like a convoluted mean to create the central widget content. -
I want to keep the logic of how the program progresses from page to page in MainWindow. But I want other classes to generate the pages to be displayed. Basically I want to be able to manage the program without having a single .cpp file that is a thousand lines or so.
-
Then why not make them full QWidget derivative ?
That's what is usually done, cut your application in logical pieces and then build as many QWidget based classes as needed to keep the code clean, simple and tidy.
-
The scribble example is a simple example to start with.
-
I went over the example but I still have some difficulty converting it to my use. I created a MainWindowContent that is a subclass of QWidget and created a
QGridLayout* MainWindowContent::getPageWidgetsLayout()
the exact same function I provided in the code above.
I don't think that this is the intended goal of this example because in MainWindow an instance of the QWidget subclass (ScribbleArea) is passed to setCentralWidget not a call to a function using the instance. Am I supposed to move all the code from getPageWidgetsLayout() to the constructor and declare the label, lineedit, and pushbutton as private variables.
-
No the example shows what I suggested: create a separated widget that encapsulates the functionality of interest and use that one in the MainWindow.
-
Finally, I got it to work but I still have the same problem that I started with. How do I pass the line edit and label to the slot?
I searched online and all the examples have a condition other than the button being clicked that emit the signal . Any hints please?