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. QStyledItemDelegate Conflicting With 'QTableView' Stylesheet
QtWS25 Last Chance

QStyledItemDelegate Conflicting With 'QTableView' Stylesheet

Scheduled Pinned Locked Moved Unsolved General and Desktop
qtableviewqstyleditemdeleqtablewidgetstylesheetpaint event
2 Posts 2 Posters 339 Views
  • 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.
  • S Offline
    S Offline
    Serafim Rafail
    wrote on last edited by
    #1

    Screenshot 2024-01-18 195637.png

    In the above image you can see that the QStyledItemDelegate is having the default stylesheet when the item is selected, on focus or on hovering it is not following the QTableView Stylesheet but if i select the the cell which is QStyledItemDelegate everything is fine. The first cell is QStyledItemDelegate.

    my QTableView is set on "setSelectionBehavior(QAbstractItemView::SelectRows);" and i am painting the icon and text myself inside paintEvent of QStyledItemDelegate

    1 Reply Last reply
    0
    • C Offline
      C Offline
      Connected Graph
      wrote on last edited by
      #2

      You should call QStyledItemDelegate::paint function inside yours QStyledItemDelegate derived class before painting of icons and text:

      void IconsRenderItemDelegate::paint(QPainter *painter,
      const QStyleOptionViewItem &option, const QModelIndex &index) const
      {
      QStyledItemDelegate::paint(painter, options, index);

      // Draw somethig
      }

      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