Results 1 to 20 of 24

Thread: icons on image

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2009
    Posts
    61
    Thanks
    4
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: icons on image

    hi

    My code for mouse over event
    Qt Code:
    1. bool mouseover()
    2. {
    3. if(QPoint(10,10)
    4. {
    5. return TRUE; QPixmap pixmap("image.png");
    6. QPixmap icon("test.png");
    7.  
    8. QPainter painter(&pixmap);
    9. painter.drawPixmap(QPoint(10, 10), icon);
    10.  
    11. QLabel label;
    12. label.setPixmap(pixmap);
    13. label.show();
    14. }
    15. else
    16. {
    17. return FALSE;
    18. }
    19. }
    To copy to clipboard, switch view to plain text mode 

    But it is not working , i think my problem is in condition....

    I have another doubt...

    if mouse satisfied the position of image ,how do display the icons on image,

    Is it using the push button, tool button. I need that icons should in event...

    please suggest me

    Thanks

    Yuvaraj R

  2. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: icons on image

    you never reach this code
    Qt Code:
    1. ...
    2. QPixmap pixmap("image.png");
    3. QPixmap icon("test.png");
    4.  
    5. QPainter painter(&pixmap);
    6. painter.drawPixmap(QPoint(10, 10), icon);
    7.  
    8. QLabel label;
    9. label.setPixmap(pixmap);
    10. label.show();
    11. ...
    To copy to clipboard, switch view to plain text mode 
    because return true; is located in a wrong place
    try this
    Qt Code:
    1. bool mouseover()
    2. {
    3. if(QPoint(10,10)) {
    4. QPixmap pixmap("image.png");
    5. QPixmap icon("test.png");
    6.  
    7. QPainter painter(&pixmap);
    8. painter.drawPixmap(QPoint(10, 10), icon);
    9.  
    10. QLabel label;
    11. label.setPixmap(pixmap);
    12. label.show();
    13. return TRUE;
    14. }
    15. return FALSE;
    16. }
    To copy to clipboard, switch view to plain text mode 
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  3. #3
    Join Date
    Apr 2009
    Posts
    61
    Thanks
    4
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: icons on image

    But it is giving error in main program

    My main program code is
    Qt Code:
    1. #include <QtGui/QApplication>
    2. #include "widget.h"
    3.  
    4. int main(int argc, char *argv[])
    5. {
    6. QApplication a(argc, argv);
    7. Widget w;
    8. w.show();
    9. return a.exec();
    10. }
    To copy to clipboard, switch view to plain text mode 


    the errors is

    E:/Qt Programs/yuvaraj/main.cpp:10: error: expected `}' at end of input


    E:/Qt Programs/yuvaraj/main.cpp:10: error: expected unqualified-id at end of input

  4. #4
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: icons on image

    can you attach your project?
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  5. #5
    Join Date
    Apr 2009
    Posts
    61
    Thanks
    4
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: icons on image

    please find my project code here


    i cleared my previous errors ,now i am getting new type errors..
    Attached Files Attached Files

  6. #6
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: icons on image

    ok, you project doen't work and will not work at all.
    I'll prepare an example for you and you can learn how it should be.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  7. #7
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: icons on image

    have a look at this example
    Attached Files Attached Files
    • File Type: zip t.zip (6.6 KB, 6 views)
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  8. The following user says thank you to spirit for this useful post:

    yuvaraj.yadav (21st April 2009)

  9. #8
    Join Date
    Apr 2009
    Posts
    61
    Thanks
    4
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: icons on image

    Thank you spirit

Similar Threads

  1. Image Commander v.1.2
    By piotrek in forum Qt-based Software
    Replies: 0
    Last Post: 20th April 2009, 10:59
  2. can Qlabel display a series of image one by one ?
    By jirach_gag in forum Qt Tools
    Replies: 3
    Last Post: 11th August 2008, 15:36
  3. Finding marks on scanned image for alignment
    By caduel in forum Qt Programming
    Replies: 1
    Last Post: 23rd September 2007, 02:10
  4. Help needed handling image data
    By toratora in forum General Programming
    Replies: 2
    Last Post: 11th May 2007, 09:24
  5. how i can add image in my toolbar
    By jyoti in forum Qt Tools
    Replies: 7
    Last Post: 19th December 2006, 14:39

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
  •  
Qt is a trademark of The Qt Company.