mirror of
https://github.com/crystalidea/qt6windows7.git
synced 2024-12-03 17:03:08 +08:00
32 lines
995 B
C++
32 lines
995 B
C++
|
// Copyright (C) 2016 The Qt Company Ltd.
|
||
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
||
|
|
||
|
#include "borderlayout.h"
|
||
|
#include "window.h"
|
||
|
#include <QTextBrowser>
|
||
|
#include <QLabel>
|
||
|
|
||
|
Window::Window()
|
||
|
{
|
||
|
QTextBrowser *centralWidget = new QTextBrowser;
|
||
|
centralWidget->setPlainText(tr("Central widget"));
|
||
|
|
||
|
BorderLayout *layout = new BorderLayout;
|
||
|
layout->addWidget(centralWidget, BorderLayout::Center);
|
||
|
layout->addWidget(createLabel("North"), BorderLayout::North);
|
||
|
layout->addWidget(createLabel("West"), BorderLayout::West);
|
||
|
layout->addWidget(createLabel("East 1"), BorderLayout::East);
|
||
|
layout->addWidget(createLabel("East 2") , BorderLayout::East);
|
||
|
layout->addWidget(createLabel("South"), BorderLayout::South);
|
||
|
setLayout(layout);
|
||
|
|
||
|
setWindowTitle(tr("Border Layout"));
|
||
|
}
|
||
|
|
||
|
QLabel *Window::createLabel(const QString &text)
|
||
|
{
|
||
|
QLabel *label = new QLabel(text);
|
||
|
label->setFrameStyle(QFrame::Box | QFrame::Raised);
|
||
|
return label;
|
||
|
}
|