How to remove icon from QMessageBox button
Unsolved
Qt for Python
-
-
@yashi95 said in How to remove icon from QMessageBox button:
How to remove icon in button form QMessageBox,
Try QMessageBox::NoIcon, if it works.
and how to change the place of yes no button as vise versa in messageBox
I don't think you can alter the order/layout of buttons. Write your own modal dialog if you really want this. EDIT Actually, you can't alter, but looks like you can start with no buttons and use
QMessageBox::addButton()
to add buttons with desired text and correct role, presumably it adds those left->right so try that. -
import sys from PySide2.QtCore import * from PySide2.QtGui import * from PySide2.QtWidgets import * class ErrorWindow(QMessageBox): def __init__(self, parent=None): QMessageBox.__init__(self, parent) self.setWindowTitle("Example") self.addButton(QPushButton("Yes"), QMessageBox.YesRole ) self.addButton(QPushButton("No"), QMessageBox.NoRole) self.addButton(QPushButton("Cancel"), QMessageBox.RejectRole) if __name__ == "__main__": app = QApplication(sys.argv) ex = ErrorWindow() ex.setText("some error") ex.show() sys.exit(app.exec_())
So, i am getting only "some error" on that dialog
-
Hi,
Which version of PySide2 are you using ?
On which platform ?