Skip to content

Commit

Permalink
fix(tier4_state_rviz_plugin): fix unusedFunction (autowarefoundation#…
Browse files Browse the repository at this point in the history
…8608)

* fix:unusedFunction

Signed-off-by: kobayu858 <[email protected]>

* fix:clang format

Signed-off-by: kobayu858 <[email protected]>

* fix:revert custom button

Signed-off-by: kobayu858 <[email protected]>

* fix:revert custom container

Signed-off-by: kobayu858 <[email protected]>

* fix:revert custom icon label

Signed-off-by: kobayu858 <[email protected]>

* fix:revert custom label

Signed-off-by: kobayu858 <[email protected]>

* fix:revert custom segment button

Signed-off-by: kobayu858 <[email protected]>

* fix:revert custom slider

Signed-off-by: kobayu858 <[email protected]>

* fix:revert custom toggle switch

Signed-off-by: kobayu858 <[email protected]>

* fix:revert custom label

Signed-off-by: kobayu858 <[email protected]>

* fix:add blank line

Signed-off-by: kobayu858 <[email protected]>

* fix:revert custom botton item

Signed-off-by: kobayu858 <[email protected]>

* fix:remove declaration

Signed-off-by: kobayu858 <[email protected]>

---------

Signed-off-by: kobayu858 <[email protected]>
  • Loading branch information
kobayu858 authored Aug 28, 2024
1 parent 9323780 commit bda8706
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 27 deletions.
3 changes: 3 additions & 0 deletions common/tier4_state_rviz_plugin/src/custom_button.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,13 @@ QSize CustomElevatedButton::sizeHint() const
return QSize(width, height);
}

// cppcheck-suppress unusedFunction
QSize CustomElevatedButton::minimumSizeHint() const
{
return sizeHint();
}

// cppcheck-suppress unusedFunction
void CustomElevatedButton::updateStyle(
const QString & text, const QColor & bgColor, const QColor & textColor, const QColor & hoverColor,
const QColor & disabledBgColor, const QColor & disabledTextColor)
Expand All @@ -71,6 +73,7 @@ void CustomElevatedButton::updateStyle(
update(); // Force repaint
}

// cppcheck-suppress unusedFunction
void CustomElevatedButton::paintEvent(QPaintEvent *)
{
QPainter painter(this);
Expand Down
13 changes: 2 additions & 11 deletions common/tier4_state_rviz_plugin/src/custom_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,7 @@ CustomContainer::CustomContainer(QWidget * parent) : QFrame(parent), cornerRadiu
setLayout(layout);
}

void CustomContainer::setCornerRadius(int radius)
{
cornerRadius = radius;
update();
}

int CustomContainer::getCornerRadius() const
{
return cornerRadius;
}

// cppcheck-suppress unusedFunction
QGridLayout * CustomContainer::getLayout() const
{
return layout; // Provide access to the layout
Expand All @@ -50,6 +40,7 @@ QSize CustomContainer::sizeHint() const
return QSize(width, height);
}

// cppcheck-suppress unusedFunction
QSize CustomContainer::minimumSizeHint() const
{
return sizeHint();
Expand Down
2 changes: 2 additions & 0 deletions common/tier4_state_rviz_plugin/src/custom_icon_label.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,13 @@ QSize CustomIconLabel::sizeHint() const
return QSize(size, size);
}

// cppcheck-suppress unusedFunction
QSize CustomIconLabel::minimumSizeHint() const
{
return sizeHint();
}

// cppcheck-suppress unusedFunction
void CustomIconLabel::paintEvent(QPaintEvent *)
{
QPainter painter(this);
Expand Down
2 changes: 2 additions & 0 deletions common/tier4_state_rviz_plugin/src/custom_label.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,13 @@ QSize CustomLabel::sizeHint() const
return QSize(width, height);
}

// cppcheck-suppress unusedFunction
QSize CustomLabel::minimumSizeHint() const
{
return sizeHint();
}

