Hi again !
It seems that by looking still a bit more I found a suitable answer.
The key was to set the QSqlRelationalDelegate for the mapper and not the QComboBox but still setting the model of the QComboBox to the table containing all the functions.
Here is my final code:
//Init all private members
//Init all private members
price1 = new QDoubleSpinBox(this);
price2 = new QDoubleSpinBox(this);
price3 = new QDoubleSpinBox(this);
price4 = new QDoubleSpinBox(this);
function = new QComboBox(this);
mapper = new QDataWidgetMapper(this);
sqlModel = new QSqlRelationalTableModel(this);
QSqlTableModel *fctModel = new QSqlTableModel(this);
QListView *articlesView = new QListView(this);
//Imediately links the views and the models
//A few indexes
int nameIndex = sqlModel->record().indexOf("Name");
int priceIndex = sqlModel->record().indexOf("sellPrice");
int jobShareIndex = sqlModel->record().indexOf("jShare");
int bPriceIndex = sqlModel->record().indexOf("bPrice");
int redPriceIndex = sqlModel->record().indexOf("reducedPrice");
int functionIndex = sqlModel->record().indexOf("function");
auto tmp = new QSqlTableModel();
functionNameIndex = tmp->record().indexOf("name");
//Configures the sql model
sqlModel->setRelation(functionIndex, QSqlRelation("Functions", "Id", "name"));
articlesView->setModelColumn(nameIndex); //Sets the column to the name
I hope that it will be able to help anybody who might encounter that same problem !
Happy new year everybody, take care ! :)
Ah. I believe the user described the interface he gets currently (with his QTableView). Whether he likes it or not is a different matter.
Then his question was: how does he get a notification when, having created a new row, it is actually sent to the database for INSERT, given that there is no signal for this in his case ("editStrategy is OnFieldChange").
My overriding QSqlTableModel::insertRowIntoTable() is how to achieve that. So yours is to do with the interface for adding a new row, right? Whether he would benefit/prefer to change over to that to I cannot say :)
hey , sorry for not being clear but what i meant by hosted was like node app is not hosted anywhere . So i added node code to my qt project and in main.cpp i create a Qprocess of node and then just provide localhost url to webengineview.
this solves my purpose.
So in short what i did was :
copied node app code to my qt project.
created a process of node running the node app via Qprocess.
provided localhost url:port to webengineview and it shows the app.
look for the error but I found nothing that serves me. I do not know if it has to do with the fact that I'm not using a qrc file.
in the ".pro" file, add a line to copy and paste the "qml" folder into the compiled directory. that's because I want the code jv and qml can be edited with any editor in the final version
#Copia la carpeta "qml" dentro de la carpeta build
copydata.commands = $(COPY_DIR) $$PWD/qml $$OUT_PWD
first.depends = $(first) copydata
QMAKE_EXTRA_TARGETS += first copydata
Platform - Linux x86_64
Qt Version - 5.9.3
fontHeight produced a integer value +/- 56
iconHeight produced an integer value ( < fontHeight)
The Role's where not the problem. Please see my updated delegate below (kudos for calling it, the delegate being the problem)
Well this is embarrasing. I did not fully realize what I was coding until I had battled with the delegate all night.
I understood that I was coding a template, and assumed that on each item which was added, the origin remained at [0,0]. This was not the case as there was an offset added of value specified in the sizeHint (in my case, 56). Thus all my QListView's QStandardItem's were in fact there, but drawn over each other.
After changing values and experimenting over a long period (a number of hours), I finally came to the desired result, shown below.
Also, I need to thank scopchanov for his hint into this offset problem
@RyuShai As I said on in your sysroot which you use to build for your target device. It doesn't help to install it on your host machine as you're building for another machine with different architecture (ARM). Your host machine is x86_64, right? If you install libs there they are for x86_64 as well - you cannot use them on ARM. Usually if you cross compile for other architectures you have a sysroot which contains all needed header files and libraries.
As @jsulm already noted, it's usually a bad idea to design an application which access a database directly through an open network so take care to secure the connections appropriately using encryption.
I know that they seem to behave in the same way.
But creating an timer object, running & processing the timer/timeout and deleteing the object afterwards, feels like it should be more work than queing a function call via Q_Object-Macro-Magic. However the compiler may break it down to the same thing, after all.
Generally speaking what visual performance improves might be gained by moving to Qt5.0+? I understand this is quite the loaded question on several fronts.
I assume that you have widgets-based kiosk application where almost everything is done by Q(Graphics)WebView. In this case, moving to Qt 5.x may be very important for you because it allows you to use newer WebKit.
If your application allows browsing untrusted content, e.g. arbitrary web sites, using older WebKit may be dangerous because of unfixed security vulnerabilities
In addition to security matters, QtWebKit 5.212 is much more compatible with moder Web content than older versions
Even if you have control over the content that you disaply in your "browser", using newer WebKit allows you to use modern Web technologies like ES6, new HTML and CSS features etc.
Now about "hardware graphics acceleration". It's possible with both Qt 4 and Qt 5. In Qt 4, hardware accelerated graphics is possible with DirectFB or platform-specific QWS plugins. You also can use OpenGL, in this case you need to use QGraphicsWebView with QGLWidget viewport (in Qt 5 there is newer QOpenGLWidget).