Code clean, and code style error fix.
This commit is contained in:
@@ -3,9 +3,7 @@
|
||||
//
|
||||
|
||||
#include "AccountRoleComboDelegate.h"
|
||||
#include <QComboBox>
|
||||
#include <QPainter>
|
||||
#include <QStyleOptionViewItem>
|
||||
#include "db/SQLHelper.h"
|
||||
AccountRoleComboDelegate::AccountRoleComboDelegate(QWidget *parent):QItemDelegate(parent) {
|
||||
SQLHelper::QueryMap("select RoleID,RoleName from Role",map);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <QPainter>
|
||||
#include <QMouseEvent>
|
||||
#include <QLabel>
|
||||
#include <QFont>
|
||||
|
||||
#include <qdebug.h>
|
||||
const int fontSize = 80;
|
||||
SlidePickerBox::SlidePickerBox(QWidget *parent):QWidget(parent) {
|
||||
@@ -143,7 +143,7 @@ void SlidePickerBox::paintText(QString txt, int x, int y, const QColor& color) {
|
||||
painter.drawText(x,y,txt);
|
||||
}
|
||||
|
||||
void SlidePickerBox::setItems(QStringList itemsList) {
|
||||
void SlidePickerBox::setItems(const QStringList& itemsList) {
|
||||
this->items = itemsList;
|
||||
hideLabel(selectedLbl);
|
||||
hideLabel(prevLbl);
|
||||
|
||||
@@ -12,7 +12,7 @@ class SlidePickerBox:public QWidget {
|
||||
public:
|
||||
explicit SlidePickerBox(QWidget *parent = nullptr);
|
||||
QString getSelectedValue();
|
||||
void setItems(QStringList itemsList);
|
||||
void setItems(const QStringList& itemsList);
|
||||
void addItem(QString& item) {
|
||||
this->items.append(item);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <QScrollBar>
|
||||
#include <QMouseEvent>
|
||||
#include <QApplication>
|
||||
#include <math.h>
|
||||
#include <cmath>
|
||||
|
||||
SlideableTableView::SlideableTableView(QWidget *parent) : QTableView(parent) {
|
||||
|
||||
|
||||
@@ -229,23 +229,23 @@ QColor Battery::getNormalColorEnd() const
|
||||
|
||||
QSize Battery::sizeHint() const
|
||||
{
|
||||
return QSize(90, 120);
|
||||
return {90, 120};
|
||||
}
|
||||
|
||||
QSize Battery::minimumSizeHint() const
|
||||
{
|
||||
return QSize(10, 30);
|
||||
return {10, 30};
|
||||
}
|
||||
|
||||
void Battery::setRange(double minValue, double maxValue)
|
||||
void Battery::setRange(double minVal, double maxVal)
|
||||
{
|
||||
//如果最小值大于或者等于最大值则不设置
|
||||
if (minValue >= maxValue) {
|
||||
if (minVal >= maxVal) {
|
||||
return;
|
||||
}
|
||||
|
||||
this->minValue = minValue;
|
||||
this->maxValue = maxValue;
|
||||
this->minValue = minVal;
|
||||
this->maxValue = maxVal;
|
||||
|
||||
//如果目标值不在范围值内,则重新设置目标值
|
||||
//值小于最小值则取最小值,大于最大值则取最大值
|
||||
@@ -259,19 +259,19 @@ void Battery::setRange(double minValue, double maxValue)
|
||||
this->update();
|
||||
}
|
||||
|
||||
void Battery::setRange(int minValue, int maxValue)
|
||||
void Battery::setRange(int minVal, int maxVal)
|
||||
{
|
||||
setRange((double)minValue, (double)maxValue);
|
||||
setRange((double)minVal, (double)maxVal);
|
||||
}
|
||||
|
||||
void Battery::setMinValue(double minValue)
|
||||
void Battery::setMinValue(double minVal)
|
||||
{
|
||||
setRange(minValue, maxValue);
|
||||
setRange(minVal, maxValue);
|
||||
}
|
||||
|
||||
void Battery::setMaxValue(double maxValue)
|
||||
void Battery::setMaxValue(double maxVal)
|
||||
{
|
||||
setRange(minValue, maxValue);
|
||||
setRange(minValue, maxVal);
|
||||
}
|
||||
|
||||
void Battery::setValue(double value)
|
||||
|
||||
@@ -45,7 +45,7 @@ ImageSwitch::ButtonStyle ImageSwitch::getButtonStyle() const
|
||||
|
||||
QSize ImageSwitch::sizeHint() const
|
||||
{
|
||||
return QSize(100, 50);
|
||||
return {100, 50};
|
||||
}
|
||||
|
||||
QSize ImageSwitch::minimumSizeHint() const
|
||||
@@ -53,19 +53,19 @@ QSize ImageSwitch::minimumSizeHint() const
|
||||
return sizeHint();
|
||||
}
|
||||
|
||||
void ImageSwitch::setChecked(bool isChecked)
|
||||
void ImageSwitch::setChecked(bool value)
|
||||
{
|
||||
if (this->isChecked != isChecked) {
|
||||
this->isChecked = isChecked;
|
||||
if (this->isChecked != value) {
|
||||
this->isChecked = value;
|
||||
imgFile = isChecked ? imgOnFile : imgOffFile;
|
||||
this->update();
|
||||
}
|
||||
}
|
||||
|
||||
void ImageSwitch::setButtonStyle(const ImageSwitch::ButtonStyle& buttonStyle)
|
||||
void ImageSwitch::setButtonStyle(const ImageSwitch::ButtonStyle& style)
|
||||
{
|
||||
if (this->buttonStyle != buttonStyle) {
|
||||
this->buttonStyle = buttonStyle;
|
||||
if (this->buttonStyle != style) {
|
||||
this->buttonStyle = style;
|
||||
|
||||
if (buttonStyle == ButtonStyle_1) {
|
||||
imgOffFile = ":/icons/imageswitch/btncheckoff1.png";
|
||||
|
||||
Reference in New Issue
Block a user