Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-123493

QtProtobuf requires qRegisterProtobufTypes for deserializing

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • None
    • 6.6.1
    • Protocol Buffers
    • None
    • Boot2Qt from a linux desktop host machine
    • Linux/X11
    • e1c3e5446 (dev)

    Description

      I am surprised why I needed to find this forum to solve my problem: https://forum.qt.io/post/771711

       

      My protobuf file is as follows:

      
      syntax="proto3";
      package edge.connections;
      option go_package = "github.com/flowy-live/flowy/genproto/connections;pbconnections";
      
      import "google/protobuf/timestamp.proto";
      import "user/user.proto";
      
      message UserConnection {
        user.User connection_user = 1;
        // whether the user is tuned into this contact
        bool tuned_in = 2;
        // whether the connection is tuned into the user
        bool is_tuned_into_me = 3;
        // when the connection was made
        google.protobuf.Timestamp created_at = 4;
      }
      
      // Responsible for managing connections between users
      // ALL protected
      service ConnectionsService {
        rpc FindPeople(FindPeopleRequest) returns (FindPeopleResponse) {}
      

       

      ......goes on and on...

       

      The error I get is `qt.protobuf: No deserializer for type QList<edge::connections::UserConnection>`

       

      My protobuf files are generated fine into my build folder with the proper CMake adjustments (although this took all day for me to figure out with the confusing APIs where `PROTO_INCLUDES` doesn't work). The problem is when I actually make a call, I run into the error above. This is true for other messages as well.

       

      The post I mentioned (https://forum.qt.io/post/771711) saved the day by telling me that I needed `qRegisterProtobufTypes()`. I tried putting it in my main function and that fixed it. I used f1 to see what it is, and there is a note that it should not need to be manually called. I am unsure why any of this information is not in the QtProtobuf docs entrypoint although I know the whole thing is in technical preview.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            tatiana.borisova Tatiana Borisova
            talksik Arjun Patel
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes