Skip to content
  • 0 Votes
    7 Posts
    927 Views
    JonBJ

    @suslucoder said in Double Spin Box Save to the file:

    Is it possible to do it?

    Is it possible to do what?

    The fact that you divide your UI so that the data is presented on separate tabs/pages (which is fine) has nothing to do with whether it is possible to save data, nor whether you might adopt a QDataWidgetMapper approach.

  • 0 Votes
    2 Posts
    751 Views
    SGaistS

    Hi,

    QDomDocument comes to mind for that kind of thing. There's no easy way to modify a file "in-place".

  • 0 Votes
    10 Posts
    2k Views
    SGaistS

    If you put your buttons in a QButtonGroup you could simply store the button id so you can programmatically check it when loading your document.

  • 0 Votes
    5 Posts
    3k Views
    srikanthS

    @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

  • 0 Votes
    12 Posts
    4k Views
    M4RZB4NiM

    @mrjj
    Thanks a lot Brother :)
    My Problem Solved!

  • 0 Votes
    7 Posts
    3k Views
    VRoninV
    saveToCsv(m_tableWidget->model(), QFileDialog::getSaveFileName(this,tr("Save to csv"),QString(),tr("Comma separated values (*.csv)")) ); loadFromCsv(m_tableWidget->model(), QFileDialog::getOpenFileName(this, tr("Open csv"),QString(),tr("Comma separated values (*.csv)")) );
  • Save very important data to a file

    Unsolved Brainstorm
    8
    0 Votes
    8 Posts
    3k Views
    mrjjM

    @AliReza-Beytari
    well for the file, the qt5-sqlcipher should do.

    For being hacker proof, its very important you dont store anything
    clearly in the exe file.

    That goes for the variables too.

    When u read into memory, make sure its not easy to locate
    and read. ( in mem)
    so do not store passwords or user names as clean text inside program.
    all must be encrypted.
    That will only keep noob hackers out.
    Anyone pro, will most likely be able to get access if
    unlimited access to app and data.

  • 0 Votes
    38 Posts
    32k Views
    JonBJ

    @MarieBurgan
    Thanks for the plug. I'm sure @geor will thank you for this tip, if he visits here now two years after he last posted... ;-)

  • 0 Votes
    24 Posts
    13k Views
    M

    @Qojote Thank you and congratulations for giving all the details for solving this old and apparently common problem! Without the smallest details, this kind of things are never solved.

  • QImage size after save

    Unsolved General and Desktop
    2
    0 Votes
    2 Posts
    1k Views
    raven-worxR

    @sabativi
    unless it's not a bug in the image writer plugin on OS X i would suspect that your QImage/QPixmap is already invalid.

    Please show the code where you create and paint into the image.

  • 0 Votes
    4 Posts
    2k Views
    sabativiS

    Hello @raven-worx,

    Yes you are damn right. Saving is synchronous.
    The problem i was facing is that i checked just after save if the image was written.
    Apparently it takes some times for the image to be written on disk.

    I use QTRY_VERIFY_WITH_TIMEOUTand it solved my problem.

    Thanks again

  • 0 Votes
    25 Posts
    8k Views
    jsulmJ

    The cause for that crash can be everything!
    How should anybody know what it is without your code?
    Did you try to debug your program to see where it crashes?

  • 0 Votes
    8 Posts
    5k Views
    K

    @HenrikSt.

    You got a number of different possibilities suggested. Possibly you are overwhelmed by the different things. Sometimes it is hard for the people answering to know where the real problem was/is.

    I am not sure now if this might be too detailed for you. Anyway I move forward.

    I would suggest, if you have not done yet, The example from QFile as also listed by @jsulm and play a bit around. Just change the file name to somthing you need. E.g.

    QFile file("c:/data/myNewFolder/out.txt");

    That is a possibility to specify a complete (absolute) file name.

    If you are a beginner, I was in that stage before as all the others, there might be a problem with the not existing folder name, if your file not created. There is QDir::mkPath, which is slightly different from mkDir. It may help you in code to ensure that you actually can create the file.

    The other thing driving me personally nuts is the stupid folder separator for windows, which is a back slash '\'. However, in the mean time you can easily substitute with a forward slash also for most things in Windows (especially Qt). This also part of some of the suggestions.

    If you have difficulties sometimes it helps for others to post a short section of code and the error message.

  • 0 Votes
    5 Posts
    3k Views
    oblivioncthO

    @Rondog @alex_malyu

    I see that this is not as simple as I had hoped and I guess I will just deal with using a directory browse or letting the user set the name. The reason i have the user interacting with an .ini is because it is not just global program settings that are loaded. I want the user to have multiple configurations that they can easily switch between that have file paths and numeric settings saved so that the program can be used easily in rapid succession. The GUI is a port of a console application that is not yet finished so I want debugging with it to be quick. This is why I have the ability to save and load a .ini file so that if a user keeps testing with the same paths over and over they don't need to keep browsing for the same files over and over again. However, I wanted there to be the ability to have multiple setups saved which is why I don't just want there to be one .ini that is used automatically.

    I know I could use some kind of slot system with the same .ini (like saves lots on a video game) to accomplish the same thing and the user just picks one of those slots. But like I said the application is not finished yet (the code behind the GUI) so it being perfectly clean is not an issue at the moment.

    Thank you for the information.

  • Save Graphics View Scene

    Unsolved General and Desktop
    6
    0 Votes
    6 Posts
    5k Views
    ?

    bool QPixmap::save(const QString & fileName, const char * format = 0, int quality = -1) const

    "If format is 0, an image format will be chosen from fileName's suffix." (see QPixmap documentation)

    So you can say pixmap.save("/home/pw/myfile.jpg") and it will automatically detect the ".jpg" suffix. If you want to save the image without a suffix you must specify what file format you want to use: pixmap.save("/home/pw/myfile", "JPG") (see supported file formats).

  • 0 Votes
    5 Posts
    4k Views
    raven-worxR

    @fbengo
    oops..sry my bad.
    but as i said... straight from my head :)

    just adapt the starting method:

    void someFunction() { QFile file(filePath); if (file.open(QFile::WriteOnly)) { QTextStream stream(&file); for (int r = 0; r < model->rowCount(); r++) this->printTree( 0, model->index(r,0), stream ); file.close(); } }
  • 0 Votes
    1 Posts
    879 Views
    No one has replied
  • 0 Votes
    3 Posts
    1k Views
    C

    Now i got another question. I tried using QNetworkConfigurationManager.

    If connection situation changes program succesfully sends a signal. The signal is onlineStateChanged(bool)

    If i use QNetworkConfigurationManager::isOnline() function inside a constructor. It fails. Maybe a bug?

    Here is my code inside constructor :

    networkConfigurationManager = new QNetworkConfigurationManager(this); // If there is network connection, close the program if(networkConfigurationManager->isOnline() == true) { this->close(); }
  • 0 Votes
    3 Posts
    1k Views
    diduD

    @cybercatalyst said:

    This dependes on the format, which most likely adds some kind of compression. The compression result is depend on the ordering of the pixels, which may be entirely different when pixels are differently aligned after scaling. This has a direct impact on the size in bytes.

    So, the conclusion is that there is some dependency (image contents, format, size) -> (size in bytes), but unless you aren't using an uncompressed format I wouldn't expect to be able to calculate the inversion of that function. This would be really complicated if even possible.

    Thanks for the answser.
    I think I will have to look for using BMP format. (https://support.microsoft.com/en-us/kb/132271)
    It is not the best optimization but it is the most quick calcul...

  • 0 Votes
    5 Posts
    3k Views
    ?

    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