Use Q_ENUM instead of obsoleted Q_ENUMS

It fixes the following warning:
Use Q_ENUM instead of Q_ENUMS [clazy-qenums]

In addition, it amends 8588cf268f
where WidgetStyle got removed.

Change-Id: I4d72dd762a2f18ba8886360b3581b4ef19bf4c5e
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2020-12-08 17:32:27 +01:00
parent dce06016ef
commit d42f38cc96
17 changed files with 19 additions and 29 deletions

View File

@@ -176,7 +176,7 @@ public: // must be public to make Q_GADGET introspection work
case_start, // after a 'case' or 'default' token
case_cont // after the colon in a case/default
};
Q_ENUMS(StateType)
Q_ENUM(StateType)
protected:
// extends Token::Kind from qmljsscanner.h

View File

@@ -44,7 +44,6 @@ class QTCREATOR_UTILS_EXPORT DetailsWidget : public QWidget
Q_PROPERTY(bool useCheckBox READ useCheckBox WRITE setUseCheckBox DESIGNABLE true)
Q_PROPERTY(bool checked READ isChecked WRITE setChecked DESIGNABLE true)
Q_PROPERTY(State state READ state WRITE setState)
Q_ENUMS(State)
public:
enum State {
@@ -53,6 +52,7 @@ public:
NoSummary,
OnlySummary
};
Q_ENUM(State)
explicit DetailsWidget(QWidget *parent = nullptr);
~DetailsWidget() override;

View File

