2013-09-08 2 views
1

정의는 QtGui.QMessageBox.information() 함수는 다음 상수를 사용하여, 많은 푸시 버튼이있는 대화 상자를 만드는 데 사용할 수 있습니다 : 그것은 많은 기능을 지원QtGui.QMessageBox.information 당신에게 doucmentation를 따라

QMessageBox.Ok An “OK” button defined with the AcceptRole . 
QMessageBox.Open A “Open” button defined with the AcceptRole . 
QMessageBox.Save A “Save” button defined with the AcceptRole . 
QMessageBox.Cancel A “Cancel” button defined with the RejectRole . 
QMessageBox.Close A “Close” button defined with the RejectRole . 
QMessageBox.Discard  A “Discard” or “Don’t Save” button, depending on the platform, defined with the DestructiveRole . 
QMessageBox.Apply An “Apply” button defined with the ApplyRole . 
QMessageBox.Reset A “Reset” button defined with the ResetRole . 
QMessageBox.RestoreDefaults  A “Restore Defaults” button defined with the ResetRole . 
QMessageBox.Help A “Help” button defined with the HelpRole . 
QMessageBox.SaveAll  A “Save All” button defined with the AcceptRole . 
QMessageBox.Yes  A “Yes” button defined with the YesRole . 
QMessageBox.YesToAll A “Yes to All” button defined with the YesRole . 
QMessageBox.No A “No” button defined with the NoRole . 
QMessageBox.NoToAll  A “No to All” button defined with the NoRole . 
QMessageBox.Abort An “Abort” button defined with the RejectRole . 
QMessageBox.Retry A “Retry” button defined with the AcceptRole . 
QMessageBox.Ignore An “Ignore” button defined with the AcceptRole . 
QMessageBox.NoButton An invalid button. 

.

QMessageBox 클래스의 설명서를 사용했습니다.

내 질문은입니다. 메시지 상자에서 누름 단추의 텍스트를 어떻게 변경합니까?

+0

당신은 질문'pyqt' 태그하지만 문서는 PySide''입니다 ...하는 둘 중 당신이 사용하고 있습니까? 'PySide'이 ... – Bakuriu

답변

4

QMessageBox::setButtonText이 필요합니다.

편집 :이 지적 Bakuriu-

감사합니다.

Qt4.3 또는 이전 버전에 대해 컴파일 PyQt는/PySide 라이브러리와 함께 사용할 때 작동합니다 위에서 언급 한 setButtonText 방법. Source.

그리고 이후 버전

는, 버튼의 텍스트를 변경하는 것은 포함합니다 :

button = messageBox.button(which)

button.setText(text)

+1

이 또한'PySide'에서 제공하지 않는 동안 사실'PyQt' 문서는'setButtonText' 방법을 언급? ('PyQt'의 문서는 않지만) 문서는이 방법을 나열하지 않습니다. – Bakuriu

+0

@Bakuriu [this] (http://qt.gitorious.org/pyside/pyside/source/d2a47ab8f27af7e74d34797464da85c128c17c37:PySide/QtGui/typesystem_gui_common.xml#L4317)에 기초하여 @Bakuriu가 추측되었지만 문서화되지 않았습니다. 답변이 업데이트되었습니다. 멋지다. –

관련 문제