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. Adding Custom Widget to cell of QTableView
Forum Updated to NodeBB v4.3 + New Features

Adding Custom Widget to cell of QTableView

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 351 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.
  • E Offline
    E Offline
    edmh
    wrote on last edited by
    #1

    I want to add a custom widget to the cell of a QTableView. The widget is not editable by the operator. It is a simple radio button with a label.
    First off, yes, there are a lot of examples doing this with a delegate when you want the operator to click the cell and 'edit' it.

    What I cannot find is a way to add a "view/read only" custom widget to a QTableView.

    I have read about openPersistientEditor but also read warnings that this will lead to performance issues with larger tables.
    I am using this approach and also notice the memory footprint of my application growing over time. That has me a bit concerned.

    Yes, I could 'paint' the custom widget in the paint function of the QItemDelegate derived class I have assigned to my table view but that seems overly complicated, especially when I want to use all the features of a QRadioButton. Simply put i want to add an instance of a class derived from QRadioButton to a cell in the table view. There doesn't seem to be a simple way to do this, at least that I can find.

    If there is a straight forward example of doing this, can you point me to it.

    Thank you.
    -Ed.

    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