@@ -71,10 +71,9 @@ private:
class QTCREATOR_UTILS_EXPORT FancyLineEdit : public CompletingLineEdit
{
Q_OBJECT
Q_ENUMS(Side)
public:
enum Side {Left = 0, Right = 1};
Q_ENUM(Side)
explicit FancyLineEdit(QWidget *parent = nullptr);
~FancyLineEdit() override;

View File

@@ -32,7 +32,6 @@
#include <QApplication>
#include <QIcon>
#include <QImage>
#include <QMetaEnum>
#include <QPainter>
#include <QPaintEngine>
#include <QWidget>

View File

@@ -33,13 +33,13 @@ namespace Utils {
class QTCREATOR_UTILS_EXPORT ParameterAction : public QAction
{
Q_ENUMS(EnablingMode)
Q_PROPERTY(QString emptyText READ emptyText WRITE setEmptyText)
Q_PROPERTY(QString parameterText READ parameterText WRITE setParameterText)
Q_PROPERTY(EnablingMode enablingMode READ enablingMode WRITE setEnablingMode)
Q_OBJECT
public:
enum EnablingMode { AlwaysEnabled, EnabledWithParameter };
Q_ENUM(EnablingMode)
explicit ParameterAction(const QString &emptyText,
const QString &parameterText,

View File

@@ -46,7 +46,6 @@ class PathChooserPrivate;
class QTCREATOR_UTILS_EXPORT PathChooser : public QWidget
{
Q_OBJECT
Q_ENUMS(Kind)
Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged DESIGNABLE true)
Q_PROPERTY(QString promptDialogTitle READ promptDialogTitle WRITE setPromptDialogTitle DESIGNABLE true)
Q_PROPERTY(QString promptDialogFilter READ promptDialogFilter WRITE setPromptDialogFilter DESIGNABLE true)
@@ -72,6 +71,7 @@ public:
Command, // A command that may or may not exist at the time of selection (e.g. result of a build)
Any
};
Q_ENUM(Kind)
// Default is <Directory>
void setExpectedKind(Kind expected);

View File

@@ -40,13 +40,6 @@ class ThemePrivate;
class QTCREATOR_UTILS_EXPORT Theme : public QObject
{
Q_OBJECT
Q_ENUMS(Color)
Q_ENUMS(ImageFile)
Q_ENUMS(Gradient)
Q_ENUMS(Flag)
Q_ENUMS(WidgetStyle)
public:
Theme(const QString &id, QObject *parent = nullptr);
~Theme() override;
@@ -381,6 +374,11 @@ public:
DarkUserInterface
};
Q_ENUM(Color)
Q_ENUM(ImageFile)
Q_ENUM(Gradient)
Q_ENUM(Flag)
Q_INVOKABLE bool flag(Flag f) const;
Q_INVOKABLE QColor color(Color role) const;
QString imageFile(ImageFile imageFile, const QString &fallBack) const;

View File

@@ -45,7 +45,6 @@ class ShellCommand;
class CORE_EXPORT IVersionControl : public QObject
{
Q_OBJECT
Q_ENUMS(SettingsFlag Operation)
public:
enum SettingsFlag {
AutoOpen = 0x1
@@ -59,6 +58,8 @@ public:
AnnotateOperation,
InitialCheckoutOperation
};
Q_ENUM(SettingsFlag)
Q_ENUM(Operation)
enum OpenSupportMode {
NoOpen, /*!< Files can be edited without noticing the VCS */

View File

@@ -32,7 +32,6 @@
#include <QHBoxLayout>
#include <QLabel>
#include <QMetaEnum>
#include <QPainter>
#include <QPixmap>
#include <QUrl>

View File

@@ -35,8 +35,6 @@ struct NewClassWidgetPrivate;
class NewClassWidget : public QWidget
{
Q_OBJECT
Q_ENUMS(ClassType)
public:
enum ClassType { NoClassType,
ClassInheritsQObject,
@@ -45,6 +43,7 @@ public:
ClassInheritsQQuickItem,
SharedDataClass
};
Q_ENUM(ClassType)
explicit NewClassWidget(QWidget *parent = nullptr);
~NewClassWidget() override;

View File

@@ -39,7 +39,6 @@ class PerfProfilerFlameGraphModel : public QAbstractItemModel
{
Q_OBJECT
Q_DISABLE_COPY(PerfProfilerFlameGraphModel);
Q_ENUMS(Role)
public:
PerfProfilerFlameGraphModel(PerfProfilerFlameGraphModel &&) = delete;
PerfProfilerFlameGraphModel &operator=(PerfProfilerFlameGraphModel &&) = delete;
@@ -61,6 +60,7 @@ public:
ResourcePeakRole,
MaxRole
};
Q_ENUM(Role)
struct Data {
Data *parent = nullptr;

View File

@@ -41,9 +41,6 @@ namespace QmlDesigner {
class QMLDESIGNERCORE_EXPORT Theme : public Utils::Theme
{
Q_OBJECT
Q_ENUMS(Icon)
public:
enum Icon {
actionIcon,
@@ -146,6 +143,7 @@ public:
zoomOut,
zoomSelection
};
Q_ENUM(Icon)
static Theme *instance();
static QString replaceCssColors(const QString &input);

View File

@@ -74,14 +74,13 @@ class QmlAnchorBindingProxy : public QObject
Q_PROPERTY(QStringList possibleTargetItems READ possibleTargetItems NOTIFY itemNodeChanged)
Q_ENUMS(RelativeAnchorTarget)
public:
enum RelativeAnchorTarget {
SameEdge = 0,
Center = 1,
OppositeEdge = 2
};
Q_ENUM(RelativeAnchorTarget)
//only enable if node has parent

View File

@@ -55,7 +55,6 @@ struct FlameGraphData {
class FlameGraphModel : public QAbstractItemModel
{
Q_OBJECT
Q_ENUMS(Role)
public:
enum Role {
TypeIdRole = Qt::UserRole + 1, // Sort by data, not by displayed string
@@ -74,6 +73,7 @@ public:
MemoryRole,
MaxRole
};
Q_ENUM(Role)
FlameGraphModel(QmlProfilerModelManager *modelManager, QObject *parent = nullptr);

View File

@@ -31,7 +31,6 @@
#include <QFile>
#include <QCoreApplication>
#include <QMetaEnum>
#include <QXmlStreamWriter>
using namespace TextEditor;

View File

@@ -41,13 +41,13 @@ class UpdateInfoPlugin final : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "UpdateInfo.json")
Q_ENUMS(CheckUpdateInterval)
public:
enum CheckUpdateInterval {
DailyCheck,
WeeklyCheck,
MonthlyCheck
};
Q_ENUM(CheckUpdateInterval)
UpdateInfoPlugin();
~UpdateInfoPlugin() override;

View File

@@ -38,8 +38,6 @@ namespace Callgrind {
class CallgrindController : public QObject
{
Q_OBJECT
Q_ENUMS(Option)
public:
enum Option {
Unknown,
@@ -48,6 +46,7 @@ public:
Pause,
UnPause
};
Q_ENUM(Option)
CallgrindController();
~CallgrindController() override;