Ok, now I have another problem regarding styles (less Qt bindings itself). I have listbox with Style set to lbOwnerDrawFixed and following procedure to draw item:<div><br></div><div><div>var</div><div> Bitmap: TBitmap; { temporary variable for the itemÄ‚Ë€â„Ës bitmap }</div>
<div> Offset: Integer; { text offset width }</div><div> s: string;</div><div> Pc: string;</div><div>begin</div><div>try</div><div> with lbPlaylist.Canvas do { draw on control canvas, not on the form }</div><div>
begin</div><div>// FillRect(TxtRect); { clear the rectangle }</div><div> Offset := 2;</div><div> lbPlaylist.Canvas.AutoRedraw:=true; { provide default offset }</div><div> Bitmap := TBitmap(lbPlaylist.Items.Objects[Index]); { get the bitmap }</div>
<div> if Bitmap <> nil then</div><div><br></div><div> begin</div><div> Draw(ARect.Left + Offset, ARect.Top, Bitmap); {render bitmap}</div><div> Offset := Bitmap.width + 6; { add four pixels between bitmap and text}</div>
<div> end;</div><div> if (not Self.FStopped) and (Index=CurrentIndex)and</div><div> (Playlist.GetItem(CurrentIndex)^.FileName=CurrentFile) then</div><div> Font.Style:=Font.Style+[fsBold] else</div><div> Font.Style:=Font.Style-[fsBold];</div>
<div><br></div><div> StrPCopy(Pc, Self.Playlist.GetItem(Index)^.FileName);</div><div> if not IsStream(Pc) then</div><div> s:=ProduceFormatedString(KSPMainWindow.FormatedPlayListInfo,</div><div> Self.Playlist.GetItem(Index)^.Tag,</div>
<div> GetDuration(Self.Playlist.GetItem(Index)^.Stream),</div><div> Index+1) else begin</div><div> if (KSPMainWindow.CurrentIndex=Index) and (Player.StreamInfo.Title<>'') then</div>
<div> s:=Format(SShoutcastEntry, [Player.StreamInfo.Title]) else</div><div> s:=Format(SShoutcastEntry, [Self.Playlist.GetItem(Index)^.FileName]);</div><div> end;</div><div> TextOut(ARect.Left + Offset, ARect.Top, s);//lbPlaylist.Items[Index]) { display the text }</div>
<div> end;</div><div>finally</div><div><br></div><div>end;</div><div><br></div><div>The style used by me is:</div><div><br></div><div><div> QTextEdit, QListView {</div><div> background-color: rgb(195, 195, 195);</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span> color: rgb(195, 195, 195);</div><div> background-attachment: fixed;</div><div> }</div><div> </div><div> QListView {</div><div> show-decoration-selected: 1; /* make the selection span the entire width of the view */</div>
<div> }</div><div><br></div><div> QListView::item {</div><div> background: #EEEEEE;</div><div> }</div><div><br></div><div> QListView::item:selected {</div><div> border: 1px solid #6a6ea9;</div><div> }</div><div><br>
</div><div> QListView::item:selected:!active {</div><div> background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,</div><div> stop: 0 #ABAFE5, stop: 1 #8588B2);</div><div> }</div><div><br>
</div><div> QListView::item:selected:active {</div><div> background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,</div><div> stop: 0 #6a6ea9, stop: 1 #888dd9);</div><div> }</div><div><br>
</div><div> QListView::item:hover {</div><div> background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,</div><div> stop: 0 #FAFBFE, stop: 1 #DCDEF1);</div><div> }</div><div><br></div><div>
Problem is that background itself is painted properly everywhere except where text goes. The same is about font.</div></div> <br><div class="gmail_quote">2009/11/7 zeljko <span dir="ltr"><<a href="mailto:zeljko@holobit.net">zeljko@holobit.net</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">On Friday 06 November 2009 20:07, Marcin Dębicki wrote:<br>
> Probably stupid questions but I can't really find an answer.<br>
><br>
> 1. How can I retrieve handle for my application so I can use<br>
> QApplication_setStyleSheet? Application is created visually with Lazarus.<br>
<br>
</div>QAppllication_setStyleSheet(QCoreApplication_instance(), @WStr) where WStr is<br>
widestring which contains stylesheet code.<br>
<div class="im"><br>
> 2. Second parameter for QApplication_setStyleSheet is stylesheet code,<br>
> right? For example:<br>
><br>
> QMainWindow::separator {<br>
> background: yellow;<br>
> width: 10px; /* when vertical */<br>
> height: 10px; /* when horizontal */<br>
> }<br>
><br>
> QMainWindow::separator:hover {<br>
> background: red;<br>
> }<br>
><br>
> Best regards,<br>
> Marcin Dębicki<br>
<br>
</div><div><div></div><div class="h5">_______________________________________________<br>
Qt mailing list<br>
<a href="mailto:Qt@lists.lazarus.freepascal.org">Qt@lists.lazarus.freepascal.org</a><br>
<a href="http://lists.lazarus.freepascal.org/mailman/listinfo/qt" target="_blank">http://lists.lazarus.freepascal.org/mailman/listinfo/qt</a><br>
</div></div></blockquote></div><br></div>