Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 4

Qt-interest Archive, April 2007
QDateTimeEdit and Style Sheets


Message 1 in thread

Hi

I need Style Sheets to style QDateTimeEdit and the drop-down indication
isn't anymore working if I style them except that the styled image is shown.
Maybe there is a work around? Anyway is there a way to define gradients in
Style Sheets? The only way I see is to write my own QStyle.

thanks and regards

Marco

Message 2 in thread

Marco Bubke wrote:
> Hi
> 
> I need Style Sheets to style QDateTimeEdit and the drop-down indication 
> isn't anymore working if I style them except that the styled image is 
> shown. 

Please provide the Style Sheet you are using.

Girish

--
 [ signature omitted ] 

Message 3 in thread

> I need Style Sheets to style QDateTimeEdit and the drop-down
indication
> isn't anymore working if I style them except that the styled image is
> shown.

I've reported a similar bug with QAbstractSpinbox. it seems you can
style the look, but the clickable areas stay unaffected by the style
sheets.

http://www.trolltech.com/developer/task-tracker/index_html?method=entry&;
id=152605

Cheers,
Peter

--
 [ signature omitted ] 

Message 4 in thread

Hi,
> Here the style code:
> 
> QDateTimeEdit::drop-down {
>   image: url(:/combobox_arrow_normal);
>   subcontrol-position: right center;
> }
> 
> Its working with QComboBox so I think its all right. I see the arrow but there is no calendar popup.

Since width/height is not explicitly provided, the drop-down gets the 
width and height from the "image" element. I am not sure how the image 
looks so I am not sure whether the style sheet above is correct or not.

Try something like this,
QDateTimeEdit {
   padding-right: 20px; /* leave some spacing for the drop-down */
}

QDateTimeEdit::drop-down {
   background: blue;
   width: 20px;
   subcontrol-position: right center;
}

Girish

--
 [ signature omitted ] 

Message 5 in thread

Girish wrote:
> Since width/height is not explicitly provided, the drop-down gets the
> width and height from the "image" element. I am not sure how the image
> looks so I am not sure whether the style sheet above is correct or
not.
> 
> Try something like this,
> QDateTimeEdit {
>    padding-right: 20px; /* leave some spacing for the drop-down */
> }
> 
> QDateTimeEdit::drop-down {
>    background: blue;
>    width: 20px;
>    subcontrol-position: right center;
> }

i tried exactly that with a QSpinBox, the problem i encountered was that
i can move the arrows around like i want (try putting an element on the
left side) and visually it looks correct, but the clickable area stays
at the original place, even if nothing is drawn there anymore. i gave up
on style sheets since i encountered this, waiting for a fix, which is
scheduled for qt4.4 (issue #152605 in TT), so it's not going to happen
anytime soon.

Cheers,
Peter

--
 [ signature omitted ] 

Message 6 in thread

> i tried exactly that with a QSpinBox, the problem i encountered was
that
> i can move the arrows around like i want (try putting an element on
the
> left side) and visually it looks correct, but the clickable area stays
> at the original place, even if nothing is drawn there anymore. i gave
up
> on style sheets since i encountered this, waiting for a fix, which is
> scheduled for qt4.4 (issue #152605 in TT), so it's not going to happen
> anytime soon.

here is some example code to show this (use with the style sheet
example):

QSpinBox {
   padding-left: 20px; /* leave some spacing */
   padding-right: 20px; /* to show the clickable areas stay on this side
*/
}

QSpinBox::up-arrow {
   background: red;
   width: 20px;
   subcontrol-position: left center;
}

QSpinBox::down-arrow {
   background: green;
   width: 20px;
   subcontrol-position: left center;
}

the subcontrols show up on the left side (hmm i notice it doesnt matter
if i put them center, top or bottom, another bug?) but the clickable
areas stay to the right of the number.

Cheers
Peter
 

--
 [ signature omitted ] 

Message 7 in thread

Peter Prade wrote:
> the subcontrols show up on the left side (hmm i notice it doesnt matter
> if i put them center, top or bottom, another bug?) but the clickable
> areas stay to the right of the number.
> 

I was able to reproduce this. This is now fixed in the 4.3 snapshots.

Thanks for the report!
Girish

--
 [ signature omitted ]