qt6windows7/tests/manual/examples/widgets/layouts/borderlayout/window.cpp
2023-11-01 18:02:52 +01:00

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;
}