Using QtDesigner and Eric4, I create a statusBar using the command "Create Status Bar" on the popup menu, but I can't stylize the statusBar that I want to show and the default statusBar is not funny/beautiful itself, I make a code that imitates the look and fell I want to see... this is the code:<br>
==================<br>from PyQt4.QtGui import QMainWindow, QMessageBox, QIcon, QLabel, QFrame, QApplication<br>from PyQt4.QtCore import pyqtSignature, QRect, Qt<br><br><br>from Ui_Pro2MainWindow import Ui_Pro2MainWindow<br>
from Pro2Calc import Pro2CalcDialog<br>from Pro2Search import Pro2SearchDialog<br>from Pro2PasswChange import Pro2PasswChangeDialog<br>from db.database import Pro2db<br><br><br>class Pro2MainWindow(QMainWindow, Ui_Pro2MainWindow):<br>
"""<br> Class documentation goes here.<br> """<br> def __init__(self, user, passw, parent = None):<br> """<br> Constructor<br> """<br>
QMainWindow.__init__(self, parent)<br> self.setupUi(self)<br> self.setWindowIcon(QIcon(":images/images/mochila.png"))<br><br> # user and password and the connection of the MySQL database<br>
self.user = user<br> self.passw = passw<br> self.pro2db = Pro2db(str(self.user), str(self.passw))<br><br> # Here I use a QLabel to get user information from the database and stylize<br> infoLabel = QLabel(self.statusBar)<br>
infoLabel.setAlignment(Qt.AlignHCenter)<br> infoLabel.setFrameStyle(QFrame.Panel | QFrame.Sunken)<br><br> # Here I used the QApplication to hold the screen size and give a size to the statusBar<br> desktop = QApplication.desktop()<br>
resolution = desktop.screenGeometry()<br> infoLabel.setFixedWidth(resolution.width())<br><br> # Here the information is in statusBar<br> if user != 'root':<br> userInfo = self.pro2db.getUserInfo(user)<br>
message = "[<b>MATRÍCULA</b>: %s] | [<b>SERVIDOR</b>: %s] | [<b>SETOR</b>: %s]" % (userInfo[0], userInfo[1], userInfo[2])<br> self.statusBar.addPermanentWidget(infoLabel.setText(message))<br>
else:<br> self.statusBar.addPermanentWidget(infoLabel.setText(u"USUÁRIO: ADMINISTRADOR"))<br>==================<br><br>My question is: There's a way more simple than this? Using only the QtDesigner, for example to create this look & fell to a statusBar...<br>
<br>Best Regards,<br>Sandro Dutra,<br>Brazil;<br>