QmlDesigner: Improve imagecache

Instead of coding some arguments to extraId(state) we provide now a
std::variant there extra arguments can be saved. Because it's a
std::variant it can be easlily extended by new structs. There is a new
synchronous interface too. It has an extra method for QIcon which saves
icons in an extra table. It would be even nicer if we would have a
mipmap image too. So we could do it asynchonously too but so far it works
only in the main thread.

Task-number: QDS-3579
Fixes: QDS-3584
Change-Id: If368d84d82308a91a5f4f037021e749c9ef868ed
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Marco Bubke
2021-01-13 13:23:46 +01:00
parent 3ffc7271e5
commit 7dc72c533e
55 changed files with 2063 additions and 904 deletions

View File

@@ -249,11 +249,18 @@ void BaseStatement::bind(int index, Utils::SmallStringView text)
void BaseStatement::bind(int index, BlobView blobView)
{
int resultCode = sqlite3_bind_blob64(m_compiledStatement.get(),
int resultCode = SQLITE_OK;
if (blobView.empty()) {
sqlite3_bind_null(m_compiledStatement.get(), index);
} else {
resultCode = sqlite3_bind_blob64(m_compiledStatement.get(),
index,
blobView.data(),
blobView.size(),
SQLITE_STATIC);
}
if (resultCode != SQLITE_OK)
checkForBindingError(resultCode);
}
@@ -713,6 +720,26 @@ StringType convertToTextForColumn(sqlite3_stmt *sqlStatment, int column)
}
} // namespace
Type BaseStatement::fetchType(int column) const
{
auto dataType = sqlite3_column_type(m_compiledStatement.get(), column);
switch (dataType) {
case SQLITE_INTEGER:
return Type::Integer;
case SQLITE_FLOAT:
return Type::Float;
case SQLITE3_TEXT:
return Type::Text;
case SQLITE_BLOB:
return Type::Blob;
case SQLITE_NULL:
return Type::Null;
}
return Type::Invalid;
}
int BaseStatement::fetchIntValue(int column) const
{
return sqlite3_column_int(m_compiledStatement.get(), column);