分类: C/C++
2014-08-21 00:32:32
/*
****************************************************************** * 函数名称 : initLayout * 函数功能 : 初始化窗口布局 * 函数参数 : 无 * 返回值 : 无 ****************************************************************** */ void QFriendManager::initLayout() { //创建主布局VBoxLayout QVBoxLayout *mainLayout = new QVBoxLayout(); //创建主Splitter QSplitter *splitterMain = new QSplitter(Qt::Vertical, this); //添加标题标签和表格部件到主Splitter tableWidget = new QTableWidget(splitterMain); tableWidget->setMinimumHeight(120); //创建底部工具栏Splitter,父亲为主Splitter QSplitter *splitterBottom = new QSplitter(Qt::Horizontal, splitterMain); check_selectAll = new QCheckBox(QObject::tr("全选"), splitterBottom); pb_delete = new QPushButton(QObject::tr("删除"), splitterBottom); pb_find = new QPushButton(QObject::tr("查找"), splitterBottom); le_find = new QLineEdit(splitterBottom); check_selectAll->setFixedSize(48, 32); pb_delete->setFixedSize(48, 32); pb_find ->setFixedSize(48, 32); //禁用Splitter拉伸效果 splitterMain->handle(1)->setDisabled(true); splitterBottom->handle(1)->setDisabled(true); splitterBottom->handle(2)->setDisabled(true); splitterBottom->handle(3)->setDisabled(true); //设置窗口边沿宽度 mainLayout->setContentsMargins(2,5,2,5); //添加主Splitter到主布局VBoxLayout mainLayout->addWidget(splitterMain, 0); this->setLayout(mainLayout); } |