def editNew(self):
     """
     Public slot to generate a new, empty image.
     """
     dlg = IconSizeDialog(self.__image.width(), self.__image.height())
     res = dlg.exec_()
     if res == QDialog.Accepted:
         width, height = dlg.getData()
         img = QImage(width, height, QImage.Format_ARGB32)
         img.fill(qRgba(0, 0, 0, 0))
         self.setIconImage(img)
 def editResize(self):
     """
     Public slot to resize the image.
     """
     dlg = IconSizeDialog(self.__image.width(), self.__image.height())
     res = dlg.exec_()
     if res == QDialog.Accepted:
         newWidth, newHeight = dlg.getData()
         if newWidth != self.__image.width() or newHeight != self.__image.height():
             cmd = IconEditCommand(self, self.trUtf8("Resize Image"), self.__image)
             img = self.__image.scaled(newWidth, newHeight, Qt.IgnoreAspectRatio, 
                                       Qt.SmoothTransformation)
             self.setIconImage(img)
             self.setDirty(True)
             self.__undoStack.push(cmd)
             cmd.setAfterImage(self.__image)