@JKSH said in showing custom widget inside the mainWindow:
@Swati777999 said in showing custom widget inside the mainWindow:
@JKSH said in showing custom widget inside the mainWindow:
I believe you have missed @Pl45m4's point. He is asking you to explain: What do you expect this line to do?: QMainWindow *main = new QMainWindow();
Actually, I was trying to write some codes after that [like setting a layout or so]so as to I can add WindowWidget to it, something like that.
You should add your WindowWidget to your ScrollAreaApp (which is this in your ScrollAreaApp's constructor). You should not be adding it to some extra QMainWindow.
Yes, my other application has code for it and I should be writing this code there while trying but I chose to create another project file for experimenting.
Unfortunately, the way that you're carrying out these experiments is making it harder for you to understand the important basics of widget parent-child relationships and layout management.
In summary: It is completely wrong to create a new QMainWindow() in your custom widget's constructor. Don't do it, ever... not even for experimenting. This is because the ScrollAreaApp's constructor should only contain things that are placed inside the ScrollAreaApp. (Does this make sense? If not, please ask)
I completely understand what you want to convey. So, basically it is preferred to experiment in the same location of the complete application rather than writing a part of code in different project file.