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. QSqlqueryModel with Mouse Move
Qt 6.11 is out! See what's new in the release blog

QSqlqueryModel with Mouse Move

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 2 Posters 1.1k 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.
  • F Offline
    F Offline
    Fuxi
    wrote on last edited by
    #1

    Hello, I have a QSqlQueryModel where I override the data function to give the columns different colors.
    When I move the mouse over the connected QTableView
    (target outside the tableview)
    without pressing a mouse button, the data function is always called with the model index of the position where I started the movement. Is there any way to disable this?
    Thanks

    Christian EhrlicherC 1 Reply Last reply
    0
    • F Fuxi

      Hello, I have a QSqlQueryModel where I override the data function to give the columns different colors.
      When I move the mouse over the connected QTableView
      (target outside the tableview)
      without pressing a mouse button, the data function is always called with the model index of the position where I started the movement. Is there any way to disable this?
      Thanks

      Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Fuxi said in QSqlqueryModel with Mouse Move:

      Is there any way to disable this?

      Since the data() function is called whenever the cell needs to be redrawn - no.
      And what's the problem with someone calling data()?

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      0
      • F Offline
        F Offline
        Fuxi
        wrote on last edited by
        #3

        Thanks. The problem is a bit difficult to describe. But the fact that only one column is called when the mouse is moved isn't good for my application. Can I simply redraw all columns instead of just redrawing the source column?
        For example, if the mouse moved end , everything will be redrawn. Thanks.

        1 Reply Last reply
        0
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          A redraw can happen every time on every cell / region inside your widget when e.g. the os or Qt decides that there is a redraw needed - so no you can't control this.

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          1 Reply Last reply
          1
          • F Offline
            F Offline
            Fuxi
            wrote on last edited by
            #5

            Thank you

            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