MCPcopy
hub / github.com/PyQt5/PyQt / SetImageSize

Method SetImageSize

QLabel/Lib/NinePatch.py:95–120  ·  view source on GitHub ↗
(self, width, height)

Source from the content-addressed store, hash-verified

93 painter.drawImage(x, y, self.CachedImage)
94
95 def SetImageSize(self, width, height):
96 resizeWidth = 0
97 resizeHeight = 0
98 for i in range(len(self.ResizeDistancesX)):
99 resizeWidth += self.ResizeDistancesX[i][1]
100
101 for i in range(len(self.ResizeDistancesY)):
102 resizeHeight += self.ResizeDistancesY[i][1]
103
104 if (width < (self.Image.width() - 2 - resizeWidth) and height < (
105 self.Image.height() - 2 - resizeHeight)):
106 raise ExceptionIncorrectWidthAndHeight(
107 self.Image.width() - 2, self.Image.height() - 2)
108
109 if (width < (self.Image.width() - 2 - resizeWidth)):
110 raise ExceptionIncorrectWidth(
111 self.Image.width() - 2, self.Image.height() - 2)
112
113 if (height < (self.Image.height() - 2 - resizeHeight)):
114 raise ExceptionIncorrectHeight(
115 self.Image.width() - 2, self.Image.height() - 2)
116
117 if (width != self.OldWidth or height != self.OldHeight):
118 self.OldWidth = width
119 self.OldHeight = height
120 self.UpdateCachedImage(width, height)
121
122 @classmethod
123 def GetContentAreaRect(self, width, height):

Callers 1

paintEventMethod · 0.80

Calls 6

UpdateCachedImageMethod · 0.95
widthMethod · 0.45
heightMethod · 0.45

Tested by

no test coverage detected