Question about QMessageBox obsolete members
-
Hi!
This is my first post in this comunity. I am beginning with Qt (porting my .Net Framework application) and I have a question. The official documentation marks some QMessageBox functions/methods as obsolete and I would like to know why. I am particulary talking about critical(), information(), question() and warning(). Do they use the obsolete function setButtonText()? I am interested in changing the texts of the buttons too, but I realized that I can do that using the setText() method of the QAbstractButton pointer that I get with messageBox.button().
Greetings and thanks!
-
Where did you see that those functions are obsolete? Also, if you want to use custom message boxes you should just use the QMessageBox class and not its static member functions. Have a look into the documentation "here":http://doc.qt.nokia.com/4.7/qmessagebox.html to see how that is done.
-
I saw it "here":http://doc.qt.nokia.com/4.7/qmessagebox-obsolete.html .
I know that I should use the class in order to customize it at maximum, but I would like to know why those functions are obsolete so I can write my own function without the same errors.Greetings and thanks!
-
These methods are old because they work on int values instead of StandardButton values for the various buttions. For all of them there are replacement methods that use StandardButton. The old ones are only kept to keep old code working.
-
I just saw they are not the same methods. Sorry.. I thought I checked this before.
This is solved now. Please excuse me for that stupid question.
Greetings!
-
No problem, you're welcome. Sometimes you can't see the wood for the trees - you're in good company :-)
-
Just another question (should I open another topic?).
How can I translate the "Show Details" and "Hide Details" button of a QMessageBox? Yesterday I found a post (in another forum I think) that modified the text when the button was clicked, but I don't think this is very good. How can I localizate Qt's texts?
Greetings and thanks again!
EDIT:
I just realized that I can install a qt translator with this:
qtTranslator.load("qt_" + QLocale::system().name(),
QLibraryInfo::location(QLibraryInfo::TranslationsPath));
And Spanish is included in the official package, so I don't think I have to translate it manually.Thanks!
-
I also used this solution... tnxs to everyone! The translations are great!!!
[quote author="Danielc" date="1307882204"]Just another question (should I open another topic?).
How can I translate the "Show Details" and "Hide Details" button of a QMessageBox? Yesterday I found a post (in another forum I think) that modified the text when the button was clicked, but I don't think this is very good. How can I localizate Qt's texts?
Greetings and thanks again!
EDIT:
I just realized that I can install a qt translator with this:
qtTranslator.load("qt_" + QLocale::system().name(),
QLibraryInfo::location(QLibraryInfo::TranslationsPath));
And Spanish is included in the official package, so I don't think I have to translate it manually.Thanks![/quote]