Results 1 to 7 of 7

Thread: QMimeSourceFactory

  1. #1
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Question QMimeSourceFactory

    Hi, I'm trying this below but get an error; I don't understand why....
    Wich is the lack? Thanks
    Qt Code:
    1. QMimeSourceFactory mime;
    2. mime.setFilePath("images/");
    3. setCursor(QCursor(QPixmap::fromMimeSource("my.png")));
    To copy to clipboard, switch view to plain text mode 
    Qt Code:
    1. QPixmap::fromMimeSource: Cannot find pixmap "my.png" in the mime source factory
    To copy to clipboard, switch view to plain text mode 
    Regards

  2. #2
    Join Date
    Jan 2006
    Location
    Ukraine,Lviv
    Posts
    454
    Thanks
    9
    Thanked 27 Times in 27 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: QMimeSourceFactory

    What is the reason for creating own mime source factory?
    a life without programming is like an empty bottle

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QMimeSourceFactory

    You probably didn't add the image to your mime factory.

  4. #4
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: QMimeSourceFactory

    Quote Originally Posted by zlatko
    What is the reason for creating own mime source factory?
    to change my cursor ......
    It doesn't still work.
    Regards

  5. #5
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: QMimeSourceFactory

    Hi, I solved so:
    Qt Code:
    1. //mainform.h
    2. QPixmap p = QImage("images/pan.png");
    3. mime.defaultFactory()->setPixmap("pan", p);
    4. setCursor(QCursor(QPixmap::fromMimeSource("pan")));
    To copy to clipboard, switch view to plain text mode 
    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
    Regards

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QMimeSourceFactory

    Add "IMAGES += images/pan.png" to your .pro file and try:
    Qt Code:
    1. setCursor(QCursor(QPixmap::fromMimeSource("images/pan.png")));
    To copy to clipboard, switch view to plain text mode 

  7. #7
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: QMimeSourceFactory

    Thanks for reply; if I Add "IMAGES += images/pan.png" to your .pro file, this works:
    Qt Code:
    1. setCursor(QCursor(QPixmap::fromMimeSource("pan.png")));
    To copy to clipboard, switch view to plain text mode 
    but when mouse is on myGLWidget still change in arrow....Why?
    Regards

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.