Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gui: fix toolbar init state #13971

Merged
merged 1 commit into from
May 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/Gui/ToolBarManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@

ToolBarItem* ToolBarItem::copy() const
{
auto root = new ToolBarItem;

Check warning on line 99 in src/Gui/ToolBarManager.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

initializing non-owner 'Gui::ToolBarItem *' with a newly created 'gsl::owner<>' [cppcoreguidelines-owning-memory]
root->setCommand( command() );

QList<ToolBarItem*> items = getItems();
Expand All @@ -117,7 +117,7 @@
_items.push_back( item );
}

bool ToolBarItem::insertItem( ToolBarItem* before, ToolBarItem* item)

Check warning on line 120 in src/Gui/ToolBarManager.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

2 adjacent parameters of 'insertItem' of similar type ('Gui::ToolBarItem *') are easily swapped by mistake [bugprone-easily-swappable-parameters]
{
int pos = _items.indexOf(before);
if (pos != -1) {
Expand All @@ -139,7 +139,7 @@
void ToolBarItem::clear()
{
for (auto it : qAsConst(_items)) {
delete it;

Check warning on line 142 in src/Gui/ToolBarManager.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

deleting a pointer through a type that is not marked 'gsl::owner<>'; consider using a smart pointer instead [cppcoreguidelines-owning-memory]
}

_items.clear();
Expand All @@ -153,7 +153,7 @@

ToolBarItem& ToolBarItem::operator << (const std::string& command)
{
auto item = new ToolBarItem(this);

Check warning on line 156 in src/Gui/ToolBarManager.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

initializing non-owner 'Gui::ToolBarItem *' with a newly created 'gsl::owner<>' [cppcoreguidelines-owning-memory]
item->setCommand(command);
return *this;
}
Expand All @@ -180,11 +180,11 @@
, _hParam(hParam)
, _conn(conn)
{
_layout = new QHBoxLayout(this);

Check warning on line 183 in src/Gui/ToolBarManager.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

assigning newly created 'gsl::owner<>' to non-owner 'QHBoxLayout *' [cppcoreguidelines-owning-memory]

Check warning on line 183 in src/Gui/ToolBarManager.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

'_layout' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
_layout->setContentsMargins(QMargins());
}

void addWidget(QWidget *w)

Check warning on line 187 in src/Gui/ToolBarManager.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

parameter name 'w' is too short, expected at least 2 characters [readability-identifier-length]
{
if (_layout->indexOf(w) < 0) {
_layout->addWidget(w);
Expand Down Expand Up @@ -633,7 +633,6 @@
}

setMovable(!areToolBarsLocked());
restoreState();
}

void ToolBarManager::setup(ToolBarItem* item, QToolBar* toolbar) const
Expand Down Expand Up @@ -1229,4 +1228,4 @@
}
}

#include "moc_ToolBarManager.cpp"

Check failure on line 1231 in src/Gui/ToolBarManager.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

'moc_ToolBarManager.cpp' file not found [clang-diagnostic-error]
Loading