Commit 76919e1d authored by Rinigus Saar's avatar Rinigus Saar
Browse files

apply sugggested changes

parent c6f64a6c
......@@ -37,7 +37,7 @@ find_package(Qt5WebEngine REQUIRED)
################# Definitions to pass to the compiler #################
add_definitions(-DQT_NO_FOREACH)
add_definitions(-fexceptions)
kde_enable_exceptions()
################# build and install #################
add_subdirectory(src)
......
......@@ -39,8 +39,8 @@
DBManager::DBManager(QObject *parent) : QObject(parent)
{
QString dbname = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation)
+ QStringLiteral("/angelfish/angelfish.sqlite");
QString dbname = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation)
+ QStringLiteral("/angelfish.sqlite");
QSqlDatabase database = QSqlDatabase::addDatabase(QLatin1String("QSQLITE"));
database.setDatabaseName(dbname);
......
......@@ -21,24 +21,19 @@ void SqlQueryModel::setQuery(const QSqlQuery &query)
void SqlQueryModel::generateRoleNames()
{
m_roleNames.clear();
for( int i = 0; i < record().count(); i ++) {
for ( int i = 0; i < record().count(); i++ ) {
m_roleNames.insert(Qt::UserRole + i + 1, record().fieldName(i).toUtf8());
}
}
QVariant SqlQueryModel::data(const QModelIndex &index, int role) const
{
QVariant value;
if(role < Qt::UserRole) {
value = QSqlQueryModel::data(index, role);
}
else {
if (role > Qt::UserRole) {
int columnIdx = role - Qt::UserRole - 1;
QModelIndex modelIndex = this->index(index.row(), columnIdx);
value = QSqlQueryModel::data(modelIndex, Qt::DisplayRole);
return QSqlQueryModel::data(modelIndex, Qt::DisplayRole);
}
return value;
return QVariant();
}
QHash<int, QByteArray> SqlQueryModel::roleNames() const
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment