Aug-13-2023, 03:25 PM
Hi,
I'm trying to get the color name of the current item's foreground of a qlistwidget.
To set it I used:
one with a blue foreground,
one with a green foreground.
But if I try to check for "blue" or "green", it is always returned "bad"...
I couldn't find the correct syntax for checking for the color names...
Could you please give me a hint?
Thanks a lot...
I'm trying to get the color name of the current item's foreground of a qlistwidget.
To set it I used:
self.listbox_medium.insertItem(0, "paper")
self.listbox_medium.item(0).setForeground(QColor("blue"))To get the color name I tried: def button_apply_selection_clicked(self):
if self.listbox_medium.currentItem().foreground().color().colorNames() == QColor("blue"):
print("okay")
else:
print("bad")In the listbox (qlistwidget) I've got 2 items:one with a blue foreground,
one with a green foreground.
But if I try to check for "blue" or "green", it is always returned "bad"...
I couldn't find the correct syntax for checking for the color names...
Could you please give me a hint?
Thanks a lot...
