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