95 painter.drawPixmap(0, 10, pix2) |
96 painter.drawPixmap(0, 10, pix2) |
96 painter.end() |
97 painter.end() |
97 return QIcon(pix1) |
98 return QIcon(pix1) |
98 |
99 |
99 |
100 |
|
101 def getCombinedIcon(keys, cache=pixCache): |
|
102 """ |
|
103 Module function to retrieve a symbolic link icon. |
|
104 |
|
105 @param keys list of names of icons (string) |
|
106 @param cache reference to the pixmap cache object (PixmapCache) |
|
107 @return the requested icon (QIcon) |
|
108 """ |
|
109 height = width = 0 |
|
110 pixmaps = [] |
|
111 for key in keys: |
|
112 pix = cache.getPixmap(key) |
|
113 if not pix.isNull(): |
|
114 height = max(height, pix.height()) |
|
115 width = max(width, pix.width()) |
|
116 pixmaps.append(pix) |
|
117 if pixmaps: |
|
118 pix = QPixmap(len(pixmaps) * width, height) |
|
119 pix.fill(Qt.transparent) |
|
120 painter = QPainter(pix) |
|
121 x = 0 |
|
122 for pixmap in pixmaps: |
|
123 painter.drawPixmap(x, 0, pixmap.scaled(QSize(width, height))) |
|
124 x += width |
|
125 painter.end() |
|
126 icon = QIcon(pix) |
|
127 else: |
|
128 icon = QIcon() |
|
129 return icon |
|
130 |
|
131 |
100 def addSearchPath(path, cache=pixCache): |
132 def addSearchPath(path, cache=pixCache): |
101 """ |
133 """ |
102 Module function to add a path to the search path. |
134 Module function to add a path to the search path. |
103 |
135 |
104 @param path path to add (string) |
136 @param path path to add (string) |