Qt4-preview-feedback Archive, April 2007
QStyleSheet border-color
Message 1 in thread
Hi,
I looked at the documentation for the widgets that support this property but I
get no result when trying to set it like this:
widget->setStyleSheet(
"border-color: beige;");
Can you people reproduce this or maybe there is some problem on my side?
I'm using one of the latest 4.3 snapshots.
Paulo
To unsubscribe - send "unsubscribe" in the subject to qt4-preview-feedback-request@xxxxxxxxxxxxx
Message 2 in thread
On a related note, we could not change the
background color of QLineEdit by modifying
its Base color role or changing its palette,
but we were able to change it using
setStyleSheet().
Joe Newman
Synopsys, Inc.
-----Original Message-----
From: Paulo Moura Guedes [mailto:moura@xxxxxxxxxxxxx]
Sent: Thursday, April 26, 2007 8:03 AM
To: qt4-preview-feedback@xxxxxxxxxxxxx
Subject: QStyleSheet border-color
Hi,
I looked at the documentation for the widgets that support this property
but I
get no result when trying to set it like this:
widget->setStyleSheet(
"border-color: beige;");
Can you people reproduce this or maybe there is some problem on my side?
I'm using one of the latest 4.3 snapshots.
Paulo
To unsubscribe - send "unsubscribe" in the subject to
qt4-preview-feedback-request@xxxxxxxxxxxxx
To unsubscribe - send "unsubscribe" in the subject to qt4-preview-feedback-request@xxxxxxxxxxxxx
Message 3 in thread
Joe Newman wrote:
> On a related note, we could not change the
> background color of QLineEdit by modifying
> its Base color role or changing its palette,
Are you on Vista? If so, that is expected behavior. If not, can you give
us more information about the style/platform?
Girish
To unsubscribe - send "unsubscribe" in the subject to qt4-preview-feedback-request@xxxxxxxxxxxxx
Message 4 in thread
Paulo Moura Guedes wrote:
> Hi,
>
> I looked at the documentation for the widgets that support this property but I
> get no result when trying to set it like this:
>
> widget->setStyleSheet(
> "border-color: beige;");
>
> Can you people reproduce this or maybe there is some problem on my side?
>
By default, border-style is "native", which gives you the native look.
You will need to set the border-style and border-width to something, if
you want border properties to be respected.
Try this,
widget->setStyleSheet("border: 2px solid beige");
(of course, you can indvidually fine tune the width, style and color of
all edges using usual border-* properties)
That should solve the problem. If not, can you tell me what type
"widget" is?
Girish
To unsubscribe - send "unsubscribe" in the subject to qt4-preview-feedback-request@xxxxxxxxxxxxx
Message 5 in thread
On Thursday 26 April 2007 18:16, Girish Ramakrishnan wrote:
> Paulo Moura Guedes wrote:
> > Hi,
> >
> > I looked at the documentation for the widgets that support this property
> > but I get no result when trying to set it like this:
> >
> > widget->setStyleSheet(
> > "border-color: beige;");
> >
> > Can you people reproduce this or maybe there is some problem on my side?
>
> By default, border-style is "native", which gives you the native look.
> You will need to set the border-style and border-width to something, if
> you want border properties to be respected.
>
> Try this,
> widget->setStyleSheet("border: 2px solid beige");
> (of course, you can indvidually fine tune the width, style and color of
> all edges using usual border-* properties)
>
> That should solve the problem.
Yep, I can see a different border now. I didn't try with the "solid" property
and I must admit that since I updated Qt I forgot to specify the border
width.
> If not, can you tell me what type "widget" is?
I tried with several but the "one" is a QWidget which doesn't work, even with
your suggestion :(
Thanks
Paulo
P.S.: How does one go back to native border style, "border: native;"?
To unsubscribe - send "unsubscribe" in the subject to qt4-preview-feedback-request@xxxxxxxxxxxxx
Message 6 in thread
Hi,
Paulo Moura Guedes wrote:
> I tried with several but the "one" is a QWidget which doesn't work, even with
> your suggestion :(
>
If you want a QWidget with a border (frame), why not use a QFrame?
QWidget only supports background-* properties. You can always turn off
borders using border-style: none, in which case QFrame acts very much
like a plain QWidget. Also note that when you set a style sheet on a
QFrame you need to set the FrameStyle to StyledPanel (as documented).
> P.S.: How does one go back to native border style, "border: native;"?
In theory, "border-style: native" will work but it won't be documented
for 4.3. We suggest removing the Style Sheet instead.
Girish
To unsubscribe - send "unsubscribe" in the subject to qt4-preview-feedback-request@xxxxxxxxxxxxx
Message 7 in thread
On Friday 27 April 2007 08:44, Girish Ramakrishnan wrote:
> Hi,
>
> Paulo Moura Guedes wrote:
> > I tried with several but the "one" is a QWidget which doesn't work, even
> > with your suggestion :(
>
> If you want a QWidget with a border (frame), why not use a QFrame?
> QWidget only supports background-* properties. You can always turn off
> borders using border-style: none, in which case QFrame acts very much
> like a plain QWidget. Also note that when you set a style sheet on a
> QFrame you need to set the FrameStyle to StyledPanel (as documented).
Perfect, thans for the tip ;)
I set the stylesheet at the constructor and it's working perfectly.
Though, I'm having a problem. I need to change the stysheet dynamically, like
making the border blue at some point and later switch to normal. This doesn't
work. Something I'm missing?
> > P.S.: How does one go back to native border style, "border: native;"?
>
> In theory, "border-style: native" will work but it won't be documented
> for 4.3. We suggest removing the Style Sheet instead.
aka setStyleSheet("") ?
Paulo
To unsubscribe - send "unsubscribe" in the subject to qt4-preview-feedback-request@xxxxxxxxxxxxx
Message 8 in thread
Paulo Moura Guedes wrote:
> On Friday 27 April 2007 08:44, Girish Ramakrishnan wrote:
>> Hi,
>>
>> Paulo Moura Guedes wrote:
>>> I tried with several but the "one" is a QWidget which doesn't work, even
>>> with your suggestion :(
>> If you want a QWidget with a border (frame), why not use a QFrame?
>> QWidget only supports background-* properties. You can always turn off
>> borders using border-style: none, in which case QFrame acts very much
>> like a plain QWidget. Also note that when you set a style sheet on a
>> QFrame you need to set the FrameStyle to StyledPanel (as documented).
>
> Perfect, thans for the tip ;)
> I set the stylesheet at the constructor and it's working perfectly.
>
> Though, I'm having a problem. I need to change the stysheet dynamically, like
> making the border blue at some point and later switch to normal. This doesn't
> work. Something I'm missing?
>
Can you provide the stylesheet and the code? The Frame below provides a
color frame :)
class Frame : public QFrame
{
public:
Frame() { setFrameStyle(QFrame::StyledPanel);
setStyleSheet("border: 2px solid red"); startTimer(1000); }
protected:
void timerEvent(QTimerEvent *) {
static QStringList colors = QColor::colorNames();
int i = qrand() % colors.count();
setStyleSheet(QString("border: 2px solid ") + colors.value(i));
}
};
>>> P.S.: How does one go back to native border style, "border: native;"?
>> In theory, "border-style: native" will work but it won't be documented
>> for 4.3. We suggest removing the Style Sheet instead.
>
> aka setStyleSheet("") ?
>
Yes.
Girish
To unsubscribe - send "unsubscribe" in the subject to qt4-preview-feedback-request@xxxxxxxxxxxxx
Message 9 in thread
On Friday 27 April 2007 14:31, Girish Ramakrishnan wrote:
> Can you provide the stylesheet and the code? The Frame below provides a
> color frame :)
Yeah, it works for me.
I don't know what's going on. I'm just calling setStyleSheet like you do to a
QFrame:
resultsSearchBar->setStyleSheet(QString("border: 1px solid blue"));
It only works in the constructor of resultsSearchBar. The later calls to
setStyleSheet, whatever they are, make the frame to return to the default
border color. I notice some change in the border width because there is some
flicker though.
Paulo
To unsubscribe - send "unsubscribe" in the subject to qt4-preview-feedback-request@xxxxxxxxxxxxx
Message 10 in thread
Paulo Moura Guedes wrote:
> On Friday 27 April 2007 14:31, Girish Ramakrishnan wrote:
>> Can you provide the stylesheet and the code? The Frame below provides a
>> color frame :)
>
> Yeah, it works for me.
>
> I don't know what's going on. I'm just calling setStyleSheet like you do to a
> QFrame:
>
> resultsSearchBar->setStyleSheet(QString("border: 1px solid blue"));
>
> It only works in the constructor of resultsSearchBar. The later calls to
> setStyleSheet, whatever they are, make the frame to return to the default
> border color. I notice some change in the border width because there is some
> flicker though.
>
It's hard to tell what the problem is unless you can provide us a
minimal compilable example. Can you modify my example and somehow
reproduce the problem?
Girish
To unsubscribe - send "unsubscribe" in the subject to qt4-preview-feedback-request@xxxxxxxxxxxxx