So, I have a QT project with an implemented subclass of QWidget class, which I show on the start and do nothing more. Literally:
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MyClass w;
w.show();
return a.exec();
}
I want to see, for example, two instances of this widget in my application. I made a small google research and found QGridLayout and QLayout widgets. Naively assuming that I can just add items to them and type myLayout.show()
(HTML mindset), and receiving nothing posistive, I gave up and now must ask for the solution here.
Hence the question: what is the appropriate way of handling this situation? How to properly display two or more QWidgets? Ultimately, I’d like my app to look like this:
MyWidget1 | MyButton1 |
---|---|
MyWidget2 | MyTextField1 |
My Qt version is 6.6.0, if that’s important
h-swell is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.