• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Python Qt QTableWidgetItem background color problem

New Here ,
Aug 04, 2022 Aug 04, 2022

Copy link to clipboard

Copied

Hi, I'm working on a tool that involves a QTableWidget. I'm trying to set the background color of individual cels based on texture assignements. The problem is, no matter what I try, the color stays the default Designer background color. I've tried QTableWidgetItem.setBackgroundColor() and QTableWidgetItem.setBackground (brush) and it doen't change. Setting a stylesheet for the QTableWidget does change the background color, but it changes it for all items and I still cannot set individual item colors.

 

-chad

TOPICS
Scripting

Views

1.6K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 04, 2022 Aug 04, 2022

Copy link to clipboard

Copied

LATEST

FYI - I don't know why Designer prevents setting background colors for table widget items, but I solved the issue by writing a custom itemDelegate and overriding the paint function.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines