I succeeded to moved the QStatusBar to a specific location (repositioning), but when I hover I don't see the tips anymore. I tried QStatusBar.show()
or .setVisible(True)
but doesn't still work. How would you approach this. Thanks
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<widget name="__qt_fake_top_level">
<widget class="QPushButton" name="greetBTN">
<property name="geometry">
<rect>
<x>70</x>
<y>10</y>
<width>75</width>
<height>24</height>
</rect>
</property>
<property name="statusTip">
<string>Greeting people,...</string>
</property>
<property name="text">
<string>greet</string>
</property>
</widget>
<widget class="QWidget" name="gridLayoutWidget">
<property name="geometry">
<rect>
<x>30</x>
<y>40</y>
<width>241</width>
<height>80</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_status"/>
</widget>
<widget class="QPushButton" name="closeBTN">
<property name="geometry">
<rect>
<x>160</x>
<y>10</y>
<width>75</width>
<height>24</height>
</rect>
</property>
<property name="statusTip">
<string>About to close</string>
</property>
<property name="text">
<string>close</string>
</property>
</widget>
</widget>
<resources/>
</ui>
converted to Python
# -*- coding: utf-8 -*-
from PySide5.QtCore import *
from PySide5.QtGui import *
from PySide5.QtWidgets import *
class Ui_AppMainWindow(object):
def setupUi(self, AppMainWindow):
if not AppMainWindow.objectName():
AppMainWindow.setObjectName(u"AppMainWindow")
AppMainWindow.resize(303, 190)
self.centralwidget = QWidget(AppMainWindow)
self.centralwidget.setObjectName(u"centralwidget")
self.greetBTN = QPushButton(self.centralwidget)
self.greetBTN.setObjectName(u"greetBTN")
self.greetBTN.setGeometry(QRect(70, 10, 75, 24))
self.closeBTN = QPushButton(self.centralwidget)
self.closeBTN.setObjectName(u"closeBTN")
self.closeBTN.setGeometry(QRect(160, 10, 75, 24))
self.gridLayoutWidget = QWidget(self.centralwidget)
self.gridLayoutWidget.setObjectName(u"gridLayoutWidget")
self.gridLayoutWidget.setGeometry(QRect(30, 40, 241, 80))
self.gridLayout_status = QGridLayout(self.gridLayoutWidget)
self.gridLayout_status.setObjectName(u"gridLayout_status")
self.gridLayout_status.setContentsMargins(0, 0, 0, 0)
AppMainWindow.setCentralWidget(self.centralwidget)
self.statusbar = QStatusBar(AppMainWindow)
self.statusbar.setObjectName(u"statusbar")
AppMainWindow.setStatusBar(self.statusbar)
self.retranslateUi(AppMainWindow)
QMetaObject.connectSlotsByName(AppMainWindow)
# setupUi
def retranslateUi(self, AppMainWindow):
AppMainWindow.setWindowTitle(QCoreApplication.translate("AppMainWindow", u"MainWindow", None))
#if QT_CONFIG(statustip)
self.greetBTN.setStatusTip(QCoreApplication.translate("AppMainWindow", u"Greeting people,...", None))
#endif // QT_CONFIG(statustip)
self.greetBTN.setText(QCoreApplication.translate("AppMainWindow", u"greet", None))
#if QT_CONFIG(statustip)
self.closeBTN.setStatusTip(QCoreApplication.translate("AppMainWindow", u"About to close", None))
#endif // QT_CONFIG(statustip)
self.closeBTN.setText(QCoreApplication.translate("AppMainWindow", u"close", None))
# retranslateUi
from PyQt5 import QtWidgets, uic
from PyQt5.QtWidgets import *
import sys
from PySide6.QtCore import *
from PySide6.QtGui import *
from PySide6.QtWidgets import *
class Ui(QtWidgets.QMainWindow):
def __init__(self):
super(Ui, self).__init__()
uic.loadUi('Xuntitled.ui', self)
self.statusbar.setVisible(True)
self.statusbar.setStyleSheet('Background:red;')
self.statusbar.setParent(self)
#self.statusbar.showMessage('sqddsfdsfd') # works but if I hover, nothing !
self.statusbar.move(50, 25)
self.gridLayout_status.addWidget(self.statusbar, 1, 1)
self.show()
app = QtWidgets.QApplication(sys.argv)
window = Ui()
app.exec_()