Hi,
I'm new to Qt and I would like to be able to modify a QPushButton text with a mouse right click. I've created a subclass to handle right click, but I can't find any way to edit the text. I would apreciate any advice.
Thanks,
Olivier
Hi,
I'm new to Qt and I would like to be able to modify a QPushButton text with a mouse right click. I've created a subclass to handle right click, but I can't find any way to edit the text. I would apreciate any advice.
Thanks,
Olivier
Signals and slots.
And a text input box
Do you want to programmatically change the text or do you want the user to be able to specify the text? The latter is handled using the above posters method, the former is much more simple and can be seen below :
Qt Code:
//inside right-click handling code button->setText(desiredText)To copy to clipboard, switch view to plain text mode
Last edited by QtWannabe; 8th December 2010 at 16:09.
Thanks for your replys. I want the user to change the text. I already handled the right click signal, but I don't know what to do with the "text input box"...
With the text input box you ask for the new text.
When the user clicks ok, you set button text to the new text.
Ah k. Didn't think about a pop up. This can do the job. I was thinking about editing the text directly like it is done in a edit box, but maybe it is not necessary...
Thanks.
You can show a line edit above the button, but I don't find this elegant.
Bookmarks