retext icon indicating copy to clipboard operation
retext copied to clipboard

Show link on hover

Open red-kite opened this issue 2 years ago • 2 comments

Please:

  • check that I'm doing right with super().__init__(parent)
  • verify and change positions of inserted code
  • eventually .setText('') additional to setVisible(False)
  • maybe test it :-)
  • …?

Thank you for creating and maintaining ReText!

red-kite avatar Oct 04 '23 20:10 red-kite

It does not look nice with dark themes: Screenshot

I recommend that you take colors from QPalette where possible, rather than hard-coding them. If QPalette doesn't have the needed colors, please define both light and dark versions, you can add them after this line: https://github.com/retext-project/retext/blob/adeba3840c434a0e59b86fc584161820cb94714e/ReText/editor.py#L54

mitya57 avatar Oct 07 '23 21:10 mitya57

So the only thing remaining is my comment about dark themes.

mitya57 avatar Oct 15 '23 21:10 mitya57

Please excuse being that quiet on this for so long. Thank you @mitya57 for guiding towards the solution via QPalette or hardcoded colors. I'd prefer latter for decent appearance with soft border and very little transparency (finetuning possible) …but ran into issues:

  • Figure out how to access editor's colors-dictionary (Use example in highlighter.py: from ReText.editor import getColor)
  • Use QColor in stylesheet of UrlPopup ('QColor' has no attribute 'HexArgb') -- Got a solution, a more elegant might exist.
  • Major: I can't test dark-mode (because I don't use such). I tried (again) in a gnome shell but only window decoration gets dark (stylesheet disabled)

Thanks to motivation by @donjan I tried some more and pushed https://github.com/retext-project/retext/pull/634/commits/8935a93595c6701c8b90e74eca6f3a0e4b86a012 for further use…

-> Help appreciated


Some alternative code (palette usage found on the internet last year, no alpha):

        self.setStyleSheet('''
            border: 1px solid palette(mid);
            border-radius: 3px;
            background: palette(base);
        ''')

Resources:

https://stackoverflow.com/a/2756376 suggests ("not to use the palette and go for Qt Style Sheet") https://stackoverflow.com/a/6876509 (long struggle to convert QColor to HexArgb!)

red-kite avatar Apr 01 '24 22:04 red-kite

see commit msg, note that dark-mode still not tested by me

unsure about position of hex_rgba() in file -- kept it close to it's class

(to-string-conversion of QColor could be part of getColor(colorName, rgba=False) but I don't like this because function gets blown up for other use)

red-kite avatar Apr 05 '24 22:04 red-kite

Thank you!

Tested with dark theme (QT_STYLE_OVERRIDE=Adwaita-Dark), it looks good!

Screenshot with Adwaita-Dark

Although, the transparency is barely visible, so maybe it's an overcomplication and using the palette color would be enough. But as you already implemented it this way, I did not change.

mitya57 avatar Apr 09 '24 12:04 mitya57