Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Solved Localized text for QFileDevice::FileError constants

    General and Desktop
    3
    4
    207
    Loading More Posts
    • 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.
    • R
      Robert Hairgrove last edited by

      Are these compatible with the C runtime errno constants and the strerror() function? That is, can I pass the numeric error code returned by QFileDevice::error() to the strerror() function to generate a meaningful message I can display in a message box?

      Or is there a different way to do it in Qt?

      R Pl45m4 2 Replies Last reply Reply Quote 0
      • R
        Robert Hairgrove @Robert Hairgrove last edited by

        Replying to my own question:

        QIODevice::errorString() should solve the problem.

        1 Reply Last reply Reply Quote 2
        • Pl45m4
          Pl45m4 @Robert Hairgrove last edited by

          @Robert-Hairgrove said in Localized text for QFileDevice::FileError constants:

          Are these compatible with the C runtime errno constants and the strerror() function?

          QFileDevice::FileError is an enum. You can check out the values here.
          I dont think that these values (0-14) can be translated to C.

          If you need to display the actual error as text, you could check the error code and map it to a matching message box.


          If debugging is the process of removing software bugs, then programming must be the process of putting them in.

          ~E. W. Dijkstra

          jsulm 1 Reply Last reply Reply Quote 0
          • jsulm
            jsulm Lifetime Qt Champion @Pl45m4 last edited by

            @Pl45m4 said in Localized text for QFileDevice::FileError constants:

            you could check the error code and map it to a matching message box

            Or call QIODevice::errorString() if localisation is not needed :-)

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

            1 Reply Last reply Reply Quote 0
            • First post
              Last post