summaryrefslogtreecommitdiffstats
path: root/tests/manual/corelib/tools/customtypesending/main.cpp
blob: a8f95ffe8ef4b4ed2438bf0661ffb1f07de50d9c (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
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

#include <QApplication>
#include "message.h"
#include "window.h"

//! [main function]
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    QStringList headers;
    headers << "Subject: Hello World"
            << "From: address@example.com";
    QString body = "This is a test.\r\n";
    Message message(body, headers);

    Window window1;
    window1.setMessage(message);

    Window window2;
    QObject::connect(&window1, &Window::messageSent,
                     &window2, &Window::setMessage);
    QObject::connect(&window2, &Window::messageSent,
                     &window1, &Window::setMessage);
    window1.show();
    window2.show();
    return app.exec();
}
//! [main function]