PDA

View Full Version : QMimeSourceFactory



mickey
13th March 2006, 00:09
Hi, I'm trying this below but get an error; I don't understand why....
Wich is the lack? Thanks


QMimeSourceFactory mime;
mime.setFilePath("images/");
setCursor(QCursor(QPixmap::fromMimeSource("my.png")));

QPixmap::fromMimeSource: Cannot find pixmap "my.png" in the mime source factory

zlatko
13th March 2006, 10:21
What is the reason for creating own mime source factory? :rolleyes:

wysota
13th March 2006, 10:23
You probably didn't add the image to your mime factory.

mickey
13th March 2006, 12:21
What is the reason for creating own mime source factory? :rolleyes:
to change my cursor ......
It doesn't still work.

mickey
13th March 2006, 12:37
Hi, I solved so:


//mainform.h
QPixmap p = QImage("images/pan.png");
mime.defaultFactory()->setPixmap("pan", p);
setCursor(QCursor(QPixmap::fromMimeSource("pan")));
but everytime Do I must set path and images name file? Is there a way more elegant?
Furthermore, setcursor change cursor when it is on toolbar and not when it is on myWidget; Is there a way to set it and avoid to code myWidget1->cursor, mywid2->...,myWid3......? Thanks

jacek
13th March 2006, 15:38
Add "IMAGES += images/pan.png" to your .pro file and try:
setCursor(QCursor(QPixmap::fromMimeSource("images/pan.png")));

mickey
13th March 2006, 15:58
Thanks for reply; if I Add "IMAGES += images/pan.png" to your .pro file, this works:

setCursor(QCursor(QPixmap::fromMimeSource("pan.png")));
but when mouse is on myGLWidget still change in arrow....Why?