Gui: fix warnings reported by GH Actions:

* Fix trailing spaces
* Replace tabs
* Mark constructors with one argument explicit
* Fix typos
* Include FCGlobal.h to fix parsing errors
This commit is contained in:
wmayer
2022-11-11 09:56:43 +01:00
parent 5f4dbf7b4c
commit 21f47cf2ec
11 changed files with 30 additions and 29 deletions

View File

@@ -46,7 +46,7 @@ class GuiExport Action : public QObject
Q_OBJECT
public:
Action (Command* pcCmd, QObject * parent = nullptr);
explicit Action (Command* pcCmd, QObject * parent = nullptr);
/// Action takes ownership of the 'action' object.
Action (Command* pcCmd, QAction* action, QObject * parent);
virtual ~Action();
@@ -128,7 +128,7 @@ class GuiExport ActionGroup : public Action
Q_OBJECT
public:
ActionGroup (Command* pcCmd, QObject * parent = nullptr);
explicit ActionGroup (Command* pcCmd, QObject * parent = nullptr);
virtual ~ActionGroup();
void addTo (QWidget * w);
@@ -168,7 +168,7 @@ class GuiExport WorkbenchComboBox : public QComboBox
Q_OBJECT
public:
WorkbenchComboBox(WorkbenchGroup* wb, QWidget* parent=nullptr);
explicit WorkbenchComboBox(WorkbenchGroup* wb, QWidget* parent=nullptr);
virtual ~WorkbenchComboBox();
void showPopup();
@@ -227,7 +227,7 @@ class GuiExport RecentFilesAction : public ActionGroup
Q_OBJECT
public:
RecentFilesAction (Command* pcCmd, QObject * parent = nullptr);
explicit RecentFilesAction (Command* pcCmd, QObject * parent = nullptr);
virtual ~RecentFilesAction();
void appendFile(const QString&);
@@ -260,7 +260,7 @@ class GuiExport RecentMacrosAction : public ActionGroup
Q_OBJECT
public:
RecentMacrosAction (Command* pcCmd, QObject * parent = nullptr);
explicit RecentMacrosAction (Command* pcCmd, QObject * parent = nullptr);
virtual ~RecentMacrosAction();
void appendFile(const QString&);
@@ -293,7 +293,7 @@ class GuiExport UndoAction : public Action
Q_OBJECT
public:
UndoAction (Command* pcCmd,QObject * parent = nullptr);
explicit UndoAction (Command* pcCmd,QObject * parent = nullptr);
~UndoAction();
void addTo (QWidget * w);
void setEnabled(bool);
@@ -318,7 +318,7 @@ class GuiExport RedoAction : public Action
Q_OBJECT
public:
RedoAction (Command* pcCmd,QObject * parent = nullptr);
explicit RedoAction (Command* pcCmd,QObject * parent = nullptr);
~RedoAction();
void addTo ( QWidget * w );
void setEnabled(bool);
@@ -342,7 +342,7 @@ class GuiExport DockWidgetAction : public Action
Q_OBJECT
public:
DockWidgetAction (Command* pcCmd, QObject * parent = nullptr);
explicit DockWidgetAction (Command* pcCmd, QObject * parent = nullptr);
virtual ~DockWidgetAction();
void addTo (QWidget * w);
@@ -361,7 +361,7 @@ class GuiExport ToolBarAction : public Action
Q_OBJECT
public:
ToolBarAction (Command* pcCmd, QObject * parent = nullptr);
explicit ToolBarAction (Command* pcCmd, QObject * parent = nullptr);
virtual ~ToolBarAction();
void addTo (QWidget * w);
@@ -379,7 +379,7 @@ class GuiExport WindowAction : public ActionGroup
Q_OBJECT
public:
WindowAction (Command* pcCmd, QObject * parent = nullptr);
explicit WindowAction (Command* pcCmd, QObject * parent = nullptr);
virtual ~WindowAction();
void addTo (QWidget * w);

View File

