You Are Here:

Community: Wiki

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

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

From Forum Nokia Wiki


Reviewer Approved   



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): setStylesheet, Push Button, Text Label

Overview

This code snippet demonstrates how to create a stylesheet and apply the style to the individual widget in Qt for S60.

Preconditions

Main Function

  • This is use to set the style of widget
win->setStyleSheet("* { color: #676767;border-style:dashed ; border-width: 4px; bord er-  color: #00FFFF; padding: 7px}}");


Source File

#include <QApplication>
#include <QPushButton>
#include <QLabel>
#include <QWidget>
#include <QVBoxLayout>
#include<QLineEdit>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QWidget *win = new QWidget;
QVBoxLayout *layout = new QVBoxLayout;
QPushButton *button = new QPushButton("Click");
QLabel *label = new QLabel("Hello");
QLineEdit *line=new QLineEdit();
win->setStyleSheet("* { color: #676767;border-style:dashed ; border-width: 4px; border-color: #00FFFF; padding: 7px}}");
button->setStyleSheet("* { background-color: rgb(255,125,100) }");
label->setStyleSheet("* { background-color: blue }");
line->setStyleSheet("*{background-color:yellow}");
layout->addWidget(label);
 
layout->addWidget(button);
layout->addWidget(line);
win->setLayout(layout);
win->showMaximized();
return app.exec();
}

ScreenShot

Image:Style1.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: qdcZidentifierQSxhttpE3aE2fE2fwikiE2eforumE2enokiaE2ecomE2findeE78E2ephpE2fChangingE5fprofileE5fprogrammaticallyE5finE5fE51tX 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