PDA

View Full Version : Grooveshark.com like search bar



bittuthegr8
2nd February 2011, 07:58
what is the best way to implement the grooveshark.com search bar in Qt?

5851

i found a post on how to do it in HTML with CSS3
http://designindevelopment.com/css/grooveshark-search-with-css3/
maybe i could adapt the html version styles to a custom widget
but i am not sure how to start

should i implement a custom widget or use a QFrame or something else?

Lykurg
2nd February 2011, 08:08
should i implement a custom widget or use a QFrame or something else?I would go for a QLineEdit and do some custom drawings for the border. As for the image inside: there are at least two exapmles of doing so out there in the web.

bittuthegr8
2nd February 2011, 08:13
the border is a gradient and i dont know how to do that with a border
and the image inside is actually a functioning button

i was thinking that i use a QFrame with layout managed by a QHBoxLayout containing the QLineedit and QPushButton
and apply the nessary styles

Lykurg
2nd February 2011, 08:27
Well to compose it is hard, so go just strait to a custom widget. With a QLineEdit as base. Reimp the paint event and do all the border drawing there. For this have a look at QPainter, QPainterPath and QLinearGradient.

And my "image" meant to be button;) You can simple position a QPushButton absolute inside the custom widget.

bittuthegr8
2nd February 2011, 08:30
thanks i was not sure if to use a custom widget or not until now

Lykurg
2nd February 2011, 08:48
Ehm, just came in my mind: if you wish to use this border also somewhere else, better subclass a QWidget/QFrame, set its contentMargins to lets say 15px, then you could do your 15px-borderdrawings and put inside that border any widget you like (e.g. QLineEdit).