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. How to qDebug() << enum
Forum Updated to NodeBB v4.3 + New Features

How to qDebug() << enum

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 2.3k Views 1 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.
  • sonichyS Offline
    sonichyS Offline
    sonichy
    wrote on last edited by
    #1
    QJsonParseError json_error;
    QJsonDocument parse_doucment = QJsonDocument::fromJson(codeContent.toLatin1(), &json_error);
    qDebug() << json_error;
    

    https://github.com/sonichy

    jsulmJ 1 Reply Last reply
    0
    • sonichyS sonichy
      QJsonParseError json_error;
      QJsonDocument parse_doucment = QJsonDocument::fromJson(codeContent.toLatin1(), &json_error);
      qDebug() << json_error;
      
      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @sonichy You either cast the enum value to int or implement operator<< operator for that enum. See http://doc.qt.io/qt-5/qdebug.html

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

      1 Reply Last reply
      5
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi
        Is QJsonParseError not a class and what you actually want is
        qDebug() << json_error.errorString();
        or
        qDebug() << json_error.error ?

        sonichyS 1 Reply Last reply
        5
        • mrjjM mrjj

          Hi
          Is QJsonParseError not a class and what you actually want is
          qDebug() << json_error.errorString();
          or
          qDebug() << json_error.error ?

          sonichyS Offline
          sonichyS Offline
          sonichy
          wrote on last edited by
          #4

          @mrjj said in How to qDebug() << enum:

          qDebug() << json_error.errorString();

          qDebug() << json_error.errorString(); is good for QJsonParseError.

          https://github.com/sonichy

          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