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. QTableView with `from __feature__ import snake_case, true_property`

QTableView with `from __feature__ import snake_case, true_property`

Scheduled Pinned Locked Moved Unsolved Qt for Python
3 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.
  • P Offline
    P Offline
    petr.salajka
    wrote on last edited by
    #1

    Hello,

    I'd like to use from __feature__ import snake_case, true_property directive. I started with my small QTableView example code.
    It's OK, but when I switch to true_property case, it stops working.

    As Qt for Python 6 released proposes, I simply replaced view.setModel(model) with view.model = model but then nothing happens and the view is empty. No error, just empty. I failed to find any docs for the true_property case. Do you have any suggestions? Thanks.

    eyllanescE 1 Reply Last reply
    0
    • P petr.salajka

      Hello,

      I'd like to use from __feature__ import snake_case, true_property directive. I started with my small QTableView example code.
      It's OK, but when I switch to true_property case, it stops working.

      As Qt for Python 6 released proposes, I simply replaced view.setModel(model) with view.model = model but then nothing happens and the view is empty. No error, just empty. I failed to find any docs for the true_property case. Do you have any suggestions? Thanks.

      eyllanescE Offline
      eyllanescE Offline
      eyllanesc
      wrote on last edited by eyllanesc
      #2

      @petr-salajka

      This feature is not documented (it would be good to report it as a bug) but in the post you indicate is for Qt properties:

      With Qt 5.15.2, we introduced a new option called feature, enabling you to switch between camelCase and snake_case for most Qt APIs. With Qt 6.0, you can directly access Qt properties from your Python code, leaving aside the setters and getters, with the new true_property feature.

      and the model is not a Qt Property so you must use the set_model method: view.set_model(model)

      If you want me to help you develop some work then you can write to my email: e.yllanescucho@gmal.com.

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

        Hi and welcome to devnet,

        QTableView has no "model" property hence you are replacing the setModel method with your model object. If anything you might be able to use "set_model" in place of setModel.

        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

        • Login

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