05fc3aef53
Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
54 lines
1.5 KiB
C++
54 lines
1.5 KiB
C++
// Copyright (C) 2016 The Qt Company Ltd.
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
|
|
|
#include "window.h"
|
|
#include "layoutitem.h"
|
|
|
|
#include <QGraphicsLinearLayout>
|
|
#include <QGraphicsGridLayout>
|
|
|
|
Window::Window(QGraphicsWidget *parent) : QGraphicsWidget(parent, Qt::Window)
|
|
{
|
|
//! [0]
|
|
QGraphicsLinearLayout *windowLayout = new QGraphicsLinearLayout(Qt::Vertical);
|
|
QGraphicsLinearLayout *linear = new QGraphicsLinearLayout(windowLayout);
|
|
LayoutItem *item = new LayoutItem;
|
|
linear->addItem(item);
|
|
linear->setStretchFactor(item, 1);
|
|
//! [0]
|
|
|
|
//! [1]
|
|
item = new LayoutItem;
|
|
linear->addItem(item);
|
|
linear->setStretchFactor(item, 3);
|
|
windowLayout->addItem(linear);
|
|
//! [1]
|
|
|
|
//! [2]
|
|
QGraphicsGridLayout *grid = new QGraphicsGridLayout(windowLayout);
|
|
item = new LayoutItem;
|
|
grid->addItem(item, 0, 0, 4, 1);
|
|
item = new LayoutItem;
|
|
item->setMaximumHeight(item->minimumHeight());
|
|
grid->addItem(item, 0, 1, 2, 1, Qt::AlignVCenter);
|
|
item = new LayoutItem;
|
|
item->setMaximumHeight(item->minimumHeight());
|
|
grid->addItem(item, 2, 1, 2, 1, Qt::AlignVCenter);
|
|
item = new LayoutItem;
|
|
grid->addItem(item, 0, 2);
|
|
item = new LayoutItem;
|
|
grid->addItem(item, 1, 2);
|
|
item = new LayoutItem;
|
|
grid->addItem(item, 2, 2);
|
|
item = new LayoutItem;
|
|
grid->addItem(item, 3, 2);
|
|
windowLayout->addItem(grid);
|
|
//! [2]
|
|
|
|
//! [3]
|
|
setLayout(windowLayout);
|
|
setWindowTitle(tr("Basic Graphics Layouts Example"));
|
|
//! [3]
|
|
|
|
}
|