aboutsummaryrefslogtreecommitdiff
path: root/libs/installer_omod/src/oldstuff/MIT-licencedCodeToDoStuff/checkboxwordwrap.h
blob: dc4d30c2fffcf2175e885e065f1e4b32c60b4996 (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#ifndef CHECKBOXWORDWRAP_H
#define CHECKBOXWORDWRAP_H

#include <QCheckBox>
#include <QHBoxLayout>
#include <QRadioButton>

#include "clickablelabel.h"

/**
 * @author thibdev
 */
class CheckBoxWordWrap : public QCheckBox
{
    Q_OBJECT

    Q_PROPERTY(bool wordwrap READ isWordWrap WRITE setWordWrap)
    Q_PROPERTY(QString text READ text WRITE setText)

public:
    CheckBoxWordWrap(QWidget *parent = Q_NULLPTR);
    CheckBoxWordWrap(const QString &text, QWidget *parent = Q_NULLPTR);
    ~CheckBoxWordWrap();
    bool isWordWrap() const;
    void setWordWrap(bool wordwrap);
    QString text() const;
    void setText(const QString &text);
    QSize sizeHint() const override;

private slots:
    void labelIsClicked();

protected:
    void resizeEvent(QResizeEvent *event) override;

private:
    void init();
    const int separation = 5;
    QHBoxLayout     *m_hMainLayout;
    ClickableLabel  *m_label;

};

class RadioButtonWordWrap : public QRadioButton
{
  Q_OBJECT

    Q_PROPERTY(bool wordwrap READ isWordWrap WRITE setWordWrap)
    Q_PROPERTY(QString text READ text WRITE setText)

public:
  RadioButtonWordWrap(QWidget* parent = Q_NULLPTR);
  RadioButtonWordWrap(const QString& text, QWidget* parent = Q_NULLPTR);
  ~RadioButtonWordWrap();
  bool isWordWrap() const;
  void setWordWrap(bool wordwrap);
  QString text() const;
  void setText(const QString& text);
  QSize sizeHint() const override;

private slots:
  void labelIsClicked();

protected:
  void resizeEvent(QResizeEvent* event) override;

private:
  void init();
  const int separation = 5;
  QHBoxLayout* m_hMainLayout;
  ClickableLabel* m_label;

};

#endif