I answer myself:
basically I not know qml quick world ... but the solution is not abstractmodel but the right setting of context.
so my new main code (working) is these:
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QtQuickControls2>
#include <QtSql>
#include <QtGui/QGuiApplication>
#include <QtCore/QDir>
#include <QtQuick/QQuickView>
#include <QtQml/QQmlEngine>
#include <QtQml/qqml.h>
#include "shared/shared.h"
#include <QtCharts>
#include <QtDataVisualization>
#include <QAbstractTableModel>
#include <QtMessageHandler>
#include <QMessageBox>
#include <QMessageLogContext>
#include <QMessageLogger>
#include <QDebug>
#include <QQmlEngine>
#include "sqlquerymodel.h"
using namespace QtCharts;
int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication app(argc, argv);
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName("/home/pc/Qt/TestApp/DataBase/TestAnalyticsDB");
if(db.open()) {//{ QMessageBox::information(nullptr,"Ok","Connection ok");
qDebug() << "connessione ok";
}
else qDebug() << "connessione FALLITA";//QMessageBox::information(nullptr,"Error","some error.");
SqlQueryModel *UserRegistry = new SqlQueryModel(nullptr);
UserRegistry->setQuery("SELECT * FROM userData");
SqlQueryModel *AdmRegistry = new SqlQueryModel(nullptr);
AdmRegistry->setQuery("SELECT * FROM admData");
QQmlApplicationEngine engine;
engine.rootContext()->setContextProperty("userModel", UserRegistry); /* the trick */
engine.rootContext()->setContextProperty("admModel", AdmRegistry); /* second query table model */
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
if (engine.rootObjects().isEmpty())
return -1;
return app.exec();
}
after these in ui.qml part in tableView section is simple to write these :
import QtQuick 2.3
import QtQuick.Controls 2.3
import QtQuick.Controls 1.4 as C
/*some code*/
C.TableView {
id: tableViewUser
x: 8
y: 8
width: 1152
height: 244
anchors.right: parent.right
anchors.left: parent.left
anchors.top: parent.top
verticalScrollBarPolicy: 2
clip: true
model: userModel /* the trick */
C.TableViewColumn {
title: "User id"
role: "IDuser"
width: title.length * 10
visible: true
}
/* other column*/
/* second table*/
C.TableView {
id: tableViewData
x: 0
y: 250
width: 1168
height: 433
anchors.right: parent.right
anchors.left: parent.left
anchors.top: parent.bottom
verticalScrollBarPolicy: 2
clip: true
model: admModel /* second query table model */
C.TableViewColumn {
title: "Sensore 1"
role: "sens1"
width: title.length * 15
}
with SqlQueryModel class i symple to show every type of query in a table (in these case in quick 1.4 near to 2.3 control, but I think is the same with new TableView in Qt5.12).
regards