On 04/06/14 17:12, André Somers wrote:
> Hamish Moffatt schreef op 4-6-2014 08:50:
>> Hi,
>>
>> We're displaying an error message with QMessageBox and we'd like to make
>> it easy for the user to copy the detailed text to the clipboard. I'd
>> like to add a button to do this, but I don't want to dismiss the dialog
>> at the same time.
>>
>> It looks like I can add any button with QMessageBox::addButton, but any
>> button will cause the message box to close. Is there another way?
>>
>> I'm aware that the detailed text has select/copy functions but that's
>> not very user friendly.
>>
> You could try to add the button, and then after adding disconnect all
> signals from it. Then connect your own copy-to-clipboard code to the
> clicked signal.
>
Thanks André, I implemented this as you described and it works fine.

Fortunately QMessageBox (actually its internal QDialogButtonBox) 
connects the clicked signal at the time of addButton(), so I can 
disconnect it again immediately and connect my code. Still, I feel a bit 
unclean :-)


Hamish
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to