Qt Model Utilities  2.0.3
A set of utilities for the model/view framework of Qt
abstractsingleroleserialiser.h
1 /****************************************************************************\
2  Copyright 2018 Luca Beldi
3  Licensed under the Apache License, Version 2.0 (the "License");
4  you may not use this file except in compliance with the License.
5  You may obtain a copy of the License at
6  http://www.apache.org/licenses/LICENSE-2.0
7  Unless required by applicable law or agreed to in writing, software
8  distributed under the License is distributed on an "AS IS" BASIS,
9  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10  See the License for the specific language governing permissions and
11  limitations under the License.
12 \****************************************************************************/
13 
14 #ifndef ABSTRACTSINGLEROLESERIALISER_H
15 #define ABSTRACTSINGLEROLESERIALISER_H
16 
17 #include "abstractstringserialiser.h"
18 class AbstractSingleRoleSerialiserPrivate;
19 class MODELUTILITIES_EXPORT AbstractSingleRoleSerialiser : public AbstractStringSerialiser
20 {
21  Q_OBJECT
22  Q_PROPERTY(int roleToSave READ roleToSave WRITE setRoleToSave)
23  Q_DECLARE_PRIVATE(AbstractSingleRoleSerialiser)
24  Q_DISABLE_COPY(AbstractSingleRoleSerialiser)
25 public:
26  explicit AbstractSingleRoleSerialiser(QObject *parent = Q_NULLPTR);
27  AbstractSingleRoleSerialiser(QAbstractItemModel *model, QObject *parent);
28  AbstractSingleRoleSerialiser(const QAbstractItemModel *model, QObject *parent);
30  int roleToSave() const;
31  void setRoleToSave(int val);
32  void setRoleToSave(const QList<int> &val) Q_DECL_OVERRIDE;
33  void addRoleToSave(int role) Q_DECL_OVERRIDE;
34  void removeRoleToSave(int role) Q_DECL_OVERRIDE;
35  void clearRoleToSave() Q_DECL_OVERRIDE;
36  void resetRoleToSave() Q_DECL_OVERRIDE;
37 
38 protected:
39  AbstractSingleRoleSerialiser(AbstractSingleRoleSerialiserPrivate &d, QObject *parent);
40 };
41 #endif // ABSTRACTSINGLEROLESERIALISER_H
virtual Q_INVOKABLE void addRoleToSave(int role)
Appends role to the list of roles to save.
Definition: abstractmodelserialiser.cpp:117
virtual Q_INVOKABLE void clearRoleToSave()
empties the list of roles to save
Definition: abstractmodelserialiser.cpp:136
virtual Q_INVOKABLE void removeRoleToSave(int role)
Removes role from the list of roles to save.
Definition: abstractmodelserialiser.cpp:127
The interface for model serialisers saving only one role.
Definition: abstractsingleroleserialiser.h:20
The interface for model serialisers saving to strings.
Definition: abstractstringserialiser.h:23