Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Pyside6 PYTHON chat example ?

Pyside6 PYTHON chat example ?

Scheduled Pinned Locked Moved Solved Qt for Python
6 Posts 3 Posters 494 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.
  • R Offline
    R Offline
    Ravenboy
    wrote on last edited by Ravenboy
    #1

    in the 'qt for python' docs there is a section on a Bluetooth qt chat example:

    https://doc.qt.io/qtforpython-6.2/overviews/qtbluetooth-btchat-example.html#chat-client

    some lines look like c++ and I am struggling to translate them into python:

    like:
    protocol << QVariant.fromValue(QBluetoothUuid(QBluetoothUuid.ProtocolUuid.Rfcomm))
    << QVariant.fromValue(quint8(rfcommServer.serverPort()))

    I was thrilled when this page had a link at the bottom:
    Example project @ code.qt.io
    but au contraire - the example is not a python example, its in c++.

    I'm hoping there is a Qside6 version of this somewhere.

    I have searched the net (to no avail) for examples of using qside6 bluetooth classic to implement a bluetooth classic server

    any ideas are appreciated.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Not all examples have been completely ported to Python yet. Some of the code is auto-translated thus the issue you are seeing.

      From a quick look, protocol is a sort of list and that line simply adds elements to it one by one.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • R Offline
        R Offline
        Ravenboy
        wrote on last edited by
        #3

        Thanks,
        and to further educate me, what is added to the list after the execution of
        QVariant.fromValue(QBluetoothUuid(QBluetoothUuid.ProtocolUuid.Rfcomm)) .

        QVariant.fromValue isn't defined in PyQT6

        JonBJ 1 Reply Last reply
        0
        • R Ravenboy

          Thanks,
          and to further educate me, what is added to the list after the execution of
          QVariant.fromValue(QBluetoothUuid(QBluetoothUuid.ProtocolUuid.Rfcomm)) .

          QVariant.fromValue isn't defined in PyQT6

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by JonB
          #4

          @Ravenboy
          PyQt/PySide does not need QVariant because Python is happy dealing with everything as objects. Just ignore it, and hopefully any other mentions of QVariant. Here the code want to store a QBluetoothUuid and a small integer/byte in the list. You should be able to mix these happily in a Python list.

          There are a few other basic types like this, e.g. QString is just handled with Python's inbuilt str type.

          1 Reply Last reply
          1
          • R Offline
            R Offline
            Ravenboy
            wrote on last edited by
            #5

            Thanks,
            made progress, got thru the making of the chat server, and
            serviceInfo.registerService(localAdapter.address()) returned True, finally

            now onward, and pythonizing the rest of the low level stuff from the c++ chat demo
            (don't need the user intercface objects, I am only using the bluetooth stuff until I decide its working.)

            all of this is because at least on an apple silicon Mac, Python doesn't have bluetooth. (I'm using latest, 3.13)

            1 Reply Last reply
            0
            • R Offline
              R Offline
              Ravenboy
              wrote on last edited by
              #6

              thanks for the help - I've gotten far enough that I am discovering service just fine.

              1 Reply Last reply
              0
              • R Ravenboy has marked this topic as solved on

              • Login

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