I am trying to set tooltip display width with the following code but i am not getting the exact output?
-
http://developer.qt.nokia.com/doc/qt-4.8/stylesheet-reference.html search width.
@wid.setStyleSheet("QToolTip {font-size:12pt; color:white; border 2px solid black; min-width: 10px;}");@
-
[quote author="pratik041" date="1326368889"]@ wid.setStyleSheet("QToolTip {font-size:12pt; color:white; border-width:2px; border-style:solid; width: 10px;}");@
What is the error in the above code?[/quote]Well - that's the question: what is the error in the code above.
So, what is the error in the code above? Which result do you expect? Which result do you get instead?
-
i have tried this i am now getting the require width but another problem is their the tooltip text
is not visible.
i have used the following
@wid.setStyleSheet("QToolTip {font-size:12pt; color:white; border 2px solid black; min-width: 10px;}");
wid.settooltip("text");@ -
[quote author="Lukas Geyer" date="1326371764"][quote author="pratik041" date="1326368889"]@ wid.setStyleSheet("QToolTip {font-size:12pt; color:white; border-width:2px; border-style:solid; width: 10px;}");@
What is the error in the above code?[/quote]Well - that's the question: what is the error in the code above.
So, what is the error in the code above? Which result do you expect? Which result do you get instead?[/quote]
First thing is i want to set tooltip display rect to given width like if i set 40px width if the tooltip text exceeds the 40px it should display in the next line.
Secondly the error is i am not getting the width i set and the tooltip is also not showing only the blank tooltip rect is coming. -
[quote author="stima_ua" date="1326372218"]@QToolTip {
font-size:12pt;
color:white; --- Font color ----<<<< Attention!! use (pseudo code) background: ~white or color: ~white
border 2px solid black; --- border width, style, color
min-width: 10px;
@[/quote]but setting pseduo code the tooltip is displaying but width portion is not working i am using "max-width" instead of "min-width".
-
[quote author="stima_ua" date="1326374757"]@QString text = "Some text: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"@ --- its 1 line
You want:
.
| Some text: aaaa |
.
| aaaaaaaaaaaaaa |You need:
(pseudo code)@if ( text.size() > mySize ) {
text.insert(mySize, "\n")
}@Something like this.[/quote]
ya i want like this. Is it possible through stylesheet?
I can do this by inserting "\n" in the tooltip string but the problem is that i want to break string according to pixels width.Do you have any way for doing this? -
[quote author="stima_ua" date="1326376375"]hm...i think its possible, but i dont know how((;
p.s. If you find solution post him plz[/quote]
I have tried using QfontMetrices . Here i am able to find the total text pixel size but i don't able to find how to break it according to pixels size.
-
[quote author="joonhwan" date="1326405736"]After reading this post, I checked Qt doc and found.
bq. Rich text displayed in a tool tip is implicitly word-wrapped unless specified differently with <p >.
Hmm.. if your text is not wrapped, what was the problem then? wierd.[/quote]
I want to write a function where i will provide required text width in pixels and that function will set the tooltip display width to specified pixels width and the line exceeding it will be come to the next line.Can you say me what useful information you found in the doc related to this and How can i use that to achieve this with some example?