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 525 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 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 Pl45m4P 2 Replies Last reply
    0
    • R Robert Hairgrove

      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 last edited by
      #2

      Replying to my own question:

      QIODevice::errorString() should solve the problem.

      1 Reply Last reply
      2
      • R Robert Hairgrove

        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?

        Pl45m4P Offline
        Pl45m4P Offline
        Pl45m4
        wrote on 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

        jsulmJ 1 Reply Last reply
        0
        • Pl45m4P Pl45m4

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

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on 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

          • Login

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