qtawesome icon indicating copy to clipboard operation
qtawesome copied to clipboard

Add support for Qt resource system

Open ozmartian opened this issue 8 years ago • 1 comments

Hi guys,

Just started using qtawesome as well as using qta.load_font() for some of my own custom made glyph font icons. This is when I realised load_font() will only work with physical files in a folder on the filesystem. Just throwing out the idea of enhancing this further to support the Qt resource system for bth the custom TTF font file and its corresponding charmap file. Along the lines of passing these two params as resource file paths via the ':' prefix. I'm currently getting around this limitation by copying the files out to a temp unique folder.

I realise this is no high priority suggestion as most people would be using thos for wat you're already bundling alone but if its quick and easy to do then I thought I should at least share the suggestion.

If no one is interested in doing this I can always fork and have a go at it myself to then share back for adoption.

Cheers!

ozmartian avatar Nov 22 '16 09:11 ozmartian

Am just browsing issues.... and this rings with me...

I've ended up with on almost all my apps in psuedo code

class Ico:
  open = "open.png"
  close = "mdi.this"
  favicon = "coprate.svg"

  @staticmethod
  def icon(name, color="#666666", scale=1.0):
     if name.endwith(".png|.svg|.jpg|.jpeg"):
        return QIcon.frompixmap .. << read file sys etc
    return qtawesome.icon(name, color, scale)
      
myWidget = QtWidgets.QToolButton()
myWidget.setIcon(Ico.icon(Ico.close)

At least Ico.close is on one place in python.. and dont use resource files for that reason

pedromorgan avatar May 04 '23 23:05 pedromorgan