使用QVBoxayout布局失败。

看云上有个人 2014-09-24 10:39:20
#include "mydialog.h"
#include "ui_mydialog.h"
#include<QPushButton>
#include<QVBoxLayout>

MyDialog::MyDialog(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MyDialog)
{
ui->setupUi(this);
setGeometry(100,100,200,200);
setMinimumSize(200,200);
QPushButton *button1=new QPushButton("button1",this);

button1->setMinimumSize(200,100);
QPushButton *button2=new QPushButton("button2",this);
button2->setMinimumSize(200,100);

QVBoxLayout *vbox =new QVBoxLayout(this);

vbox->addWidget(button1);
vbox->addWidget(button2);

}

MyDialog::~MyDialog()
{
delete ui;
}
...全文
98 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
看云上有个人 2014-09-24
  • 打赏
  • 举报
回复
状态是 button1不显示 button2覆盖button1 然后button 的大小也不随窗口大小变动

23,223

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 应用程序开发区
社区管理员
  • 应用程序开发区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