Qt 5.2 (QToolTip) Advice sought.

Post Reply
phasma
Posts: 191
Joined: Sat Aug 03, 2013 7:00 pm
Discord: phasma#4694

Qt 5.2 (QToolTip) Advice sought.

Post by phasma »

In short, is this possible? Currently, I employ a rather nasty method of just echoing my tooltips to a static label, but after going through the Qt reference, I came up with the following:
Code: [show] | [select all] lua
for _, t in ipairs(s) do
		vboxes.toggles[t]:setStyleSheet([[
			QLabel{
				border-color: rgb(70, 70, 70);	
				border-width: 3px;
				border-style: solid;
				image: url("]] .. imagedir .. t .. [[_on.png");
			}

			QLabel::hover{
				border-color: rgb(0, 238, 118);	
				border-width: 2px;
				border-style: solid;
				image: url("]] .. imagedir .. t .. [[_on.png");
			}

			QToolTip{
				color: #ffffff;
				background-color: #2a82da;
				border: 1px solid white; 
			}

			QToolTip::showText(100, "text", 100, QRect());
		]])
	end
Ideally, I'd want to pass the tooltip args via the hover method directly, but this being all new to me, I am not sure.

Assuming I am passing the method syntactically correctly, is this something that I could in fact get working or should I just drop it?

Thanks.

phasma
Posts: 191
Joined: Sat Aug 03, 2013 7:00 pm
Discord: phasma#4694

Re: Qt 5.2 (QToolTip) Advice sought.

Post by phasma »

Bumping this.

Has anybody done anything like this in Mudlet yet?

Regards.

User avatar
chris
Posts: 493
Joined: Fri Jun 17, 2011 5:39 am

Re: Qt 5.2 (QToolTip) Advice sought.

Post by chris »

Can you explain what you want done. It would be easier to see the goal and to tell you ways I know of doing it. There are also setLabelOnEnter and setLabelOnLeave functions that can link events to a label.

Stylesheets also will work, they rock. What is holding you

phasma
Posts: 191
Joined: Sat Aug 03, 2013 7:00 pm
Discord: phasma#4694

Re: Qt 5.2 (QToolTip) Advice sought.

Post by phasma »

It's just getting the tooltip to display. The current hover methods are fine. Regardless of what I try, they just never display.

User avatar
Vadi
Posts: 5042
Joined: Sat Mar 14, 2009 3:13 pm

Re: Qt 5.2 (QToolTip) Advice sought.

Post by Vadi »

I'm not sure 'QToolTip::showText' is valid in a stylesheet, where did you get that from?

phasma
Posts: 191
Joined: Sat Aug 03, 2013 7:00 pm
Discord: phasma#4694

Re: Qt 5.2 (QToolTip) Advice sought.

Post by phasma »

Was straight from the Qt docs: http://qt-project.org/doc/qt-4.8/qtooltip.html#showText

I am assuming that given we can pass QLabel{} we can pass similar things.

User avatar
Vadi
Posts: 5042
Joined: Sat Mar 14, 2009 3:13 pm

Re: Qt 5.2 (QToolTip) Advice sought.

Post by Vadi »

That's the C++ API.

We can pass QLabel because those are the various states it has. It doesn't mean we can actually call C++ code from a stylesheet.

phasma
Posts: 191
Joined: Sat Aug 03, 2013 7:00 pm
Discord: phasma#4694

Re: Qt 5.2 (QToolTip) Advice sought.

Post by phasma »

Ahh, gotcha. Thanks. Shame because proper tooltips would be awesome to have.

User avatar
chris
Posts: 493
Joined: Fri Jun 17, 2011 5:39 am

Re: Qt 5.2 (QToolTip) Advice sought.

Post by chris »

The qlabel bits should work, not the showtooltip stuff.

phasma
Posts: 191
Joined: Sat Aug 03, 2013 7:00 pm
Discord: phasma#4694

Re: Qt 5.2 (QToolTip) Advice sought.

Post by phasma »

Oh, yeah. The labels bits are fine. Been using them for a long time now.

Post Reply