These tips are the way to solve the same problem with PySide as below! http://qiita.com/soramimi_jp/items/3d4e800e3d86ed216deb
Let's create a class that does not forcibly spread with PySide.
StatusLabel.py
# -*- coding: utf-8 -*-
from PySide import QtGui
class StatusLabel(QtGui.QLabel):
def __init__(self,parent=None):
super(StatusLabel,self).__init__(parent)
def minimumSizeHint(self):
sz = QtGui.QLabel.minimumSizeHint(self)
sz.setWidth(0)
return sz
Let's use it nicely in the main window.
mainwindow.py
# -*- coding: utf-8 -*-
from StatusLabel import StatusLabel
class MainWindow(QtGui.QMainWindow,Ui_MainWindow):
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
self.setupUi(self)
self.statuslabel = StatusLabel("a long text......")
self.statusBar.addWidget(self.statuslabel)
That's it.
It doesn't matter, but it's hard to go back and forth between C (++) and Python. ..