Some clazy refactorings.

This commit is contained in:
Martin Rotter 2020-05-04 14:20:56 +02:00
parent 507d776682
commit 0fc62ef28a
10 changed files with 15 additions and 19 deletions

View File

@ -545,7 +545,9 @@ void FeedsModel::loadActivatedServiceAccounts() {
}
if (serviceRoots().isEmpty()) {
QTimer::singleShot(3000, []() {
QTimer::singleShot(3000,
qApp->mainForm(),
[]() {
qApp->mainForm()->showAddAccountDialog();
});
}

View File

@ -120,11 +120,11 @@ QDataStream& operator>>(QDataStream& in, Message& myObj) {
return in;
}
uint qHash(Message key, uint seed) {
uint qHash(const Message& key, uint seed) {
Q_UNUSED(seed)
return (key.m_accountId * 10000) + key.m_id;
return (uint(key.m_accountId) * 10000) + uint(key.m_id);
}
uint qHash(const Message& key) {
return (key.m_accountId * 10000) + key.m_id;
return (uint(key.m_accountId) * 10000) + uint(key.m_id);
}

View File

@ -68,7 +68,7 @@ class Message {
QDataStream& operator<<(QDataStream& out, const Message& myObj);
QDataStream& operator>>(QDataStream& in, Message& myObj);
uint qHash(Message key, uint seed);
uint qHash(const Message& key, uint seed);
uint qHash(const Message& key);
#endif // MESSAGE_H

View File

@ -38,7 +38,7 @@ class MessagesModel : public QSqlQueryModel, public MessagesModelSqlLayer {
// Model implementation.
bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole);
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
QVariant data(const QModelIndex& idx, int role = Qt::DisplayRole) const;
QVariant data(int row, int column, int role = Qt::DisplayRole) const;
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
Qt::ItemFlags flags(const QModelIndex& index) const;

View File

@ -6,8 +6,6 @@
BaseLineEdit::BaseLineEdit(QWidget* parent) : QLineEdit(parent) {}
BaseLineEdit::~BaseLineEdit() {}
void BaseLineEdit::submit(const QString& text) {
setText(text);
emit submitted(text);

View File

@ -11,8 +11,8 @@ class BaseLineEdit : public QLineEdit {
public:
// Constructors and destructors.
explicit BaseLineEdit(QWidget* parent = 0);
virtual ~BaseLineEdit();
explicit BaseLineEdit(QWidget* parent = nullptr);
virtual ~BaseLineEdit() = default;
public slots:
void submit(const QString& text);

View File

@ -5,12 +5,10 @@
#include <QPainter>
#include <QPaintEvent>
ColorLabel::ColorLabel(QWidget* parent) : QLabel(parent), m_color(QColor()) {
ColorLabel::ColorLabel(QWidget* parent) : QLabel(parent) {
setFixedWidth(20);
}
ColorLabel::~ColorLabel() {}
QColor ColorLabel::color() const {
return m_color;
}

View File

@ -9,8 +9,8 @@ class ColorLabel : public QLabel {
Q_OBJECT
public:
explicit ColorLabel(QWidget* parent = 0);
virtual ~ColorLabel();
explicit ColorLabel(QWidget* parent = nullptr);
virtual ~ColorLabel() = default;
QColor color() const;
void setColor(const QColor& color);

View File

@ -19,5 +19,3 @@ ComboBoxWithStatus::ComboBoxWithStatus(QWidget* parent)
m_layout->addWidget(m_wdgInput);
m_layout->addWidget(m_btnStatus);
}
ComboBoxWithStatus::~ComboBoxWithStatus() {}

View File

@ -13,8 +13,8 @@ class ComboBoxWithStatus : public WidgetWithStatus {
public:
// Constructors and destructors.
explicit ComboBoxWithStatus(QWidget* parent = 0);
virtual ~ComboBoxWithStatus();
explicit ComboBoxWithStatus(QWidget* parent = nullptr);
virtual ~ComboBoxWithStatus() = default;
inline QComboBox* comboBox() const {
return static_cast<QComboBox*>(m_wdgInput);