You Are Here:

Community: Wiki

This page was last modified on 30 October 2009, at 11:55.

Change SoftKey labels of widget in Qt

From Forum Nokia Wiki

Reviewer Approved   


ID ... Creation date July 1, 2009
Platform S60 3rd Edition, FP1, FP2
S60 5th Edition
Tested on devices Nokia 5800 XpressMusic
Category Qt for Symbian Subcategory UI


Keywords (APIs, classes, methods, functions): QWidget::setSoftKeys()

Overview

This code snippets shows how to change SoftKeyLabels of widget. Qt S60 Tower release added API for setting softkeys. QWidget::setSoftKeys() set the soft key label based on keyroles.

This snippet can be self-signed. As it does not use any API which require developer/certified signing.

Preconditions

Source code

QWidget* centralwidget = new QWidget(this);
centralwidget->setContextMenuPolicy(Qt::NoContextMenu);
setCentralWidget(centralwidget);
 
/* Add new softkey "MyOption" */
QAction* newOption = new QAction(tr("MyOption"), this);
/* set soft key for Options */
newOption->setSoftKeyRole(QAction::OptionsSoftKey);
 
/* Add new softkey "MyOption" */
QAction* newExit = new QAction(tr("MyExit"), this);
/* set soft key for Exit */
newExit->setSoftKeyRole(QAction::ExitSoftKey);
 
QList<QAction *> softKeys;
softKeys.append(newOption);
softKeys.append(newExit);
 
/* set new soft keys */
centralwidget->setSoftKeys(softKeys);
centralwidget->setFocus();

Postconditions

The code snippet is expected to show new softkey labels in Widget.

Image:Change_SoftKey_Label_Qt.JPG

Download Code Example


Related Wiki Articles

No related wiki articles found

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fwikiE2eforumE2enokiaE2ecomE2findeE78E2ephpE2fCreatingE5fTicE2dTacE2dToeE5fusingE5fE51tE5fforE5fSymbianX qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqfntypeZWikiContentQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtopicQUqfnTopicZE71tQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qfnZtypeQUqfntypeZWikiContentQ qfnZuserE5ftagQSxE71tX qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqfntypeZWikiContentQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ
User Rating: qfnZuserE5FratingQNx3E2E0000X