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. Localized text for QFileDevice::FileError constants
Forum Updated to NodeBB v4.3 + New Features

Localized text for QFileDevice::FileError constants

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 526 Views 2 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.
  • R Offline
    R Offline
    Robert Hairgrove
    wrote on 18 Jul 2019, 12:15 last edited by
    #1

    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 P 2 Replies Last reply 18 Jul 2019, 12:18
    0
    • R Robert Hairgrove
      18 Jul 2019, 12:15

      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 Offline
      R Offline
      Robert Hairgrove
      wrote on 18 Jul 2019, 12:18 last edited by
      #2

      Replying to my own question:

      QIODevice::errorString() should solve the problem.

      1 Reply Last reply
      2
      • R Robert Hairgrove
        18 Jul 2019, 12:15

        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?

        P Offline
        P Offline
        Pl45m4
        wrote on 18 Jul 2019, 12:26 last edited by
        #3

        @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

        J 1 Reply Last reply 18 Jul 2019, 12:56
        0
        • P Pl45m4
          18 Jul 2019, 12:26

          @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.

          J Offline
          J Offline
          jsulm
          Lifetime Qt Champion
          wrote on 18 Jul 2019, 12:56 last edited by
          #4

          @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
          0

          1/4

          18 Jul 2019, 12:15

          • Login

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