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. QSqlTableModel + QStyledItemDelegate already implemented , Now I need to add mouse Event (Right Click). Help Required
Forum Updated to NodeBB v4.3 + New Features

QSqlTableModel + QStyledItemDelegate already implemented , Now I need to add mouse Event (Right Click). Help Required

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

    Hi.
    I have already implemented a QStyledItemDelgate to show images in my QTableview. The styleditem delegate display images and also provide a mechanism for text entry (QLineEdit, QDateEdit and QComboBox)

    Now I need to implement a mechanism to detect a right click in my QTableView, so that I can display a drop down menu. This is where i am running into problems.

    I tried the following approach.

    Approach 1

    Sub classed a QTableView and added QMouse event and was able to detect the left click and right click. But when i double click I am unable to get the delegate action to work.

    Approach 2 :
    I came across that in QStyledItem Delegate we can use bool editorEvent(); but the clicks on a particular column are not detecting.

    Please suggest which approach is best, and how to implement them.

    Thanks

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

      Hi,

      You might be interested by "contextMenuEvent":http://qt-project.org/doc/qt-5/qwidget.html#contextMenuEvent and related classes

      Hope it helps

      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