Example #1
0
 def paintEvent(self, event):
     """
     Protected method called when some painting is required.
     
     @param event reference to the paint event (QPaintEvent)
     """
     if self.length(self.__path) > self.contentsRect().width():
         super(E5SqueezeLabelPath, self).setText(
             self.__surrounding.format(
                 compactPath(self.__path,
                             self.contentsRect().width(), self.length)))
     else:
         super(E5SqueezeLabelPath,
               self).setText(self.__surrounding.format(self.__path))
     super(E5SqueezeLabelPath, self).paintEvent(event)
 def paintEvent(self, event):
     """
     Protected method called when some painting is required.
     
     @param event reference to the paint event (QPaintEvent)
     """
     fm = self.fontMetrics()
     if fm.width(self.__surrounding.arg(self.__path)) > self.contentsRect().width():
         QLabel.setText(self, 
             self.__surrounding.arg(compactPath(unicode(self.__path), 
                                    self.contentsRect().width(), 
                                    self.length))
         )
     else:
         QLabel.setText(self, self.__surrounding.arg(self.__path))
     QLabel.paintEvent(self, event)
Example #3
0
 def paintEvent(self, event):
     """
     Protected method called when some painting is required.
     
     @param event reference to the paint event (QPaintEvent)
     """
     fm = self.fontMetrics()
     if (fm.width(self.__surrounding.format(self.__path)) >
             self.contentsRect().width()):
         super(E5SqueezeLabelPath, self).setText(
             self.__surrounding.format(compactPath(self.__path,
                                       self.contentsRect().width(),
                                       self.length))
         )
     else:
         super(E5SqueezeLabelPath, self).setText(
             self.__surrounding.format(self.__path))
     super(E5SqueezeLabelPath, self).paintEvent(event)