QBoxLayout unitLayout = new QBoxLayout (QBoxLayout::LeftToRight);
unitLayout ->addStretch();
unitLayout ->setSpacing(0);
unitLayout ->setContentsMargins(0, 0, 15, 0);
unitLayout ->addWidget(unitBtn);
this->setLayout(unitLayout);
/防止输入文本到unitBtn下/
QMargins margin = unitLayout->contentsMargins();
this->setTextMargins(margin.left(), margin.top(), margin.width() + width, margin.bottom());
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
}`