@Lasith Sure many ways... easiest is probably just a plain text file, but you could use JSON, xml, whatever.
Keep in mind unless you encrypt it the details would be insecure and easily viewed. If it's just for development no big deal though.
Some example code:
QFile f("myconfigfile");
if (!f.open(QIODevice::ReadOnly | QIODevice::Text))
return; // fail
QTextStream fs(&f);
// assumes 1 field per line and minimum of 4 fields
QString host = fs.readLine();
QString database = fs.readLine();
QString user = fs.readLine();
QString pass = fs.readLine();
Edit: your myconfigfile would look like this:
myhost
mydb
myuser
mypass
Ok, nice, these three answers (StackView / StackLayout / Loader + Component) were what I was looking for. I tried each one and I think I'll stick with the StackView and the replace method as it's easy to have a fading transition with it. And I've already found a use to improve my code for the Loader so I also thank you for that.
Thx for the help.
Thanks @karlheinzreichel
Originaly I have data called Sample, to save it I save it as a QVector<double> const Value.
for(int iSamples=0;iSamples<_pSampleProcessing->getRawDataVector().size();iSamples++)
{
xDataVector.append(_pSampleProcessing->getRawDataVector().at(iSamples).getX());
yDataVector.append(_pSampleProcessing->getRawDataVector().at(iSamples).getY());
}
I dont think so, because If it would be overloaded I might get an error, because I tried it to save it as a Sample before. So saving as a double seems possible.
@mrjj
i replace this line
ui->tableWidget->item(x,y)->setText(rowData[y]);
with
ui->tableWidget->setItem(x-1,y,new QTableWidgetItem(rowData[y]));
loading is working fine now thanks problem solved
If you use a QAbstractListModel the data() will be accessed on demand only (tested).
TableView will reuse delegates when scrolling up/down and not create new ones (according to description)
Hi and welcome to devnet,
What sources did you download ? You have an option in the installer to get the sources that matches your installed Qt.
If you take the time to search the forum, you'll find several threads about the MySQL plugin and OS X.
Hello @JKSH thanks for your response, I already solved the issue, the problem was in qml.qrc file, i just have to edit and update the file list with new icon images, then rebuild the project again.
No and that's the point, I want to resize my image with the optimized size to display it.
The size could be the size maximum that I can load depending on the memory available.
And so my question is precisely, how to calculate this optimized size for resizing my image depending on the memory available, to display my image even if it is too large (in a QPixmap added within a QGraphicsScene through a QGraphicsPixmapItem)?
Hi,
IMHO the problem is that QJsonValue QJsonValue::​fromVariant(const QVariant & variant) (http://doc.qt.io/qt-5/qjsonvalue.html#fromVariant) can't convert BookMark to QJsonObject. I don't think that adding a custom converter with QMetatype::registerConverter() would help. Looks like you have to do the conversion to QJsonArray yourself.
Cheers!
Wieland