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. CellClicked signal does not work when showing rich text in the cell
QtWS25 Last Chance

CellClicked signal does not work when showing rich text in the cell

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 760 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.
  • B Offline
    B Offline
    bowlder
    wrote on last edited by
    #1

    I have a QTableWidget, one column of the table are rich text. cellClicked(int,int) signal does not work for rich text column.

    For example, I assigned following rich text value to a cell:

    dataViewTable->setCellWidget(0, 0, new QLabel("<font color=red>TEST</font>"));

    cellClicked(int,int) signal does not work when I click this cell. The click signal works for other cells. How to fix this problem?

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      When you use a cell widget it's that widget that gets the clicks, not the table widget.

      If you don't need to interact with the label you can make it "transparent" to mouse clicks:
      @
      QLabel* label = new QLabel("<font color=red>TEST</font>");
      label->setTextInteractionFlags(Qt::NoTextInteraction);
      dataViewTable->setCellWidget(0, 0, label);
      @

      1 Reply Last reply
      0
      • B Offline
        B Offline
        bowlder
        wrote on last edited by
        #3

        Great! It works for me. Thanks a lot!

        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