Commit 302178f4 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧
Browse files

Port away from deprecated API

Makes sure it works properly with Qt 5.15
parent 054e61b4
......@@ -19,6 +19,7 @@
#ifndef VARIABLES_H
#define VARIABLES_H
#include <qobjectdefs.h>
#include <QHash>
#include "analitzaexport.h"
......@@ -41,6 +42,7 @@ class Object;
class ANALITZA_EXPORT Variables : public QHash<QString, Object*>
{
Q_GADGET
public:
/**
* Creates an empty variable hash table with the usual constants
......
......@@ -30,10 +30,12 @@ OperatorsModel::OperatorsModel(QObject *parent) : QAbstractTableModel(parent), m
QHash<int, QByteArray> OperatorsModel::roleNames() const
{
return QAbstractTableModel::roleNames().unite( {
{IsVariableRole, "isVariable"},
{DescriptionRole, "description"}
auto ret = QAbstractTableModel::roleNames();
ret.insert({
{IsVariableRole, "isVariable"},
{DescriptionRole, "description"}
});
return ret;
}
QVariant OperatorsModel::data(const QModelIndex & index, int role) const
......
......@@ -47,7 +47,11 @@ PlotsModel::~PlotsModel()
QHash<int, QByteArray> PlotsModel::roleNames() const
{
return QAbstractListModel::roleNames().unite({{ DescriptionRole, "description" }});
auto ret = QAbstractListModel::roleNames();
ret.insert({
{ DescriptionRole, "description" }
});
return ret;
}
void PlotsModel::clear()
......
......@@ -35,5 +35,5 @@ void AnalitzaDeclarativePlugin::registerTypes(const char* uri)
qmlRegisterType<Analitza::PlotsModel>(uri, 1, 0, "PlotsModel");
qmlRegisterType<Analitza::VariablesModel>(uri, 1, 0, "VariablesModel");
qmlRegisterType<OperatorsModel>(uri, 1, 0, "OperatorsModel");
qmlRegisterInterface<Analitza::Variables*>("Analitza::Variables");
qmlRegisterInterface<Analitza::Variables>(uri, 1);
}
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