mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-02-10 05:38:32 -06:00
Fix some warning and other code style changes
This commit is contained in:
@@ -17,7 +17,7 @@ private:
|
||||
bool m_isNull;
|
||||
|
||||
public:
|
||||
NullLineEdit(QWidget* parent=nullptr): QLineEdit(parent), m_isNull (true) {}
|
||||
explicit NullLineEdit(QWidget* parent=nullptr): QLineEdit(parent), m_isNull (true) {}
|
||||
|
||||
bool isNull() {return m_isNull;}
|
||||
void setNull(bool value) {
|
||||
@@ -65,7 +65,7 @@ protected:
|
||||
// Styled Item Delegate for non-editable columns (all except Value)
|
||||
class NoEditDelegate: public QStyledItemDelegate {
|
||||
public:
|
||||
NoEditDelegate(QObject* parent=nullptr): QStyledItemDelegate(parent) {}
|
||||
explicit NoEditDelegate(QObject* parent=nullptr): QStyledItemDelegate(parent) {}
|
||||
QWidget* createEditor(QWidget* /* parent */, const QStyleOptionViewItem& /* option */, const QModelIndex& /* index */) const override {
|
||||
return nullptr;
|
||||
}
|
||||
@@ -75,7 +75,7 @@ public:
|
||||
class EditDelegate: public QStyledItemDelegate {
|
||||
|
||||
public:
|
||||
EditDelegate(QObject* parent=nullptr): QStyledItemDelegate(parent) {}
|
||||
explicit EditDelegate(QObject* parent=nullptr): QStyledItemDelegate(parent) {}
|
||||
QWidget* createEditor(QWidget *parent, const QStyleOptionViewItem& /* option */, const QModelIndex& /* index */) const override {
|
||||
return new NullLineEdit(parent);
|
||||
}
|
||||
@@ -180,7 +180,7 @@ void AddRecordDialog::populateFields()
|
||||
ui->treeWidget->setItemDelegateForColumn(kValue, new EditDelegate(this));
|
||||
|
||||
sqlb::FieldVector fields;
|
||||
QVector<sqlb::ConstraintPtr> fks;
|
||||
std::vector<sqlb::ConstraintPtr> fks;
|
||||
QStringList pk;
|
||||
|
||||
// Initialize fields, fks and pk differently depending on whether it's a table or a view.
|
||||
@@ -190,12 +190,12 @@ void AddRecordDialog::populateFields()
|
||||
sqlb::TablePtr m_table = pdb.getObjectByName<sqlb::Table>(curTable);
|
||||
fields = m_table->fields;
|
||||
for(const sqlb::Field& f : fields)
|
||||
fks.append(m_table->constraint({f.name()}, sqlb::Constraint::ForeignKeyConstraintType));
|
||||
fks.push_back(m_table->constraint({f.name()}, sqlb::Constraint::ForeignKeyConstraintType));
|
||||
pk = m_table->primaryKey();
|
||||
} else {
|
||||
sqlb::ViewPtr m_view = pdb.getObjectByName<sqlb::View>(curTable);
|
||||
fields = m_view->fields;
|
||||
fks.fill(sqlb::ConstraintPtr(nullptr), fields.size());
|
||||
fks.resize(fields.size(), sqlb::ConstraintPtr(nullptr));
|
||||
for(const auto& col : pseudo_pk)
|
||||
pk << QString::fromStdString(col);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user