mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 11:00:44 -06:00
Use emplace_back some more
This commit is contained in:
@@ -103,10 +103,9 @@ std::vector<CondFormat> CondFormatManager::getCondFormats()
|
||||
for (int i = 0; i < ui->tableCondFormats->topLevelItemCount(); ++i)
|
||||
{
|
||||
QTreeWidgetItem* item = ui->tableCondFormats->topLevelItem(i);
|
||||
CondFormat aCondFormat(item->text(ColumnFilter),
|
||||
item->background(ColumnForeground).color(),
|
||||
item->background(ColumnBackground).color(), m_encoding);
|
||||
result.push_back(aCondFormat);
|
||||
result.emplace_back(item->text(ColumnFilter),
|
||||
item->background(ColumnForeground).color(),
|
||||
item->background(ColumnBackground).color(), m_encoding);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -2694,11 +2694,10 @@ static void loadBrowseDataTableSettings(BrowseDataTableSettings& settings, QXmlS
|
||||
int index = xml.attributes().value("index").toInt();
|
||||
while(xml.readNext() != QXmlStreamReader::EndElement && xml.name() != "column") {
|
||||
if(xml.name() == "format") {
|
||||
CondFormat newCondFormat(xml.attributes().value("condition").toString(),
|
||||
QColor(xml.attributes().value("foreground").toString()),
|
||||
QColor(xml.attributes().value("background").toString()),
|
||||
settings.encoding);
|
||||
settings.condFormats[index].push_back(newCondFormat);
|
||||
settings.condFormats[index].emplace_back(xml.attributes().value("condition").toString(),
|
||||
QColor(xml.attributes().value("foreground").toString()),
|
||||
QColor(xml.attributes().value("background").toString()),
|
||||
settings.encoding);
|
||||
xml.skipCurrentElement();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -239,13 +239,13 @@ void RowLoader::process (Task & t)
|
||||
{
|
||||
if(sqlite3_column_type(stmt, i) == SQLITE_NULL)
|
||||
{
|
||||
rowdata.push_back(QByteArray());
|
||||
rowdata.emplace_back();
|
||||
} else {
|
||||
int bytes = sqlite3_column_bytes(stmt, i);
|
||||
if(bytes)
|
||||
rowdata.push_back(QByteArray(static_cast<const char*>(sqlite3_column_blob(stmt, i)), bytes));
|
||||
rowdata.emplace_back(static_cast<const char*>(sqlite3_column_blob(stmt, i)), bytes);
|
||||
else
|
||||
rowdata.push_back(QByteArray(""));
|
||||
rowdata.emplace_back("");
|
||||
}
|
||||
}
|
||||
QMutexLocker lk(&cache_mutex);
|
||||
|
||||
@@ -1213,13 +1213,13 @@ bool DBBrowserDB::getRow(const sqlb::ObjectIdentifier& table, const QString& row
|
||||
{
|
||||
if(sqlite3_column_type(stmt, i) == SQLITE_NULL)
|
||||
{
|
||||
rowdata.push_back(QByteArray());
|
||||
rowdata.emplace_back();
|
||||
} else {
|
||||
int bytes = sqlite3_column_bytes(stmt, i);
|
||||
if(bytes)
|
||||
rowdata.push_back(QByteArray(static_cast<const char*>(sqlite3_column_blob(stmt, i)), bytes));
|
||||
rowdata.emplace_back(static_cast<const char*>(sqlite3_column_blob(stmt, i)), bytes);
|
||||
else
|
||||
rowdata.push_back(QByteArray(""));
|
||||
rowdata.emplace_back("");
|
||||
}
|
||||
}
|
||||
ret = true;
|
||||
|
||||
@@ -124,7 +124,7 @@ void SqliteTableModel::setQuery(const sqlb::Query& query)
|
||||
m_query = query;
|
||||
|
||||
// The first column is the rowid column and therefore is always of type integer
|
||||
m_vDataTypes.push_back(SQLITE_INTEGER);
|
||||
m_vDataTypes.emplace_back(SQLITE_INTEGER);
|
||||
|
||||
// Get the data types of all other columns as well as the column names
|
||||
bool allOk = false;
|
||||
@@ -164,7 +164,7 @@ void SqliteTableModel::setQuery(const sqlb::Query& query)
|
||||
QString sColumnQuery = QString::fromUtf8("SELECT * FROM %1;").arg(QString::fromStdString(query.table().toString()));
|
||||
if(m_query.rowIdColumns().empty())
|
||||
m_query.setRowIdColumn("_rowid_");
|
||||
m_headers.push_back("_rowid_");
|
||||
m_headers.emplace_back("_rowid_");
|
||||
auto columns = getColumns(nullptr, sColumnQuery, m_vDataTypes);
|
||||
m_headers.insert(m_headers.end(), columns.begin(), columns.end());
|
||||
}
|
||||
@@ -533,7 +533,7 @@ SqliteTableModel::Row SqliteTableModel::makeDefaultCacheEntry () const
|
||||
Row blank_data;
|
||||
|
||||
for(size_t i=0; i < m_headers.size(); ++i)
|
||||
blank_data.push_back("");
|
||||
blank_data.emplace_back("");
|
||||
|
||||
return blank_data;
|
||||
}
|
||||
@@ -563,7 +563,7 @@ bool SqliteTableModel::insertRows(int row, int count, const QModelIndex& parent)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
tempList.push_back(blank_data);
|
||||
tempList.emplace_back(blank_data);
|
||||
tempList.back()[0] = rowid.toUtf8();
|
||||
|
||||
// update column with default values
|
||||
|
||||
Reference in New Issue
Block a user