Results 1 to 2 of 2

Thread: hide image,once moused moved from image

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

    Default hide image,once moused moved from image

    Hi

    I have displayed the icons on image,when i am moving the mouse on image,

    I need to hide my icons one i moved the mouse apart from the image ....

    Here i have used the move move event


    my code is
    Qt Code:
    1. #include "widget.h"
    2. #include "ui_widget.h"
    3.  
    4. #include <QPainter>
    5.  
    6. Widget::Widget(QWidget *parent)
    7. : QWidget(parent),
    8. ui(new Ui::WidgetClass),
    9. m_currentImage(0)
    10. {
    11. ui->setupUi(this);
    12.  
    13. ui->label->setPixmap(QPixmap("C:/Documents and Settings/addu.YUVARAJ.001/Desktop/yuvaraj.png"));
    14. ui->pushButton->hide();
    15. ui->toolButton->hide();
    16. ui->pushButton_2->hide();
    17. ui->toolButton_2->hide();
    18. ui->label->setMouseTracking(true);
    19. ui->label->installEventFilter(this);
    20. }
    21.  
    22. Widget::~Widget()
    23. {
    24. delete ui;
    25. }
    26.  
    27. bool Widget::eventFilter(QObject *o, QEvent *e)
    28. {
    29. if (o == ui->label && e->type() == QEvent::MouseMove)
    30. {
    31.  
    32.  
    33. QPixmap pixmap(QString("C:/Documents and Settings/addu.YUVARAJ.001/Desktop/yuvaraj.png"));
    34.  
    35. ui->label->setPixmap(pixmap);
    36. ui->pushButton->show();
    37. ui->toolButton->show();
    38. ui->pushButton_2->show();
    39. ui->toolButton_2->show();
    40. ui->toolButton->setIcon(QIcon("C:/Documents and Settings/addu.YUVARAJ.001/Desktop/raj.png"));
    41. ui->pushButton->setIcon(QIcon("C:/Documents and Settings/addu.YUVARAJ.001/Desktop/raj.png"));
    42. ui->toolButton_2->setIcon(QIcon("C:/Documents and Settings/addu.YUVARAJ.001/Desktop/raj.png"));
    43. ui->pushButton_2->setIcon(QIcon("C:/Documents and Settings/addu.YUVARAJ.001/Desktop/raj.png"));
    44. return true;
    45. }
    46.  
    47. else
    48. {
    49.  
    50.  
    51. return QWidget::eventFilter(o, e);
    52. }
    53. }
    54.  
    55. void Widget::on_pushButton_clicked()
    56. {
    57. this-close();
    58. }
    To copy to clipboard, switch view to plain text mode 



    please suggest me to solve this problem.


    Thanks

    Yuvaraj R

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

    Default Re: hide image,once moused moved from image

    Hi

    I got it ....

    I used the Enter and leave events

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.