根据下面的屏幕截图,为什么我的小部件不使用拆分器内的垂直布局排列?
/********************************************************************************
** Form generated from reading UI file 'test.ui'
**
** Created: Tue Apr 12 16:51:51 2011
** by: Qt User Interface Compiler version 4.6.2
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef UI_TEST_H
#define UI_TEST_H
#include <QtCore/QVariant>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
#include <QtGui/QGridLayout>
#include <QtGui/QHeaderView>
#include <QtGui/QLineEdit>
#include <QtGui/QListWidget>
#include <QtGui/QMainWindow>
#include <QtGui/QSplitter>
#include <QtGui/QTreeWidget>
#include <QtGui/QVBoxLayout>
#include <QtGui/QWidget>
QT_BEGIN_NAMESPACE
class Ui_MainWindow
{
public:
QWidget *centralwidget;
QGridLayout *gridLayout;
QSplitter *splitter;
QTreeWidget *treeWidget;
QWidget *widget;
QVBoxLayout *verticalLayout;
QLineEdit *lineEdit;
QListWidget *listWidget;
void setupUi(QMainWindow *MainWindow)
{
if (MainWindow->objectName().isEmpty())
MainWindow->setObjectName(QString::fromUtf8("MainWindow"));
MainWindow->resize(800, 600);
centralwidget = new QWidget(MainWindow);
centralwidget->setObjectName(QString::fromUtf8("centralwidget"));
gridLayout = new QGridLayout(centralwidget);
gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
splitter = new QSplitter(centralwidget);
splitter->setObjectName(QString::fromUtf8("splitter"));
splitter->setOrientation(Qt::Horizontal);
treeWidget = new QTreeWidget(splitter);
QTreeWidgetItem *__qtreewidgetitem = new QTreeWidgetItem();
__qtreewidgetitem->setText(0, QString::fromUtf8("1"));
treeWidget->setHeaderItem(__qtreewidgetitem);
treeWidget->setObjectName(QString::fromUtf8("treeWidget"));
splitter->addWidget(treeWidget);
widget = new QWidget(splitter);
widget->setObjectName(QString::fromUtf8("widget"));
verticalLayout = new QVBoxLayout(widget);
verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
verticalLayout->setContentsMargins(0, 0, 0, 0);
lineEdit = new QLineEdit(widget);
lineEdit->setObjectName(QString::fromUtf8("lineEdit"));
verticalLayout->addWidget(lineEdit);
listWidget = new QListWidget(widget);
listWidget->setObjectName(QString::fromUtf8("listWidget"));
verticalLayout->addWidget(listWidget);
splitter->addWidget(widget);
gridLayout->addWidget(splitter, 0, 0, 1, 1);
MainWindow->setCentralWidget(centralwidget);
retranslateUi(MainWindow);
QMetaObject::connectSlotsByName(MainWindow);
} // setupUi
void retranslateUi(QMainWindow *MainWindow)
{
MainWindow->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", 0, QApplication::UnicodeUTF8));
} // retranslateUi
};
namespace Ui {
class MainWindow: public Ui_MainWindow {};
} // namespace Ui
QT_END_NAMESPACE
#endif // UI_TEST_H
这只是出于问题目的而上传的虚拟用户界面。在我真正的 ui 设计中,我尝试了所有可以想象的组合,但是一旦我开始使用分离器,它就会变得不协调。