| 1 |
// Copyright (C) 2016 The Qt Company Ltd. |
| 2 |
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause |
| 3 |
|
| 4 |
#ifndef ARTHURWIDGETS_H |
| 5 |
#define ARTHURWIDGETS_H |
| 6 |
|
| 7 |
#include "arthurstyle.h" |
| 8 |
#include <QBitmap> |
| 9 |
#include <QPushButton> |
| 10 |
#include <QGroupBox> |
| 11 |
|
| 12 |
QT_FORWARD_DECLARE_CLASS(QTextDocument) |
| 13 |
QT_FORWARD_DECLARE_CLASS(QTextEdit) |
| 14 |
QT_FORWARD_DECLARE_CLASS(QVBoxLayout) |
| 15 |
|
| 16 |
class ArthurFrame : public QWidget |
| 17 |
|
| 18 |
{ |
| 19 |
Q_OBJECT |
| 20 |
public: |
| 21 |
ArthurFrame(QWidget *parent); |
| 22 |
virtual void paint(QPainter *) {} |
| 23 |
|
| 24 |
void paintDescription(QPainter *p); |
| 25 |
|
| 26 |
void loadDescription(const QString &filename); |
| 27 |
void setDescription(const QString &htmlDesc); |
| 28 |
|
| 29 |
void loadSourceFile(const QString &fileName); |
| 30 |
|
| 31 |
bool preferImage() const { return m_preferImage; } |
| 32 |
|
| 33 |
public slots: |
| 34 |
void setPreferImage(bool pi) { m_preferImage = pi; } |
| 35 |
void setDescriptionEnabled(bool enabled); |
| 36 |
void showSource(); |
| 37 |
|
| 38 |
signals: |
| 39 |
void descriptionEnabledChanged(bool); |
| 40 |
|
| 41 |
protected: |
| 42 |
void paintEvent(QPaintEvent *) override; |
| 43 |
void resizeEvent(QResizeEvent *) override; |
| 44 |
|
| 45 |
QPixmap m_tile; |
| 46 |
|
| 47 |
bool m_showDoc = false; |
| 48 |
bool m_preferImage = false; |
| 49 |
QTextDocument *m_document = nullptr; |
| 50 |
|
| 51 |
QString m_sourceFileName; |
| 52 |
}; |
| 53 |
|
| 54 |
#endif |