title: PyQt5 Moveable button causes screen smear
body: <p>User defined button that will hold an image and is moveable causes screen smearing when moved to the left and causes a screen smear to the right of the widget. Any ideas?</p>
  
  <p>Image of smearing to the right of the playing card - vertical grey lines.</p>
  
  <p>As i stated this only happens when moving the button to the left.</p>
  
  <p><img src="https://i.stack.imgur.com/kSM8T.png" alt="enter image description here"></p>
  
  <pre><code>#!/usr/bin/python3
  # -*- coding: utf-8 -*-
  
  
  from PyQt5.QtCore import *
  from PyQt5.QtGui import *
  from PyQt5.QtWidgets import *
  from functools import partial
  import datetime,psutil,sys
  
  class playingCard(QPushButton):
  
      def __init__(self, Text = '', parent = None):
          super(playingCard, self).__init__()
          self.ftop = 10
          self.fleft = 10
          self.fwidth = 87
          self.fheight = 124
          self.initUI()
  
      def initUI(self):
          self.setGeometry(self.fleft, self.ftop, self.fwidth+2, self.fheight+2)
          self.setText('')
          pixmap = QPixmap('clubs1.png')
          pixmap = pixmap.scaled(self.fwidth,self.fheight, Qt.KeepAspectRatio, Qt.FastTransformation)
          buttonicon = QIcon(pixmap)
          self.setIcon(buttonicon)
          self.setIconSize( QSize(self.fwidth,self.fheight))
          self.setFixedSize( QSize(self.fwidth+2,self.fheight+2))
  
      def mousePressEvent(self, event):
          self.__mousePressPos = None
          self.__mouseMovePos = None
          if event.button() == Qt.LeftButton:
              self.__mousePressPos = event.globalPos()
              self.__mouseMovePos = event.globalPos()
  
          super(playingCard, self).mousePressEvent(event)
  
      def mouseMoveEvent(self, event):
          if event.buttons() == Qt.LeftButton:
              # adjust offset from clicked point to origin of widget
              currPos = self.mapToGlobal(self.pos())
              globalPos = event.globalPos()
              diff = globalPos - self.__mouseMovePos
              newPos = self.mapFromGlobal(currPos + diff)
              self.move(newPos)
  
              self.__mouseMovePos = globalPos
  
          super(playingCard, self).mouseMoveEvent(event)
  
      def mouseReleaseEvent(self, event):
          if self.__mousePressPos is not None:
              moved = event.globalPos() - self.__mousePressPos 
              if moved.manhattanLength() &gt; 3:
                  event.ignore()
                  return
  
          super(playingCard, self).mouseReleaseEvent(event)
  
  
  class Example(QMainWindow):
  
      def __init__(self):
          super().__init__()
          self.initUI()
  
      def addAction(self,name,shortcut,status):
          self.actions[name] = QAction(name, self)
          self.actions[name].setShortcut(shortcut)
          self.actions[name].setStatusTip(status)
          if name == 'Exit':
              self.actions[name].triggered.connect( self.close )
          else:
              self.actions[name].triggered.connect( partial(self.viewEvent,name) )
  
      def hastab(self,tabname):
          return self.tabWidget.findChild(QWidget, tabname) != None
  
      def ontab(self,tabname):
          currentIndex = self.tabWidget.currentIndex()
          currentTitle = self.tabWidget.tabText(currentIndex)  
          return tabname == currentTitle
  
  
      def gettab(self,tabname):
          page = self.tabWidget.findChild(QWidget, tabname) 
          return self.tabWidget.indexOf(page)
  
      def initUI(self):               
          self.actions = dict()       # holds the QActions
          self.tabs = dict()
  
          self.tabWidget = QTabWidget()
          self.tabWidget.setTabsClosable(True)
          self.tabWidget.tabCloseRequested.connect(self.closeTab)
          self.setCentralWidget(self.tabWidget)
  
          self.addAction('Exit', 'Ctrl+Q','Exit application')
          self.addAction('Game','Ctrl+G','Game')
  
          self.statusBar()
  
          menubar = self.menuBar()
          fileMenu = menubar.addMenu('&amp;File')
  
          fileMenu.addAction( self.actions['Game'] )
          fileMenu.addAction( self.actions['Exit'] )
  
          self.setWindowTitle('Main window')
          self.showMaximized()
  
      def closeTab (self, currentIndex):
          currentQWidget = self.tabWidget.widget(currentIndex)
          title=self.tabWidget.tabText(currentIndex)
          currentQWidget.deleteLater()
          self.tabWidget.removeTab(currentIndex)
  
          del self.tabs[title]
          del self.tables[title]
          self.timers[title].stop()
          del self.timers[title]
  
      def keyPressEvent(self, e):  
  
          currentIndex=self.tabWidget.currentIndex()
          title = None
          if currentIndex != -1:
              title=self.tabWidget.tabText(currentIndex)
  
          if e.key() == Qt.Key_F11:
              if self.isMaximized():
                  self.showNormal()
              else:
                  self.showMaximized()
  
      def viewEvent(self, name):
          if name in self.tabs:
              return
  
          self.tabs[name] = QWidget()
  
          vbox = QVBoxLayout()
          vbox.addWidget( playingCard() )
  
  
          # Add box layout, add table to box layout and add box layout to widget
          self.tabs[name].layout = vbox
          self.tabs[name].setLayout(self.tabs[name].layout) 
          self.tabWidget.addTab(self.tabs[name],name)
  
      def closeEvent(self, event):
  
          reply = QMessageBox.question(self, 'Message',
              "Are you sure to quit?", QMessageBox.Yes | 
              QMessageBox.No, QMessageBox.No)
  
          if reply == QMessageBox.Yes:
              event.accept()
          else:
              event.ignore()  
  
  if __name__ == '__main__':
  
      app = QApplication(sys.argv)
      ex = Example()
      sys.exit(app.exec_())
  </code></pre>