With a window generated by a QDialog with QT Designer there is a '?' button on the window title bar. How do you connect this button to a html file that displays help information? I expected that there would be an object within QT Designer that references the '?' button, but, I can't locate it.
I do not understand why you want to use the button, but if you want to detect the click event and assuming you are in Windows then a possible solution is to use the nativeEvent()
method since that element depends on each platform:
import ctypes.wintypes
import win32con
from PyQt5 import QtWidgets
class Dialog(QtWidgets.QDialog):
def nativeEvent(self, eventType, message):
msg = ctypes.wintypes.MSG.from_address(message.__int__())
if eventType == "windows_generic_MSG":
if msg.message == win32con.WM_NCLBUTTONDOWN:
print("Hello World")
return super(Dialog, self).nativeEvent(eventType, message)
if __name__ == '__main__':
import sys
app = QtWidgets.QApplication(sys.argv)
w = Dialog()
w.exec_()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.