// cppcheck-suppress unusedFunction
void CustomLabel::paintEvent(QPaintEvent *)
{
QPainter painter(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ CustomSegmentedButtonItem * CustomSegmentedButton::addButton(const QString & tex
return button;
}

// cppcheck-suppress unusedFunction
QButtonGroup * CustomSegmentedButton::getButtonGroup() const
{
return buttonGroup;
Expand All @@ -54,11 +55,13 @@ QSize CustomSegmentedButton::sizeHint() const
// layout->itemAt(0)->widget()->height() + 10);
}

// cppcheck-suppress unusedFunction
QSize CustomSegmentedButton::minimumSizeHint() const
{
return sizeHint();
}

// cppcheck-suppress unusedFunction
void CustomSegmentedButton::paintEvent(QPaintEvent *)
{
QPainter painter(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,6 @@ CustomSegmentedButtonItem::CustomSegmentedButtonItem(const QString & text, QWidg
setCursor(Qt::PointingHandCursor);
}

void CustomSegmentedButtonItem::setColors(
const QColor & bg, const QColor & checkedBg, const QColor & activeText,
const QColor & inactiveText)
{
bgColor = bg;
checkedBgColor = checkedBg;
activeTextColor = activeText;
inactiveTextColor = inactiveText;
update();
}

// void CustomSegmentedButtonItem::updateSize()
// {
// QFontMetrics fm(font());
Expand All @@ -51,12 +40,14 @@ void CustomSegmentedButtonItem::setColors(
// setFixedSize(width, height);
// }

// cppcheck-suppress unusedFunction
void CustomSegmentedButtonItem::setHovered(bool hovered)
{
isHovered = hovered;
updateCheckableState();
}

// cppcheck-suppress unusedFunction
void CustomSegmentedButtonItem::setCheckableButton(bool checkable)
{
setCheckable(checkable);
Expand All @@ -71,18 +62,21 @@ void CustomSegmentedButtonItem::updateCheckableState()
update();
}

// cppcheck-suppress unusedFunction
void CustomSegmentedButtonItem::setDisabledButton(bool disabled)
{
isDisabled = disabled;
updateCheckableState();
}

// cppcheck-suppress unusedFunction
void CustomSegmentedButtonItem::setActivated(bool activated)
{
isActivated = activated;
update();
}

// cppcheck-suppress unusedFunction
void CustomSegmentedButtonItem::paintEvent(QPaintEvent *)
{
QPainter painter(this);
Expand Down
1 change: 1 addition & 0 deletions common/tier4_state_rviz_plugin/src/custom_slider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ CustomSlider::CustomSlider(Qt::Orientation orientation, QWidget * parent)
setMinimumHeight(40); // Ensure there's enough space for the custom track
}

// cppcheck-suppress unusedFunction
void CustomSlider::paintEvent(QPaintEvent *)
{
QPainter painter(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ QSize CustomToggleSwitch::sizeHint() const
return QSize(50, 30); // Preferred size of the toggle switch
}

// cppcheck-suppress unusedFunction
void CustomToggleSwitch::paintEvent(QPaintEvent *)
{
QPainter p(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,10 @@ class CustomContainer : public QFrame
// Methods to set dimensions and corner radius
void setContainerHeight(int height);
void setContainerWidth(int width);
void setCornerRadius(int radius);

// Getters
int getContainerHeight() const;
int getContainerWidth() const;
int getCornerRadius() const;
QGridLayout * getLayout() const; // Add a method to access the layout

protected:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ class CustomSegmentedButtonItem : public QPushButton
public:
explicit CustomSegmentedButtonItem(const QString & text, QWidget * parent = nullptr);

void setColors(
const QColor & bg, const QColor & checkedBg, const QColor & activeText,
const QColor & inactiveText);
void setActivated(bool activated);
void setCheckableButton(bool checkable);
void setDisabledButton(bool disabled);
Expand Down

0 comments on commit bda8706

Please sign in to comment.