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. Code for save as button
Forum Updated to NodeBB v4.3 + New Features

Code for save as button

Scheduled Pinned Locked Moved Unsolved General and Desktop
13 Posts 2 Posters 923 Views
  • 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.
  • jsulmJ jsulm

    @Qwerty123098 Please ask more concrete questions.
    What did you try?
    What does not work?

    Q Offline
    Q Offline
    Qwerty123098
    wrote on last edited by
    #3

    @jsulm "save as" button for lineEdit, I wrote the code so that the button would open the file or save it in a file, but I wanted the button to save the file as

    jsulmJ 1 Reply Last reply
    0
    • Q Qwerty123098

      @jsulm "save as" button for lineEdit, I wrote the code so that the button would open the file or save it in a file, but I wanted the button to save the file as

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #4

      @Qwerty123098 I still don't understand what the problem is. Can you be more specific?
      Just use https://doc.qt.io/qt-5/qfiledialog.html#getSaveFileName to ask user where to save and then write to that file.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      Q 1 Reply Last reply
      3
      • jsulmJ jsulm

        @Qwerty123098 I still don't understand what the problem is. Can you be more specific?
        Just use https://doc.qt.io/qt-5/qfiledialog.html#getSaveFileName to ask user where to save and then write to that file.

        Q Offline
        Q Offline
        Qwerty123098
        wrote on last edited by
        #5

        for example, in microsoft word or paint, when you have finished the project you click the save as button, and when you save, you give it the name and location of the file.

        jsulmJ 1 Reply Last reply
        0
        • Q Qwerty123098

          for example, in microsoft word or paint, when you have finished the project you click the save as button, and when you save, you give it the name and location of the file.

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by jsulm
          #6

          @Qwerty123098 I know what "Save as" is, that is not my question. My question is: what is the problem with implementing it?
          Did you check the link I provided?

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          Q 1 Reply Last reply
          4
          • jsulmJ jsulm

            @Qwerty123098 I know what "Save as" is, that is not my question. My question is: what is the problem with implementing it?
            Did you check the link I provided?

            Q Offline
            Q Offline
            Qwerty123098
            wrote on last edited by
            #7

            @jsulm thanks, I figured it out

            1 Reply Last reply
            0
            • Q Offline
              Q Offline
              Qwerty123098
              wrote on last edited by
              #8

              And one more question. How to save a .txt file that was written in lineEdit.

              jsulmJ 1 Reply Last reply
              0
              • Q Qwerty123098

                And one more question. How to save a .txt file that was written in lineEdit.

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #9

                @Qwerty123098 Please read documentation:
                https://doc.qt.io/qt-5/qtextstream.html
                https://doc.qt.io/qt-5/qlineedit.html#text-prop

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                3
                • Q Offline
                  Q Offline
                  Qwerty123098
                  wrote on last edited by
                  #10

                  I do not understand, you can write

                  jsulmJ 1 Reply Last reply
                  0
                  • Q Qwerty123098

                    I do not understand, you can write

                    jsulmJ Offline
                    jsulmJ Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on last edited by jsulm
                    #11

                    @Qwerty123098 said in Code for save as button:

                    you can write

                    I can, but I will not - I'm not here to write code for you, sorry.
                    What exactly do you not understand?

                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                    Q 1 Reply Last reply
                    4
                    • jsulmJ jsulm

                      @Qwerty123098 said in Code for save as button:

                      you can write

                      I can, but I will not - I'm not here to write code for you, sorry.
                      What exactly do you not understand?

                      Q Offline
                      Q Offline
                      Qwerty123098
                      wrote on last edited by
                      #12

                      how to save text that was written in line Edit

                      jsulmJ 1 Reply Last reply
                      0
                      • Q Qwerty123098

                        how to save text that was written in line Edit

                        jsulmJ Offline
                        jsulmJ Offline
                        jsulm
                        Lifetime Qt Champion
                        wrote on last edited by
                        #13

                        @Qwerty123098 Get the text from the line edit using https://doc.qt.io/qt-5/qlineedit.html#text-prop, write it into the file using QFile and https://doc.qt.io/qt-5/qtextstream.html.
                        What is not clear?!
                        Did you even try to implement it?

                        https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        3

                        • Login

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