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. [SOLVED] - QTableView drop indicator appearance
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] - QTableView drop indicator appearance

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 6.8k 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.
  • M Offline
    M Offline
    maximus
    wrote on last edited by
    #1

    Hi,

    I have a QTableView with dragAndDrop (internalMove) that is working.
    I would like the drop indicator to indicate a complete row instead of just a cell
    like it is doing currently, see here:
    https://www.dropbox.com/s/uzo94rnzoq46ths/dropIndicatorTooSmall.png

    The drop indicator is shown by my model class with the flag method :

    @Qt::ItemFlags IntervalTableModel::flags(const QModelIndex &index) const
    {

    Qt::ItemFlags defaultFlags = QAbstractTableModel::flags(index);
    
    if (index.isValid()) {
    
        if (index.column() == 0) {
            return Qt::ItemIsDragEnabled  | defaultFlags;
        }
        else
            return Qt::ItemIsEditable | Qt::ItemIsDragEnabled | defaultFlags;
    }
    
    /// To show drop indicator
    else {
        return Qt::ItemIsDropEnabled;
    }
    

    }
    @

    Is there a way to show a full line instead of this small line,
    also is there a way to modify the dropIndicator with stylesheets, it seems not thick enough I can hardly see it.

    Thank you!


    Free Indoor Cycling Software - https://maximumtrainer.com

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

      Hi,

      You could try with setSelectionBehavior and SelectRows

      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
      • M Offline
        M Offline
        maximus
        wrote on last edited by
        #3

        Thanks SGaist,

        I already have this flag set to "SelectRows" that's why i'm wondering why it still show a cell line instead of a full row line, I suspect the problem may be in my model "flags" method shown above.


        Free Indoor Cycling Software - https://maximumtrainer.com

        1 Reply Last reply
        0
        • M Offline
          M Offline
          maximus
          wrote on last edited by
          #4

          Fixed using a custom QProxyStyle on my QTableView

          Good example here :
          http://stackoverflow.com/questions/7596584/qtreeview-draw-drop-indicator

          Thanks


          Free Indoor Cycling Software - https://maximumtrainer.com

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

            Nice finding ! Thanks for sharing :)

            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
            • J Offline
              J Offline
              Jzon
              wrote on last edited by
              #6

              Hello,Friend!Can i have a look your code 。 thank you very much

              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