-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
moc: add a test for Q_FLAG getter/setter on integers
This is legacy behavior from Qt 3, before we had QFlags and before QVariant could support user types. I cannot find any instance of a getter returning an integer in current Qt or Qt Creator code. And note this only compiles if the flags type with Q_FLAG - not Q_ENUM. The content is wrapped as Qt 6.x only so it can be removed in Qt 7.0. The deprecation warning will come in a later commit, for 6.9. Change-Id: Ie3ddd8025e3b4387866efffd8e8d46c3daa0dff2 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> (cherry picked from commit 939f7f5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
- Loading branch information
1 parent
202acb9
commit c1b13a0
Showing
3 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright (C) 2024 Intel Corporation. | ||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only | ||
|
||
#ifndef FLAGS_PROPERTY_INTEGER_ACCESS | ||
#define FLAGS_PROPERTY_INTEGER_ACCESS | ||
#include <QtCore/qobject.h> | ||
|
||
class ClassWithFlagsAccessAsInteger : public QObject | ||
{ | ||
Q_OBJECT | ||
public: | ||
enum Flag { F1 = 1, F2 = 2 }; | ||
Q_DECLARE_FLAGS(Flags, Flag) | ||
Q_FLAG(Flags) | ||
Q_PROPERTY(Flags flagsValue READ flagsValue WRITE setFlagsValue) | ||
uint flagsValue() const { return f; } | ||
void setFlagsValue(uint v) { f = v; } | ||
|
||
private: | ||
uint f = 0; | ||
}; | ||
|
||
#endif // FLAGS_PROPERTY_INTEGER_ACCESS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters