[Qt-interest] [QtS60-feedback] how to change the menu bar text in QT
Ramesh
ramesh.bs at robosoftin.com
Fri Mar 5 10:34:25 CET 2010
Thanks anttila,
I wanted the first and the last answers which you have sent.. thanks lot.
Regards,
Ramesh.
-----Original Message-----
From: Anttila Janne [mailto:Janne.Anttila at digia.com]
Sent: Friday, March 05, 2010 1:29 PM
To: Ramesh; qt-interest at trolltech.com; QtS60-feedback at trolltech.com
Subject: RE: [QtS60-feedback] how to change the menu bar text in QT
>
>How to change the menu bar name in QT?
>
I guess you mean the "Options" text in softkeys/cba in S60, which is added
automatically to launch QMainWindow menubar? If yes then your alternatives
are as follows:
1. Iterate through main window actions, and change the text of "Options"
action as follows:
foreach (QAction *action, actions()) {
if (action->text() == tr("Options"))
action->setText("Anything!");
}
2. Provide application specific translation to "Options" softkey.
Translation source (.ts) file would be something like:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.0" language="uk_UA">
<context>
<name>QSoftKeyManager</name>
<message>
<location filename="../src/gui/kernel/qsoftkeymanager.cpp"
line="+72"/>
<source>Options</source>
<translation>MyOwnText</translation>
</message>
</context>
</TS>
In addition you of course need to install the translator for application.
3. Provide your own left softkey and associate QMenu to something like this
(In this case QMainWindow menubar is not used):
menu = new QMenu(this);
menu->addAction(tr("Menu item 1"), this, SLOT(menuItemTriggered()));
ok = new QAction("MyMenu", this); // <-- "MyMenu goes to left softkey"
ok->setSoftKeyRole(QAction::PositiveSoftKey);
ok->setMenu(menu);
addAction(ok);
Br,
--
Janne Anttila
Senior Software Specialist
Digia Plc
Telecommunications
Sepänkatu 20, FIN - 90100 OULU
E-mail: janne.anttila at digia.com
Tel. +358 (0)403 073000 GSM: +358 (0)40 8474106
------------------------------------------------------------------
PRIVACY AND CONFIDENTIALITY NOTICE
This message and any attachments are intended only for use by the named
addressee and may contain privileged and/or confidential information. If you
are not the named addressee you should not disseminate, copy or take any
action in reliance on it. If you have received this message in error, please
contact the sender immediately and delete the message and any attachments
accompanying it. Digia Plc does not accept liability for any corruption,
interception, amendment, tampering or viruses occurring to this message.
-----------------------------------------------
Robosoft Technologies - Come home to Technology
Disclaimer: This email may contain confidential material. If you were not an intended recipient, please notify the sender and delete all copies. Emails to and from our network may be logged and monitored. This email and its attachments are scanned for virus by our scanners and are believed to be safe. However, no warranty is given that this email is free of malicious content or virus.
More information about the Qt-interest-old
mailing list