Fix alignment bug and applied many clang format warnings (#2448)
* Fix alignment bug and applied many clang format warnings * removed nodiscard from slot
This commit is contained in:
@@ -8,8 +8,6 @@
|
||||
#include "src/utils/pathinfo.h"
|
||||
#include "utilitypanel.h"
|
||||
#include <QApplication>
|
||||
#include <QDebug> // TODO remove
|
||||
#include <QFormLayout>
|
||||
#include <QKeyEvent>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
@@ -23,9 +21,10 @@
|
||||
|
||||
SidePanelWidget::SidePanelWidget(QPixmap* p, QWidget* parent)
|
||||
: QWidget(parent)
|
||||
, m_layout(new QVBoxLayout(this))
|
||||
, m_pixmap(p)
|
||||
{
|
||||
m_layout = new QVBoxLayout(this);
|
||||
|
||||
if (parent) {
|
||||
parent->installEventFilter(this);
|
||||
}
|
||||
@@ -109,7 +108,7 @@ void SidePanelWidget::onColorChanged(const QColor& c)
|
||||
m_colorWheel->setColor(c);
|
||||
}
|
||||
|
||||
void SidePanelWidget::onToolSizeChanged(const int& t)
|
||||
void SidePanelWidget::onToolSizeChanged(int t)
|
||||
{
|
||||
m_toolSize = qBound(0, t, maxToolSize);
|
||||
m_toolSizeSlider->setValue(m_toolSize);
|
||||
|
||||
@@ -27,13 +27,13 @@ public:
|
||||
explicit SidePanelWidget(QPixmap* p, QWidget* parent = nullptr);
|
||||
|
||||
signals:
|
||||
void colorChanged(const QColor& c);
|
||||
void toolSizeChanged(int t);
|
||||
void colorChanged(const QColor& color);
|
||||
void toolSizeChanged(int tootl);
|
||||
void togglePanel();
|
||||
|
||||
public slots:
|
||||
void onToolSizeChanged(const int& t);
|
||||
void onColorChanged(const QColor& c);
|
||||
void onToolSizeChanged(int tool);
|
||||
void onColorChanged(const QColor& color);
|
||||
|
||||
private slots:
|
||||
void startColorGrab();
|
||||
@@ -43,14 +43,14 @@ private slots:
|
||||
|
||||
private:
|
||||
void finalizeGrab();
|
||||
void updateColorNoWheel(const QColor& c);
|
||||
void updateColorNoWheel(const QColor& color);
|
||||
|
||||
bool eventFilter(QObject* obj, QEvent* event) override;
|
||||
void hideEvent(QHideEvent* event) override;
|
||||
|
||||
QVBoxLayout* m_layout;
|
||||
QPushButton* m_colorGrabButton;
|
||||
ColorGrabWidget* m_colorGrabber;
|
||||
ColorGrabWidget* m_colorGrabber{};
|
||||
color_widgets::ColorWheel* m_colorWheel;
|
||||
QLabel* m_colorLabel;
|
||||
QLineEdit* m_colorHex;
|
||||
@@ -58,5 +58,5 @@ private:
|
||||
QColor m_color;
|
||||
QColor m_revertColor;
|
||||
QSlider* m_toolSizeSlider;
|
||||
int m_toolSize;
|
||||
int m_toolSize{};
|
||||
};
|
||||
|
||||
@@ -53,31 +53,31 @@ QWidget* UtilityPanel::toolWidget() const
|
||||
return m_toolWidget;
|
||||
}
|
||||
|
||||
void UtilityPanel::setToolWidget(QWidget* w)
|
||||
void UtilityPanel::setToolWidget(QWidget* widget)
|
||||
{
|
||||
if (m_toolWidget) {
|
||||
if (m_toolWidget != nullptr) {
|
||||
m_toolWidget->hide();
|
||||
m_toolWidget->setParent(this);
|
||||
m_toolWidget->deleteLater();
|
||||
}
|
||||
if (w) {
|
||||
m_toolWidget = w;
|
||||
if (widget != nullptr) {
|
||||
m_toolWidget = widget;
|
||||
m_toolWidget->setSizePolicy(QSizePolicy::Ignored,
|
||||
QSizePolicy::Preferred);
|
||||
m_upLayout->addWidget(w);
|
||||
m_upLayout->addWidget(widget);
|
||||
}
|
||||
}
|
||||
|
||||
void UtilityPanel::clearToolWidget()
|
||||
{
|
||||
if (m_toolWidget) {
|
||||
if (m_toolWidget != nullptr) {
|
||||
m_toolWidget->deleteLater();
|
||||
}
|
||||
}
|
||||
|
||||
void UtilityPanel::pushWidget(QWidget* w)
|
||||
void UtilityPanel::pushWidget(QWidget* widget)
|
||||
{
|
||||
m_layout->insertWidget(m_layout->count() - 1, w);
|
||||
m_layout->insertWidget(m_layout->count() - 1, widget);
|
||||
}
|
||||
|
||||
void UtilityPanel::show()
|
||||
@@ -193,7 +193,7 @@ void UtilityPanel::initInternalPanel()
|
||||
}
|
||||
|
||||
void UtilityPanel::fillCaptureTools(
|
||||
QList<QPointer<CaptureTool>> captureToolObjects)
|
||||
const QList<QPointer<CaptureTool>>& captureToolObjects)
|
||||
{
|
||||
int currentSelection = m_captureTools->currentRow();
|
||||
m_captureTools->clear();
|
||||
|
||||
@@ -12,7 +12,6 @@ class QPropertyAnimation;
|
||||
class QScrollArea;
|
||||
class QPushButton;
|
||||
class QListWidget;
|
||||
class CaptureTool;
|
||||
class QPushButton;
|
||||
class CaptureWidget;
|
||||
|
||||
@@ -22,14 +21,14 @@ class UtilityPanel : public QWidget
|
||||
public:
|
||||
explicit UtilityPanel(CaptureWidget* captureWidget);
|
||||
|
||||
QWidget* toolWidget() const;
|
||||
void setToolWidget(QWidget* w);
|
||||
[[nodiscard]] QWidget* toolWidget() const;
|
||||
void setToolWidget(QWidget* weight);
|
||||
void clearToolWidget();
|
||||
void pushWidget(QWidget* w);
|
||||
void pushWidget(QWidget* widget);
|
||||
void hide();
|
||||
void show();
|
||||
void fillCaptureTools(
|
||||
QList<QPointer<CaptureTool>> captureToolObjectsHistory);
|
||||
const QList<QPointer<CaptureTool>>& captureToolObjectsHistory);
|
||||
void setActiveLayer(int index);
|
||||
int activeLayerIndex();
|
||||
bool isVisible() const;
|
||||
|
||||
Reference in New Issue
Block a user