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. Problem with saving function (overwrite file which saved by dialog)

Problem with saving function (overwrite file which saved by dialog)

Scheduled Pinned Locked Moved Solved General and Desktop
saveqtexteditfilefunction
25 Posts 3 Posters 9.9k 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.
  • ? A Former User
    23 May 2016, 11:49

    @Wieland
    Hi, thank you for the example

    if (!mySaveFunction()) {
            m_fileName.clear(); // saving failed. clear m_fileName so the QFileDialog will come up again next time
        }
    
    

    This Code is not working...

    C:\Users\Henrik\Documents\TextPad\pagestextedit.cpp:557: Fehler: could not convert 'PagesTextEdit::saveUnderDocument()' from 'void' to 'bool'
                 if (!saveUnderDocument()) {
                                        ^
    

    I have void MainWindow::save....
    and not bool

    How can i Change it?

    One Problem is existing..
    When i open a file e.g. from Desktop and i write something in and want to save it with mySaveFunction i get an runtime error...
    Do you know why?

    Thanks a lot

    ? Offline
    ? Offline
    A Former User
    wrote on 23 May 2016, 11:53 last edited by
    #21

    @HenrikSt.
    The Code which is not working i fixed it...

    But the other Problem not

    1 Reply Last reply
    0
    • ? A Former User
      23 May 2016, 11:49

      @Wieland
      Hi, thank you for the example

      if (!mySaveFunction()) {
              m_fileName.clear(); // saving failed. clear m_fileName so the QFileDialog will come up again next time
          }
      
      

      This Code is not working...

      C:\Users\Henrik\Documents\TextPad\pagestextedit.cpp:557: Fehler: could not convert 'PagesTextEdit::saveUnderDocument()' from 'void' to 'bool'
                   if (!saveUnderDocument()) {
                                          ^
      

      I have void MainWindow::save....
      and not bool

      How can i Change it?

      One Problem is existing..
      When i open a file e.g. from Desktop and i write something in and want to save it with mySaveFunction i get an runtime error...
      Do you know why?

      Thanks a lot

      ? Offline
      ? Offline
      A Former User
      wrote on 23 May 2016, 12:28 last edited by
      #22

      @HenrikSt. said:

      Do you know why?

      No.

      ? 1 Reply Last reply 23 May 2016, 12:34
      0
      • ? A Former User
        23 May 2016, 12:28

        @HenrikSt. said:

        Do you know why?

        No.

        ? Offline
        ? Offline
        A Former User
        wrote on 23 May 2016, 12:34 last edited by
        #23

        @Wieland
        https://onedrive.live.com/redir?resid=8CA2253BB1C9EA6!60243&authkey=!ABJFjbW9wpRomkw&v=3&ithint=photo%2Cpng

        ? 1 Reply Last reply 23 May 2016, 12:34
        0
        • ? A Former User
          23 May 2016, 12:34

          @Wieland
          https://onedrive.live.com/redir?resid=8CA2253BB1C9EA6!60243&authkey=!ABJFjbW9wpRomkw&v=3&ithint=photo%2Cpng

          ? Offline
          ? Offline
          A Former User
          wrote on 23 May 2016, 12:34 last edited by
          #24

          @HenrikSt.
          But you understand my Problem?

          1 Reply Last reply
          0
          • J Offline
            J Offline
            jsulm
            Lifetime Qt Champion
            wrote on 23 May 2016, 12:53 last edited by
            #25

            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?

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

            1 Reply Last reply
            0

            21/25

            23 May 2016, 11:53

            • Login

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