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. Is there a way to detect if QTableWidgetItem is doubleClicked?
Forum Updated to NodeBB v4.3 + New Features

Is there a way to detect if QTableWidgetItem is doubleClicked?

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 648 Views 2 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.
  • A Offline
    A Offline
    Aaron Kim
    wrote on last edited by Aaron Kim
    #1

    QTableWidgetItem::isSelected() only detects if it is literally selected or not. (Single clicked is included)

    Also, Can I retrieve current-typing text on QTableWidgetItem after the item is focused? I checked that QTableWidgetItem::text() just retrieves text before focusing the item.

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

      Hi
      There is
      http://doc.qt.io/qt-5/qtablewidget.html#itemDoubleClicked

      About getting text While typing it.
      its somewhat hacky as it lives inside the default item Delegate.

      Why do you need that ?

      A 1 Reply Last reply
      2
      • mrjjM mrjj

        Hi
        There is
        http://doc.qt.io/qt-5/qtablewidget.html#itemDoubleClicked

        About getting text While typing it.
        its somewhat hacky as it lives inside the default item Delegate.

        Why do you need that ?

        A Offline
        A Offline
        Aaron Kim
        wrote on last edited by Aaron Kim
        #3

        @mrjj
        0_1534667232303_capture.PNG
        This is what I want to make. If those buttons are pressed, 𝒙 (or 𝒚) should be simply appended to current text.
        item->setText(item->text() + "𝒙") can not do that because item->text() retrieves text before focusing, not the text current typing.

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

          Hi,

          From a quick check, you would likely have to implement a custom QStyledItemDelegate from which you modify the createEditor function to emit a signal with the editor created as parameter. In a slot connected to that signal you can store that editor widget and thus you can modify its content when needed. Don't forget to also handle the case when the editor is destroyed. For example using a QPointer for that.

          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
          1
          • A Offline
            A Offline
            Aaron Kim
            wrote on last edited by
            #5

            I just solved this just with making a cell QLineEdit. Thanks for reply!

            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