setStyleSheet question

Post Reply
horsethief
Posts: 4
Joined: Thu May 15, 2014 12:18 am

setStyleSheet question

Post by horsethief »

Hello,

I was trying to set the background image of a label using css. I would like to position the image either with the css property "background", or "background-position". My problem is that QT style sheets only seem to accept "top, bottom, left, right and center" for its attributes.

Does anyone know of any tricks to use pixel positioning. EG: background-position: 50px 100px; -- or is this just not possible?

Thanks in advance

azure_glass
Posts: 97
Joined: Wed Jul 25, 2012 12:35 pm

Re: setStyleSheet question

Post by azure_glass »

I don't do anything with images in mudlett but...

Maybe you can do "blank" or any color image that have required width and put you image after that image
English is not my native language. If you don't understand what im writing ask. :)
Ubuntu 17.04, Mudlet 3.1

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

Re: setStyleSheet question

Post by Vadi »

I haven't tried this. If you can't find any more information on this, I think you'll need to move the label itself to where you want the image to appear, and overlay another on top to do what you want.

horsethief
Posts: 4
Joined: Thu May 15, 2014 12:18 am

Re: setStyleSheet question

Post by horsethief »

I'm not sure I understand what you mean. Even if I overlaid another no top of the label, wouldn't i still have issues trying to position it where I wanted?

What I'm trying to do is take an image that is 2300 x 1500 pixels, and display it in a 200x200 pixel "minimap" in the corner of my screen (like a minimap in an RTS game like starcraft). I would like to keep the image centered based on my current vmap position, but positioning it with top/bottom/left/right/center just wont get the job done :(

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

Re: setStyleSheet question

Post by Vadi »

Oh I see. I didn't realise it was so big and you wanted it to move dynamically. I thought it was static, so you could just move it off to the side and that'd work.

Try asking on the qt-interest mailing list if you can't find any information otherwise (if you don't know how to use a mailing list, I can ask for you).

horsethief
Posts: 4
Joined: Thu May 15, 2014 12:18 am

Re: setStyleSheet question

Post by horsethief »

I've read a million of them, but I've never actually posted to one. If you wouldn't mind, I would be grateful!

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

Re: setStyleSheet question

Post by Vadi »

See http://qt-project.org/doc/qt-4.8/stylesheet-syntax.html, starting from "The relative positioning scheme". Try using the top/left/etc properties to move the window. There's also absolute and relative positioning you can set using a property.

Post Reply