aboutsummaryrefslogtreecommitdiff
path: root/autotests/kconfig_compiler/test_properties_minmax.h.ref
blob: e8be43828fcc3dee008a46c40b4da92402896a1a (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
76
77
78
79
80
// This file is generated by kconfig_compiler_kf5 from test_properties_minmax.kcfg.
// All changes you do to this file will be lost.
#ifndef TESTPROPERTIESMINMAX_H
#define TESTPROPERTIESMINMAX_H

#include <qglobal.h>
#include <kconfigskeleton.h>
#include <QCoreApplication>
#include <QDebug>

class TestPropertiesMinMax : public KConfigSkeleton
{
  Q_OBJECT
  public:

    TestPropertiesMinMax( KSharedConfig::Ptr config = KSharedConfig::openConfig() );
    ~TestPropertiesMinMax() override;

    /**
      Set bar
    */
    void setBar( int v )
    {
      if (v < 36)
      {
        qDebug() << "setBar: value " << v << " is less than the minimum value of 36";
        v = 36;
      }

      if (v > 102)
      {
        qDebug() << "setBar: value " << v << " is greater than the maximum value of 102";
        v = 102;
      }

      if (v != mBar && !isBarImmutable()) {
        mBar = v;
        Q_EMIT barChanged();
      }
    }

    Q_PROPERTY(int bar READ bar WRITE setBar NOTIFY barChanged)
    Q_PROPERTY(bool isBarImmutable READ isBarImmutable CONSTANT)
    /**
      Get bar
    */
    int bar() const
    {
      return mBar;
    }

    /**
      Is bar Immutable
    */
    bool isBarImmutable() const
    {
      return isImmutable( QStringLiteral( "bar" ) );
    }


    enum {
      signalBarChanged = 0x1
    };

  Q_SIGNALS:
    void barChanged();

  private:
    void itemChanged(quint64 flags);

  protected:

    // Something
    int mBar;

  private:
};

#endif