MyWidget::MyWidget(QWidget *parent) :
QWidget(parent)
{
QLabel *labelleft = new QLabel("Left Description:");
QVBoxLayout *vlayoutleft = new QVBoxLayout;
vlayoutleft->addWidget(labelleft);
vlayoutleft->addStretch();
QLabel *labelright = new QLabel("Right");
labelright->setFixedWidth(100);
QListWidget *listWidget = new QListWidget(this);
listWidget->addItem(new QListWidgetItem(QIcon(":/pics/FolderOpen.ico"), "folder1"));
listWidget->addItem(new QListWidgetItem(QIcon(":/pics/FolderOpen.ico"), "folder2"));
QVBoxLayout *vlayoutright = new QVBoxLayout;
vlayoutright->addWidget(labelright);
vlayoutright->addWidget(listWidget);
QHBoxLayout *mainayout = new QHBoxLayout;
mainayout->addLayout(vlayoutleft);
mainayout->addLayout(vlayoutright);
setLayout(mainayout);
mainayout->setSpacing(30);
}
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系我们删除。