Improve const correctness
This commit is contained in:
@@ -28,7 +28,7 @@ namespace {
|
||||
const int BUTTON_SIZE = 30;
|
||||
}
|
||||
|
||||
Button::Button(Type t, QWidget *parent) : QPushButton(parent),
|
||||
Button::Button(const Type t, QWidget *parent) : QPushButton(parent),
|
||||
m_buttonType(t) {
|
||||
initButton();
|
||||
|
||||
@@ -40,8 +40,8 @@ Button::Button(Type t, QWidget *parent) : QPushButton(parent),
|
||||
}
|
||||
}
|
||||
|
||||
Button::Button(Button::Type t, bool isWhite, QWidget *parent) : QPushButton(parent),
|
||||
m_buttonType(t) {
|
||||
Button::Button(const Button::Type t, const bool isWhite, QWidget *parent)
|
||||
: QPushButton(parent), m_buttonType(t) {
|
||||
initButton();
|
||||
|
||||
if (t == Button::Type::selectionIndicator) {
|
||||
@@ -142,7 +142,7 @@ QString Button::getStyle() {
|
||||
return getStyle(mainColor);
|
||||
}
|
||||
|
||||
QString Button::getStyle(QColor mainColor) {
|
||||
QString Button::getStyle(const QColor &mainColor) {
|
||||
QString baseSheet = "Button { border-radius: 15px;"
|
||||
"background-color: %1; color: white }"
|
||||
"Button:hover { background-color: %2; }"
|
||||
@@ -199,7 +199,7 @@ size_t Button::getButtonBaseSize() {
|
||||
}
|
||||
// getTypeByName receives a name and return the corresponding button type.
|
||||
// returns Button::Type::last when the corresponding button is not found.
|
||||
Button::Type Button::getTypeByName(QString s) {
|
||||
Button::Type Button::getTypeByName(const QString s) {
|
||||
Button::Type res = Type::last;
|
||||
for (auto it = typeName.begin(); it != typeName.end(); ++it )
|
||||
if (it->second == s)
|
||||
@@ -207,11 +207,11 @@ Button::Type Button::getTypeByName(QString s) {
|
||||
return res;
|
||||
}
|
||||
|
||||
QString Button::getTypeName(Button::Type t) {
|
||||
QString Button::getTypeName(const Button::Type t) {
|
||||
return typeName[t];
|
||||
}
|
||||
|
||||
QString Button::getTypeTooltip(Button::Type t) {
|
||||
QString Button::getTypeTooltip(const Button::Type t) {
|
||||
return typeTooltip[t];
|
||||
}
|
||||
|
||||
|
||||
@@ -49,17 +49,17 @@ public:
|
||||
colorPicker
|
||||
};
|
||||
|
||||
explicit Button(Type, QWidget *parent = 0);
|
||||
explicit Button(Type, bool isWhite, QWidget *parent = 0);
|
||||
explicit Button(const Type, QWidget *parent = 0);
|
||||
explicit Button(const Type, const bool isWhite, QWidget *parent = 0);
|
||||
|
||||
static QIcon getIcon(const Type);
|
||||
static QIcon getIcon(const Type, bool isWhite);
|
||||
static QString getStyle();
|
||||
static QString getStyle(QColor);
|
||||
static QString getStyle(const QColor &);
|
||||
static size_t getButtonBaseSize();
|
||||
static Button::Type getTypeByName(QString);
|
||||
static QString getTypeName(Button::Type);
|
||||
static QString getTypeTooltip(Button::Type);
|
||||
static Button::Type getTypeByName(const QString);
|
||||
static QString getTypeName(const Button::Type);
|
||||
static QString getTypeTooltip(const Button::Type);
|
||||
|
||||
Type getButtonType() const;
|
||||
|
||||
|
||||
@@ -296,7 +296,7 @@ QVector<QPoint> ButtonHandler::getVPoints(
|
||||
return res;
|
||||
}
|
||||
// setButtons redefines the buttons of the button handler
|
||||
void ButtonHandler::setButtons(QVector<Button *> v) {
|
||||
void ButtonHandler::setButtons(const QVector<Button *> v) {
|
||||
for (Button *b: m_vectorButtons) delete(b);
|
||||
m_vectorButtons = v;
|
||||
if (!v.isEmpty()) {
|
||||
|
||||
@@ -37,7 +37,7 @@ public:
|
||||
size_t size() const;
|
||||
|
||||
void updatePosition(const QRect &selection, const QRect &limits);
|
||||
void setButtons(QVector<Button*>);
|
||||
void setButtons(const QVector<Button*>);
|
||||
|
||||
private:
|
||||
QVector<QPoint> getHPoints(const QPoint ¢er, const int elements) const;
|
||||
|
||||
@@ -39,7 +39,6 @@ Screenshot::Screenshot(const QPixmap &p) : m_baseScreenshot(p),
|
||||
m_modifiedScreenshot(p) {}
|
||||
|
||||
Screenshot::~Screenshot() {
|
||||
if (m_accessManager) delete(m_accessManager);
|
||||
}
|
||||
|
||||
void Screenshot::setScreenshot(const QPixmap &p) {
|
||||
|
||||
@@ -24,7 +24,7 @@ void UIcolorEditor::updateUIcolor() {
|
||||
settings.setValue("uiColor", m_uiColor);
|
||||
}
|
||||
|
||||
void UIcolorEditor::updateLocalColor(QColor c) {
|
||||
void UIcolorEditor::updateLocalColor(const QColor c) {
|
||||
m_uiColor = c;
|
||||
QString style = Button::getStyle(c);
|
||||
m_button->setStyleSheet(style);
|
||||
|
||||
@@ -14,7 +14,7 @@ public:
|
||||
|
||||
private slots:
|
||||
void updateUIcolor();
|
||||
void updateLocalColor(QColor);
|
||||
void updateLocalColor(const QColor);
|
||||
|
||||
private:
|
||||
QColor m_uiColor;
|
||||
|
||||
Reference in New Issue
Block a user