可以像楼上的前辈说的那样,设置间隔,设置边缘空白.
也可以用qt stylesheet 设置 margin。 m_textEdit->setStyleSheet("margin:0px;");
也可以 不用layout。对单个Widget进行move和show操作。自己要计算准确Widget该摆放的坐标。想放哪就放哪。
e.g.:
QTextEdit* te1= new QTextEdit(this);
te1->setFixedSize(200,200);
QTextEdit* te2 = new QTextEdit(this);
te2->setFixedSize(200,200);
te1->move(10,10);
te2->move(210,10);
te1->show();
te2->show();