View Full Version : stylesheet
phillip_Qt
25th April 2008, 12:49
hi,
I need to apply frameShadow and framestyle to QLabel in a qss file.How to do that?
Plz help.
THRESHE
25th April 2008, 14:51
What seems to be the problem?
If you don't know how to apply your style sheet implemented in qss file you should do like this
QString labelStyle;
QFile file(":/images/Styles/LabelStyle.qss");
file.open(QIODevice::ReadOnly);
labelStyle = file.readAll();
file.close();
phillip_Qt
25th April 2008, 15:06
What seems to be the problem?
If you don't know how to apply your style sheet implemented in qss file you should do like this
QString labelStyle;
QFile file(":/images/Styles/LabelStyle.qss");
file.open(QIODevice::ReadOnly);
labelStyle = file.readAll();
file.close();
I'm applying the qss as above u've asked. my problem is that i need to apply frameshadow:Sunken to QLable .
How ll i apply thru qss file.
my code inside qss file is as follows.
QLabel
{
background-color: ash;
color: black;
font-family : MS Sans Serif;
font-size : 8px;
font-weight : normal;
}
THRESHE
25th April 2008, 15:13
I'm applying the qss as above u've asked. my problem is that i need to apply frameshadow:Sunken to QLable .
Why don't you just use QFrame::setFrameShadow (QFrame::Sunken) on your QLabel ?
aamer4yu
25th April 2008, 15:15
Am not sure if this will help -
QLabel{ color: palette(shadow); }
also have a look at frameshadow topic
phillip_Qt
25th April 2008, 15:42
Am not sure if this will help -
QLabel{ color: palette(shadow); }
also have a look at frameshadow topic
Thanx aamer. But its nt working. can u suggest any more idea?
phillip_Qt
25th April 2008, 15:44
Why don't you just use QFrame::setFrameShadow (QFrame::Sunken) on your QLabel ?
Hi. I applied in side qss file as
QLabel
{
QFrame::setFrameShadow (QFrame::Sunken)
}
still same problem. :(
Shadowfiend
25th April 2008, 16:40
Looks like you're out of luck in the sense that, by default, according to the docs:
Since 4.3, setting a stylesheet on a QLabel automatically sets the QFrame::frameStyle property to QFrame::StyledPanel.
Have you tried using a border? Something like:
QLabel
{
border: 1px inset gray;
}
Or something similar?
aamer4yu
25th April 2008, 16:58
aahhhh,,, u posted before me :P
I played with the stylesheet example in the QtDemo and made the following changes in code -
nameLabel->setFrameStyle(QFrame::StyledPanel);
and on running the application, i tried edit, and in the edit made the following change -
/* Mark mandatory fields with a brownish color. */
.mandatory {
color: brown;
border-width:2;
border-style: inset;
}
finally something :)
by the way, Philip, ur questions will make everyone expert in using stylesheets :D
THRESHE
25th April 2008, 17:00
Hi. I applied in side qss file as
QLabel
{
QFrame::setFrameShadow (QFrame::Sunken)
}
still same problem. :(
It may sound rude but are you familiar with Qt style sheets and Qt itself ?
What I wrote means that you should literally write in your program code. For instance
QLabel myLabel;
myLabel.setFrameShadow (QFrame::Sunken);
I hope it helps
phillip_Qt
27th April 2008, 06:29
aahhhh,,, u posted before me :P
I played with the stylesheet example in the QtDemo and made the following changes in code -
nameLabel->setFrameStyle(QFrame::StyledPanel);
and on running the application, i tried edit, and in the edit made the following change -
/* Mark mandatory fields with a brownish color. */
.mandatory {
color: brown;
border-width:2;
border-style: inset;
}
finally something :)
by the way, Philip, ur questions will make everyone expert in using stylesheets :D
Thank u aamer.
I'm a new bee in Qt. So really im intrested to learn from u peopls.
aamer4yu
27th April 2008, 19:11
I am neither an expert, I too learn from such postings.
believe me, i didnt knew the answer :D i had to search, glad i learned something new too.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.