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. Qt DBus: Byte type in QVariant, QVariantMap?
QtWS25 Last Chance

Qt DBus: Byte type in QVariant, QVariantMap?

Scheduled Pinned Locked Moved Solved General and Desktop
qvariantqtdbus
2 Posts 1 Posters 1.1k Views
  • 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.
  • M Offline
    M Offline
    minski
    wrote on 30 Sept 2018, 16:23 last edited by VRonin 10 Jan 2018, 08:13
    #1

    Hi, i am trying to implement the following DBus interface using Qt:

    void RegisterEndpoint(object endpoint, dict properties)
    possible properties:

    string UUID
    byte Codec
    array{byte} Capabilities
    

    This is currently described in XML the following way:

        <method name="RegisterEndpoint">
          <arg name="endpoint" type="o" direction="in"/>
          <arg name="properties" type="a{sv}" direction="in"/>
          <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/>
        </method>
    

    But when i call this method, i get an invalid arguments error.
    I guess, the reason is, because QVariant cannot take a Byte type (converting to int instead):

    properties	<3 items>	QVariantMap &
    	[0] "Capabilities"	"À\020\204\200ÿÿ"	
    		key	"Capabilities"	QString
    		value	"À\020\204\200ÿÿ"	QVariant (QByteArray)
    	[1] "Codec"	2	
    		key	"Codec"	QString
    		value	2	QVariant (int)
    	[2] "UUID"	"0000110b-0000-1000-8000-00805f9b34fb"	
    		key	"UUID"	QString
    		value	"0000110b-0000-1000-8000-00805f9b34fb"	QVariant (QString)
    

    Can anyone help out with suggestions to realize this?

    Many thanks in advance!

    1 Reply Last reply
    0
    • M Offline
      M Offline
      minski
      wrote on 1 Oct 2018, 08:12 last edited by
      #2

      Solved: you have to create a QVariant like this:
      QVariant::fromValue(uchar(0)) -- instead of QVariant var = uchar(0);

      1 Reply Last reply
      2

      1/2

      30 Sept 2018, 16:23

      • Login

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