summaryrefslogtreecommitdiffstats
path: root/examples/nfc/annotatedurl/mainwindow.h
blob: 09fc2ea8726b5804dd8599d51fe141bc4e99054e (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
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QWidget>
#include <QPixmap>

QT_FORWARD_DECLARE_CLASS(QMouseEvent)
QT_FORWARD_DECLARE_CLASS(QUrl)
QT_FORWARD_DECLARE_CLASS(QString)
QT_FORWARD_DECLARE_CLASS(QLabel)
QT_FORWARD_DECLARE_CLASS(QScreen)

class MainWindow : public QWidget
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

public slots:
    void displayAnnotatedUrl(const QUrl &url, const QString &title, const QPixmap &pixmap);
    void nfcStateChanged(bool enabled);
    void showTagError(const QString &message);

protected:
    void mouseReleaseEvent(QMouseEvent *event) override;
    void moveEvent(QMoveEvent *event) override;

private slots:
    void updateWidgetLayout(Qt::ScreenOrientation orientation);

private:
    void handleScreenChange();

    QLabel *m_titleLabel;
    QLabel *m_infoLabel;
    QLabel *m_uriLabel;
    QLabel *m_landscapeIconLabel;
    QLabel *m_portraitIconLabel;
    QScreen *m_screen = nullptr;
    QPixmap m_pixmap;
};

#endif // MAINWINDOW_H