Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to say where to write a file to without a dialog
Forum Updated to NodeBB v4.3 + New Features

How to say where to write a file to without a dialog

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 1.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MathSquare
    wrote on last edited by
    #1

    @
    QString RawText (ui->lineEdit->text());
    QFile file(RawText & ".txt");
    if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
    return;
    @
    it work but it save it in the folder were the program as in.

    [[Merged several similar threads into this one, Tobias]]

    1 Reply Last reply
    0
    • M Offline
      M Offline
      MathSquare
      wrote on last edited by
      #2

      How to load type of files in a folder with list view or something like it (qt4)?

      [[Merged several identical threads and moved it to General and Desktop, Tobias]]

      1 Reply Last reply
      0
      • M Offline
        M Offline
        MathSquare
        wrote on last edited by
        #3

        How to load type of files in a folder with list view or something like it in (qt4)?

        1 Reply Last reply
        0
        • Q Offline
          Q Offline
          QMartin
          wrote on last edited by
          #4

          Hi!

          That is because your RawText doesn't contain a path. To save it in another location, the ui->lineEdit->text() shall contain the path of your file. For example: if your lineEdit is /home/yourName/Documents/RawText.txt then it will be saved to /home/yourName/Documents directory, but if the lineEdit is only RawText.txt, the current directory will be used. Try writing a complete path in your lineEdit and see how it works.

          Regards

          1 Reply Last reply
          0
          • M Offline
            M Offline
            MathSquare
            wrote on last edited by
            #5

            Writing the text within a text edit to a file (QT4)?

            1 Reply Last reply
            0
            • T Offline
              T Offline
              tobias.hunger
              wrote on last edited by
              #6

              I merged several threads into this one, even though the questions are not identical since they all seem to be about the same general problem you are trying to solve.

              Please consider to read a book on C++ programming before continuing. That will make your live much easier.

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved