def fixSizePolicy(size, hint, policy):
 (width, height) = (hint.width(), hint.height())
 expanding = policy.expandingDirections()
 (hpolicy, vpolicy) = (policy.horizontalPolicy(), policy.verticalPolicy())
 if (expanding & Qt.Horizontal):
  width = max(width, size.width())
 if (hpolicy == QSizePolicy.Maximum):
  width = min(width, size.width())
 if (expanding & Qt.Vertical):
  height = max(height, size.height())
 if (vpolicy == QSizePolicy.Maximum):
  height = min(height, hint.height())
 return QSize(width, height).boundedTo(size)

def fixSizePolicy ( size , hint , policy ) : ( width , height ) = ( hint . width ( ) , hint . height ( ) ) expanding = policy . expandingDirections ( ) ( hpolicy , vpolicy ) = ( policy . horizontalPolicy ( ) , policy . verticalPolicy ( ) ) if ( expanding & Qt . Horizontal ) : width = max ( width , size . width ( ) ) if ( hpolicy == QSizePolicy . Maximum ) : width = min ( width , size . width ( ) ) if ( expanding & Qt . Vertical ) : height = max ( height , size . height ( ) ) if ( vpolicy == QSizePolicy . Maximum ) : height = min ( height , hint . height ( ) ) return QSize ( width , height ) . boundedTo ( size )
fix size so it conforms to the size policy and the given size hint .