Python qt designer borderless window

hi all

i want create window with no caption and borders in maya (using designer)
and i want to load it as .ui

using python it is possible but i just wanted to know,

is it possible to design borderless window using pyqt designer?
i didnt find any option in designer which will allow to do things like that.

please help

regards
mossin

Not strictly through designer no, there’s no simple checkbox to enable it.

Here’s some simple code to enable the frame-less window, and set up a masking image in resizeEvent. I know you wanted to do it in designer, but seeing as that’s not possible right now I figured I’d give you something useful instead :slight_smile:


#in init: self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
#Make a rounded 8px rectangle to mask out the window
def resizeEvent(self, event):
	pixmap = QtGui.QPixmap(self.size())
	pixmap.fill(QtCore.Qt.transparent)
	painter = QtGui.QPainter(pixmap)
	painter.setBrush(QtCore.Qt.black)
	painter.drawRoundedRect(pixmap.rect(), 8, 8)
	painter.end()
		
	self.setMask(pixmap.mask())

hi nathan

thanks for your quick reply,

for some reason i want to create a borderless window in maya using QT (i dont want native look and feel of maya window)

so for example i m using shapedClock.py.
I want to run this widget inside maya (like native window)

for that i’ve removed
“app = QtGui.QApplication(sys.argv)” and "sys.exit(app.exec_()) "

i used your code and put it in the class

class ShapedClock(QtGui.QWidget):

def getMayaWindow():

          ptr = mui.MQtUtil.mainWindow()
          return sip.wrapinstance(long(ptr), QtCore.QObject)   
  

def __init__(self, parent =getMayaWindow()):

           super(ShapedClock, self).__init__(parent,
            QtCore.Qt.FramelessWindowHint |            QtCore.Qt.WindowSystemMenuHint)

i defined

global clock
clock = ShapedClock()

when i m running this code, shapedClock widget disappears.

How can i run this widget like native window in maya ?

or if u can suggest any other way for creating such window

thanks in advanced

regards
mossin

one more problem is how can i get top, left, width and height values of this widget? (same like native window)

got it, for overlapping widget on maya window

i replaced QWidget by QDialog and it worked !!!

for widget top, left, width, height

QWidget.pos(), QWidget.width(), QWidget.height()

i was looking for help since two weeks, i was not getting perfect answer

thanks Nathan for helping me…

i appreciate your reply

regards
Mossin

No problem, glad I could help!