Once I faced this problem and solved it by using setPixmap("../user/yourfile.PNG"); from the source code.
Once I faced this problem and solved it by using setPixmap("../user/yourfile.PNG"); from the source code.
A nice solution I use is: Everywhere you need the path to the folder write "%PATH%" (or something else) and when you chance your qss file, read all qss in a string, determinate the path to your qss folder at runtime (since it could be different on different platforms) and do a simple QString::replace() befor setting the qss.
Thanks.In fact just a few minutes ago I solved this problem just like Lykurg did.I read the file into a QString and replaced all "url(./" to absolute Path.
Another question:
In Windows vista&7, the maximize,minimize and close button are put in a line and there 's no space between them.But when one button is hovered, the button has shadow.The most important is :the shadow is partly on the other buttons.
In Qt,a QPushButton could also look different by using a PNG file(e.g: a shadow Button) as backgound-image when hovered.But,two widgets could not overlap each other.
I wonder how to do it in Qt to create a group of vista-like buttons.
Or anyone know how to create a Google Chrome-style UI?(No titleBar But has the windows control Buttons)?
Still, waiting online for any reply.
Last edited by daiheitan; 12th March 2010 at 08:31.
I would create a custom widget, handling all "buttons", and implement mouse press/release and do the drawing myself. (To detect hover use mouse move event)
I just find QML,but not know that very much.
Could QML handle this?
Sure it can, but it is also not that easy and you have to wait till summer when the stable version is shipped out. And as I understand the whole concept it is primary for interfaces with fixed sizes ==> mobile embedded devices...
oops...
I just tried Qt creator 2.0 Alpha,and it crashes a lot. Especially when using the Designer For QML.
One more problem is (though I asked it in another post,but no good answer)
Most programs use PNG file for buttons.And images of hover, normal,pressed states of a button are in just one PNG file.
I wonder if there is a way in Qt style sheet to use a part of a PNG file.
(I really wish there would be a way.....)
Bookmarks