summaryrefslogtreecommitdiffstats
path: root/qtwinmigrate/examples/mfc/step5/childview.cpp
blob: 055a56c22087daba61391bb7f0499bd2256adc53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
// SPDX-License-Identifier: BSD-3-Clause

// childview.cpp : implementation of the ChildView class
//

#include "childview.h"

#include <QLabel>
#include <QLineEdit>
#include <QLayout>
#include <QPainter>

/////////////////////////////////////////////////////////////////////////////
// ChildView

ChildView::ChildView(QWidget *parent)
: QWidget(parent)
{
    QWidget *widget = new QWidget(this);
    QHBoxLayout *hbox = new QHBoxLayout(widget);

    QLabel *label = new QLabel("Enter text:", widget);
    QLineEdit *edit = new QLineEdit(widget);

    hbox->addWidget(label);
    hbox->addWidget(edit);

    widget->move(0, 0);
    setBackgroundRole(QPalette::Base);
}

void ChildView::paintEvent(QPaintEvent * /*e*/) 
{
    QPainter painter(this);
}