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. [Self-Solved]QTableView selected row color
Forum Updated to NodeBB v4.3 + New Features

[Self-Solved]QTableView selected row color

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

    Hi, guys

    I create a delegate for checkbox, and display this checkBox in Qtableview. everything is ok, but, when I selected one row in table, there is no selected color in that specific columns that checkbox are displayed. would you guys please give me some ideas on this issue, thanks a lot.

    @class CheckBoxDelegate : public QItemDelegate
    {
    Q_OBJECT
    public:
    explicit CheckBoxDelegate(QObject *parent=0);

    virtual void drawCheck(QPainter *painter, const QStyleOptionViewItem &option,
        const QRect &, Qt::CheckState state) const;
    virtual bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option,
        const QModelIndex &index);
    virtual void drawFocus(QPainter *painter, const QStyleOptionViewItem &option, const QRect &rect) const;
    

    };@

    1 Reply Last reply
    0
    • P Offline
      P Offline
      pmjz
      wrote on last edited by
      #2

      just reimplements the drawdisplay() in the delegate and make drawfocus() is empty function.

      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