Gui: fix some clang-tidy warnings:
* modernize-return-braced-init-list * modernize-use-equals-default * modernize-loop-convert * readability-implicit-bool-conversion * readability-named-parameter
This commit is contained in:
@@ -246,7 +246,7 @@ QString Action::cleanTitle(const QString & title)
|
||||
QString Action::commandToolTip(const Command *cmd, bool richFormat)
|
||||
{
|
||||
if (!cmd) {
|
||||
return QString();
|
||||
return {};
|
||||
}
|
||||
|
||||
if (richFormat) {
|
||||
@@ -281,7 +281,7 @@ QString Action::commandToolTip(const Command *cmd, bool richFormat)
|
||||
QString Action::commandMenuText(const Command *cmd)
|
||||
{
|
||||
if (!cmd) {
|
||||
return QString();
|
||||
return {};
|
||||
}
|
||||
|
||||
QString title;
|
||||
@@ -327,10 +327,10 @@ QString Action::createToolTip(QString helpText,
|
||||
// wrappin using <p style='white-space:pre'>.
|
||||
|
||||
QString shortcut = shortCut;
|
||||
if (shortcut.size() && helpText.endsWith(shortcut)) {
|
||||
if (!shortcut.isEmpty() && helpText.endsWith(shortcut)) {
|
||||
helpText.resize(helpText.size() - shortcut.size());
|
||||
}
|
||||
if (shortcut.size()) {
|
||||
if (!shortcut.isEmpty()) {
|
||||
shortcut = QString::fromLatin1(" (%1)").arg(shortcut);
|
||||
}
|
||||
|
||||
@@ -356,7 +356,7 @@ QString Action::createToolTip(QString helpText,
|
||||
.arg(cmdName.toHtmlEscaped());
|
||||
}
|
||||
|
||||
if (shortcut.size() && helpText.endsWith(shortcut)) {
|
||||
if (!shortcut.isEmpty() && helpText.endsWith(shortcut)) {
|
||||
helpText.resize(helpText.size() - shortcut.size());
|
||||
}
|
||||
|
||||
@@ -557,8 +557,9 @@ void ActionGroup::onActivated ()
|
||||
command()->invoke(this->property("defaultAction").toInt(), Command::TriggerAction);
|
||||
}
|
||||
|
||||
void ActionGroup::onToggled(bool)
|
||||
void ActionGroup::onToggled(bool check)
|
||||
{
|
||||
Q_UNUSED(check)
|
||||
onActivated();
|
||||
}
|
||||
|
||||
@@ -598,8 +599,6 @@ public:
|
||||
explicit WorkbenchActionEvent(QAction* act)
|
||||
: QEvent(QEvent::User), act(act)
|
||||
{ }
|
||||
~WorkbenchActionEvent() override
|
||||
{ }
|
||||
QAction* action() const
|
||||
{ return act; }
|
||||
private:
|
||||
@@ -617,10 +616,6 @@ WorkbenchComboBox::WorkbenchComboBox(WorkbenchGroup* wb, QWidget* parent) : QCom
|
||||
this, &WorkbenchComboBox::onWorkbenchActivated);
|
||||
}
|
||||
|
||||
WorkbenchComboBox::~WorkbenchComboBox()
|
||||
{
|
||||
}
|
||||
|
||||
void WorkbenchComboBox::showPopup()
|
||||
{
|
||||
int rows = count();
|
||||
@@ -737,10 +732,6 @@ WorkbenchGroup::WorkbenchGroup ( Command* pcCmd, QObject * parent )
|
||||
Application::Instance->signalRemoveWorkbench.connect(boost::bind(&WorkbenchGroup::slotRemoveWorkbench, this, bp::_1));
|
||||
}
|
||||
|
||||
WorkbenchGroup::~WorkbenchGroup()
|
||||
{
|
||||
}
|
||||
|
||||
void WorkbenchGroup::addTo(QWidget *widget)
|
||||
{
|
||||
refreshWorkbenchList();
|
||||
@@ -801,17 +792,17 @@ void WorkbenchGroup::refreshWorkbenchList()
|
||||
// Go through the list of enabled workbenches and verify that they really exist because
|
||||
// it might be possible that a workbench has been removed after setting up the list of
|
||||
// enabled workbenches.
|
||||
for (QStringList::Iterator it = enabled_wbs_list.begin(); it != enabled_wbs_list.end(); ++it) {
|
||||
int index = items.indexOf(*it);
|
||||
for (const auto& it : enabled_wbs_list) {
|
||||
int index = items.indexOf(it);
|
||||
if (index >= 0) {
|
||||
enable_wbs << *it;
|
||||
enable_wbs << it;
|
||||
items.removeAt(index);
|
||||
}
|
||||
}
|
||||
|
||||
// Filter out the actively disabled workbenches
|
||||
for (QStringList::Iterator it = disabled_wbs_list.begin(); it != disabled_wbs_list.end(); ++it) {
|
||||
int index = items.indexOf(*it);
|
||||
for (const auto& it : disabled_wbs_list) {
|
||||
int index = items.indexOf(it);
|
||||
if (index >= 0) {
|
||||
items.removeAt(index);
|
||||
}
|
||||
@@ -833,8 +824,8 @@ void WorkbenchGroup::refreshWorkbenchList()
|
||||
|
||||
// Show all enabled wb
|
||||
int index = 0;
|
||||
for (QStringList::Iterator it = enable_wbs.begin(); it != enable_wbs.end(); ++it) {
|
||||
setWorkbenchData(index++, *it);
|
||||
for (const auto& it : enable_wbs) {
|
||||
setWorkbenchData(index++, it);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -854,9 +845,9 @@ void WorkbenchGroup::slotAddWorkbench(const char* name)
|
||||
{
|
||||
QList<QAction*> workbenches = groupAction()->actions();
|
||||
QAction* action = nullptr;
|
||||
for (QList<QAction*>::Iterator it = workbenches.begin(); it != workbenches.end(); ++it) {
|
||||
if (!(*it)->isVisible()) {
|
||||
action = *it;
|
||||
for (auto it : workbenches) {
|
||||
if (!it->isVisible()) {
|
||||
action = it;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -884,14 +875,14 @@ void WorkbenchGroup::slotRemoveWorkbench(const char* name)
|
||||
{
|
||||
QString workbench = QString::fromLatin1(name);
|
||||
QList<QAction*> workbenches = groupAction()->actions();
|
||||
for (QList<QAction*>::Iterator it = workbenches.begin(); it != workbenches.end(); ++it) {
|
||||
if ((*it)->objectName() == workbench) {
|
||||
(*it)->setObjectName(QString());
|
||||
(*it)->setIcon(QIcon());
|
||||
(*it)->setText(QString());
|
||||
(*it)->setToolTip(QString());
|
||||
(*it)->setStatusTip(QString());
|
||||
(*it)->setVisible(false); // do this at last
|
||||
for (auto it : workbenches) {
|
||||
if (it->objectName() == workbench) {
|
||||
it->setObjectName(QString());
|
||||
it->setIcon(QIcon());
|
||||
it->setText(QString());
|
||||
it->setToolTip(QString());
|
||||
it->setStatusTip(QString());
|
||||
it->setVisible(false); // do this at last
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -918,8 +909,9 @@ public:
|
||||
handle->Detach(this);
|
||||
}
|
||||
|
||||
void OnChange(Base::Subject<const char*> &, const char *reason) override
|
||||
void OnChange(Base::Subject<const char*> & sub, const char *reason) override
|
||||
{
|
||||
Q_UNUSED(sub)
|
||||
if (!updating && reason && strcmp(reason, "RecentFiles")==0) {
|
||||
Base::StateLocker guard(updating);
|
||||
master->restore();
|
||||
@@ -945,10 +937,6 @@ RecentFilesAction::RecentFilesAction ( Command* pcCmd, QObject * parent )
|
||||
restore();
|
||||
}
|
||||
|
||||
RecentFilesAction::~RecentFilesAction()
|
||||
{
|
||||
}
|
||||
|
||||
/** Adds the new item to the recent files. */
|
||||
void RecentFilesAction::appendFile(const QString& filename)
|
||||
{
|
||||
@@ -1106,10 +1094,6 @@ RecentMacrosAction::RecentMacrosAction ( Command* pcCmd, QObject * parent )
|
||||
restore();
|
||||
}
|
||||
|
||||
RecentMacrosAction::~RecentMacrosAction()
|
||||
{
|
||||
}
|
||||
|
||||
/** Adds the new item to the recent files. */
|
||||
void RecentMacrosAction::appendFile(const QString& filename)
|
||||
{
|
||||
@@ -1459,10 +1443,6 @@ WindowAction::WindowAction ( Command* pcCmd, QObject * parent )
|
||||
{
|
||||
}
|
||||
|
||||
WindowAction::~WindowAction()
|
||||
{
|
||||
}
|
||||
|
||||
void WindowAction::addTo ( QWidget * widget )
|
||||
{
|
||||
auto menu = qobject_cast<QMenu*>(widget);
|
||||
|
||||
@@ -179,7 +179,6 @@ class GuiExport WorkbenchComboBox : public QComboBox
|
||||
|
||||
public:
|
||||
explicit WorkbenchComboBox(WorkbenchGroup* wb, QWidget* parent=nullptr);
|
||||
~WorkbenchComboBox() override;
|
||||
void showPopup() override;
|
||||
|
||||
public Q_SLOTS:
|
||||
@@ -213,7 +212,6 @@ public:
|
||||
* when it gets activated.
|
||||
*/
|
||||
WorkbenchGroup (Command* pcCmd, QObject * parent);
|
||||
~WorkbenchGroup() override;
|
||||
void addTo (QWidget * widget) override;
|
||||
void refreshWorkbenchList();
|
||||
|
||||
@@ -242,7 +240,6 @@ class GuiExport RecentFilesAction : public ActionGroup
|
||||
|
||||
public:
|
||||
explicit RecentFilesAction (Command* pcCmd, QObject * parent = nullptr);
|
||||
~RecentFilesAction() override;
|
||||
|
||||
void appendFile(const QString&);
|
||||
void activateFile(int);
|
||||
@@ -277,7 +274,6 @@ class GuiExport RecentMacrosAction : public ActionGroup
|
||||
|
||||
public:
|
||||
explicit RecentMacrosAction (Command* pcCmd, QObject * parent = nullptr);
|
||||
~RecentMacrosAction() override;
|
||||
|
||||
void appendFile(const QString&);
|
||||
void activateFile(int);
|
||||
@@ -406,7 +402,6 @@ class GuiExport WindowAction : public ActionGroup
|
||||
|
||||
public:
|
||||
explicit WindowAction (Command* pcCmd, QObject * parent = nullptr);
|
||||
~WindowAction() override;
|
||||
void addTo (QWidget * widget) override;
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user