mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-12 07:04:12 +02:00
Let the Collections and Projects panels follow the palette
Both panels forced a light palette on themselves (white rows, black text, their own selection blue) so that element previews, which are black line art drawn for the white sheet, would stay visible on a dark desktop (bugtracker 335). On a dark palette the two docks were the only white windows left. The forced palettes are gone. Element previews are now kept as drawn, on a transparent background, and adapted where they are shown: ElementPreviewDelegate, installed on the collection tree, hands the view a copy with its lightness inverted when the palette is dark (QET::Palette::forPalette), so black ink becomes the palette's light gray while colored icons such as folders stay as they are; the drag pixmap is adapted the same way. A light palette shows the previews untouched. This fixes bugtracker 335 on every dark desktop rather than masking it with a white panel. The preview cache stored the old white-sheet pictures; it records the format now and drops a cache written before this change once. The amber "show this directory" highlight sets black text so it reads on both palettes. The Projects panel only shows icons from the icon theme, which has a dark variant, so nothing else changes there. tests/qttest/tst_qetpalette: the line-art rule tells ink from color; inversion keeps hue and alpha; a preview reads at 3:1 on the Base color of both palettes; in a tree on the dark palette the delegate inverts a line-art icon and leaves a colored one alone. Fixes #945.
This commit is contained in:
@@ -146,12 +146,13 @@ QPixmap ElementPictureFactory::pixmap(const ElementsLocation &location)
|
||||
QPixmap pix(w, h);
|
||||
//Element definitions almost always draw with a hardcoded black
|
||||
//stroke color, on the assumption of the white diagram sheet they
|
||||
//are normally placed on. A transparent background here makes
|
||||
//that stroke disappear against a dark widget/tree-view background
|
||||
//(bugtracker #335). Give it an opaque white background instead -
|
||||
//exactly what the element already assumes visually, in every
|
||||
//context this pixmap is used (tree icons, drag icon, previews).
|
||||
pix.fill(Qt::white);
|
||||
//are normally placed on. The pixmap is kept as drawn, on a
|
||||
//transparent background: the places that show it (the
|
||||
//collection tree through ElementPreviewDelegate, the drag icon)
|
||||
//adapt it to the palette with QET::Palette::forPalette(), so a
|
||||
//dark palette gets light ink instead of black on black
|
||||
//(bugtracker #335).
|
||||
pix.fill(Qt::transparent);
|
||||
|
||||
QPainter painter(&pix);
|
||||
painter.setRenderHint(QPainter::Antialiasing, true);
|
||||
|
||||
Reference in New Issue
Block a user