Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

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

    General and Desktop
    2
    3
    574
    Loading More Posts
    • 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
      bowlder last edited by

      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 Reply Quote 0
      • Chris Kawa
        Chris Kawa Moderators last edited by

        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 Reply Quote 0
        • B
          bowlder last edited by

          Great! It works for me. Thanks a lot!

          1 Reply Last reply Reply Quote 0
          • First post
            Last post