You Are Here:

Community: Wiki

This page was last modified on 30 October 2009, at 15:44.

How to make a stylesheet in Qt for Symbian. Part 2

From Forum Nokia Wiki



ID ... Creation date 06 January 2009
Platform S60 3rd Edition FP1, S60 3rd Edition FP2, S60 5th Edition Tested on devices Emulator
Category Qt for Symbian Subcategory Stylesheet


Keywords (APIs, classes, methods, functions): stylesheet, Push Button, Text Label
Reviewer Approved   

Overview

This code snippet demonstrates how to create a stylesheet using a Qt designer in Carbide 2.0 . Advantage of using Qt designer is that it shows the preview as soon as you change the style. When you apply a style to a window or application the style will affect all the widget in application.

Preconditions


Procedure for creating a style

  • Create a new Qt project
 file->new->Qt project->GUI Widget
  • Add the Widgets using the Widget box and arrange them in a layout.
  • Right click on any of the widget and select the change stylesheet.

Image:Qtstylestep1.jpg

  • Now Type the code given below in the new window.
 QPushButton {
 border: 2px solid #8f8f91;     
 border-radius: 6px;     
 background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,stop: 0 #f6f7fa, stop: 1 #dadbde);     
 min-width: 80px; }

Image:Qtstylestep2.jpg

  • Now One by one click on the each widget and change the stylesheet. Write the following code for the lineedit and Frame.
 QLineEdit {     
 border: 2px solid gray;     
 border-radius: 10px;     
 padding: 0 8px;     
 background: yellow;     
 selection-background-color: darkgray;
  }

Image:Qtstylestep3.jpg

  • Write the following code for the frame.
 QFrame
 {
 border: 2px solid green;   
 border-radius: 4px;     
 padding: 2px;    
 background-color: rgb(125,125,30);
 }

Image:Qtstylestep4.jpg

Screenshot

  • Generated Style

Image:Qtstyle.jpg

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