@@ -862,8 +862,8 @@ SET(Quarter_MOC_HDR
qt_wrap_cpp(Quarter_MOC_SRCS ${Quarter_MOC_HDR})
SET(Quarter_SRCS
${Quarter_CPP_SRC}
SET(Quarter_SRCS
${Quarter_CPP_SRC}
${Quarter_H_SRC}
${Quarter_MOC_SRCS}
)
@@ -1128,7 +1128,7 @@ SET(FreeCADGui_CPP_SRCS
ManualAlignment.cpp
TransactionObject.cpp
)
SET(FreeCADGui_SRCS
SET(FreeCADGui_SRCS
Application.h
AutoSaver.h
BitmapFactory.h

View File

@@ -55,7 +55,7 @@ class CommandModel : public QAbstractItemModel
int revision = 0;
public:
CommandModel(QObject* parent)
explicit CommandModel(QObject* parent)
: QAbstractItemModel(parent)
{
update();

View File

@@ -41,7 +41,7 @@ class GuiExport CommandCompleter : public QCompleter
{
Q_OBJECT
public:
CommandCompleter(QLineEdit *edit, QObject *parent = nullptr);
explicit CommandCompleter(QLineEdit *edit, QObject *parent = nullptr);
Q_SIGNALS:
/// Triggered when a command is selected in the completer

View File

@@ -306,7 +306,7 @@ PyObject* CommandPy::createCustomCommand(PyObject* args, PyObject* kw)
auto macro = new MacroCommand(name.c_str(), false);
commandManager.addCommand(macro);
macro->setScriptName(macroFile);
macro->setScriptName(macroFile);
if (menuTxt)
macro->setMenuText(menuTxt);
@@ -338,8 +338,8 @@ PyObject* CommandPy::removeCustomCommand(PyObject* args)
CommandManager& commandManager = Application::Instance->commandManager();
std::vector<Command*> macros = commandManager.getGroupCommands("Macros");
auto action = std::find_if(macros.begin(), macros.end(), [actionName](const Command* c) {
return std::string(c->getName()) == std::string(actionName);
auto action = std::find_if(macros.begin(), macros.end(), [actionName](const Command* c) {
return std::string(c->getName()) == std::string(actionName);
});
if (action != macros.end()) {

View File

@@ -2599,7 +2599,7 @@ void StdViewBoxZoom::activated(int iMsg)
View3DInventorViewer* viewer = view->getViewer();
if (!viewer->isSelecting()) {
SelectionCallbackHandler::Create(viewer, View3DInventorViewer::BoxZoom, QCursor(QPixmap(cursor_box_zoom), 7, 7));
}
}
}
}

View File

@@ -182,10 +182,10 @@ be treated as shorctcut key sequence 'F, F'.</string>
<property name="toolTip">
<string>This list shows commands having the same shortcut in the priority from high
to low. If more than one command with the same shortcut are active at the
same time. The one with the highest prioirty will be triggered.</string>
same time. The one with the highest priority will be triggered.</string>
</property>
<property name="text">
<string>Shorcut priority list:</string>
<string>Shortcut priority list:</string>
</property>
</widget>
</item>

View File

@@ -322,10 +322,10 @@ bool ShortcutManager::eventFilter(QObject *o, QEvent *ev)
if (it->key.shortcut == action->shortcut() && it->key.name == name)
break;
QKeySequence oldShortcut = it->key.shortcut;
index.replace(it, {action, name});
index.replace(it, ActionData{action, name});
actionShortcutChanged(action, oldShortcut);
} else {
index.insert({action, name});
index.insert(ActionData{action, name});
actionShortcutChanged(action, QKeySequence());
}
}

View File

@@ -20,8 +20,8 @@
* *
****************************************************************************/
#ifndef GUI_SHORTCUT_MANAGER_H
#define GUI_SHORTCUT_MANAGER_H
#ifndef GUI_SHORTCUT_MANAGER_H
#define GUI_SHORTCUT_MANAGER_H
#include <unordered_map>
@@ -108,7 +108,7 @@ private:
struct ActionKey {
QKeySequence shortcut;
QByteArray name;
ActionKey(const QKeySequence &shortcut, const char *name = "")
explicit ActionKey(const QKeySequence &shortcut, const char *name = "")
: shortcut(shortcut)
, name(name)
{}
@@ -126,7 +126,7 @@ private:
intptr_t pointer;
QPointer<QAction> action;
ActionData(QAction *action, const char *name = "")
explicit ActionData(QAction *action, const char *name = "")
: key(action->shortcut(), name)
, pointer(reinterpret_cast<intptr_t>(action))
, action(action)

View File

@@ -26,6 +26,7 @@
#include <string>
#include <QStringList>
#include <FCGlobal.h>
class QAction;
class QToolBar;
@@ -41,7 +42,7 @@ public:
};
ToolBarItem();
ToolBarItem(ToolBarItem* item, HideStyle forceHide = HideStyle::VISIBLE);
explicit ToolBarItem(ToolBarItem* item, HideStyle forceHide = HideStyle::VISIBLE);
~ToolBarItem();
void setCommand(const std::string&);

View File

@@ -1255,7 +1255,7 @@ void StatusWidget::hideEvent(QHideEvent*)
class LineNumberArea : public QWidget
{
public:
LineNumberArea(PropertyListEditor *editor) : QWidget(editor) {
explicit LineNumberArea(PropertyListEditor *editor) : QWidget(editor) {
codeEditor = editor;
}