Frage

I have found quite a few questions about doing this in C++, but none about doing it in Python/PySide. I want to remove the '?' button
enter image description here
from the top of my QDialog. I know I will use setWindowFlags(), however I don't know what I should pass as arguments.

War es hilfreich?

Lösung 2

Based on How can I hide/delete the "?" help button on the "title bar" of a Qt Dialog? you can do this:

from PySide import QtGui, QtCore
app = QtGui.QApplication([])
d = QtGui.QDialog(None, QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowTitleHint)
d.exec_()

Andere Tipps

The following works correctly without modifying other flags:

self.setWindowFlags(self.windowFlags()
                    ^ QtCore.Qt.WindowContextHelpButtonHint)

I create a Dialog inherited from QDialog, and write the following code in init function.

self.setWindowFlags(self.windowFlags() ^ Qt.WindowStaysOnTopHint)

The question button on title bar is gone

ps. My program is based on PySide 1.2.1 and Python 3.3

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top