Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How can I make the child control display more area than the parent control?
-
auto btn = new QPushButton(parent); btn->setFixedSize(100,100); auto lab = new Qlabel(btn); lab->setFixedSize(200,200); lab->setStyleSheet("color:#000000");
How can I make the child control display more area than the parent control?
I expect the result to be a 200X200 black area,andbtn
is belowlab
.
-
@HuXiaoer You can't. Child is inside parent and as such it can't be bigger than its parent.
-
@jsulm ok!~ Thank you for your answer.
-
Hi,
@jsulm correctly noted, your child can't be bigger than your parent however you can use a QScrollArea to put more widgets in the child and then scroll through it to show the ones you want.