[Qt-interest] any planned improvement to QMessageBox interfaces?
Ross Bencina
rossb-lists at audiomulch.com
Thu Nov 5 04:23:51 CET 2009
Hi
I'm planning to improve my app by replacing the standard Yes/No/Cancel
buttons in all my QMessageBox calls with context specific verbs as per
current user interface guidelines. eg
http://www.usabilitypost.com/2008/08/30/usability-tip-use-verbs-as-labels-on-buttons/
http://msdn.microsoft.com/en-us/library/aa511268.aspx#respondMainInstruction
I know I can do this with Qt4.5 by explicitly instantiating a QMessageBox
and then using something like:
QMessageBox messageBox(...);
messageBox->button(QMessageBox::Yes)->setText("Erase the Hard Disk");
messageBox->button(QMessageBox::No)->setText("Don't erase the Hard Disk");
if( messageBox->exec() == QMessageBox::Yes ){
eraseTheHardDisk();
}
But at the moment I'm using the (very convenient) static functions
(QMessageBox::question() et al) so its quite a bit of work to rework all my
code to use non-static message boxes.
Before I decide how to proceed I would like to know if there are plans to
support customising message box button texts via the the static message box
functions in Qt 4.6 or in the future?
Perhaps there is a cleaner way to do it, but I'm imagining something like:
if( QMessageBox::question( 0, "MyApp", "Do you want to erase the Hard
Disk?",
QMessageBox::NamedStandardButtonList()
<< QMessageBox::NamedStandardButton( QMessageBox::Yes,
"Erase the Hard Disk" )
<< QMessageBox::NamedStandardButton( QMessageBox::No, "Don't
erase the Hard Disk" ),
/* default= */ QMessageBox::No ) == QMessageBox::Yes ){
eraseTheHardDisk();
}
Is this planned or should I rewrite to the first way?
Thanks!
Ross.
More information about the Qt-interest-old
mailing list