Results 1 to 10 of 10

Thread: Mouse Over event on button

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #8
    Join Date
    Dec 2006
    Posts
    211
    Thanks
    27
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Question Re: Mouse Over event on button

    Thanks for that.

    But Actually I have created the buttons as

    QGroupBox *groupBox;
    QPushButton *PhotoRecoveryButton;
    QPushButton *CreateImageButton;

    CreateImageButton = new QPushButton(Dialog);
    CreateImageButton->setObjectName(QString::fromUtf8("CreateImageButto n"));
    CreateImageButton->setWindowModality(Qt::NonModal);
    CreateImageButton->setGeometry(QRect(30, 230, 131, 121));
    CreateImageButton->setCursor(QCursor(static_cast<Qt::CursorShape>(13 )));
    CreateImageButton->setMouseTracking(true);
    CreateImageButton->setFocusPolicy(Qt::StrongFocus);
    CreateImageButton->setIcon(QIcon(QString::fromUtf8(":/images/CreateImageLogical.png")));
    CreateImageButton->setIconSize(QSize(128, 128));
    CreateImageButton->setCheckable(true);
    CreateImageButton->setChecked(false);
    CreateImageButton->setAutoDefault(true);
    CreateImageButton->setDefault(true);
    CreateImageButton->setFlat(true);
    QWidget::setTabOrder(CreateImageButton, PhotoRecoveryButton);



    and I have make a SearchScanDiskDlg.h in which I have declare the

    protected:

    void enterEvent(QEvent *event);
    void leaveEvent(QEvent *event);

    and then using these in .cpp file as

    void SearchScanDiskDlg::enterEvent(QEvent *event)
    {

    CreateImageButton->setIcon(QIcon(":/images/CreateImage1.png"));

    }



    void SearchScanDiskDlg::leaveEvent(QEvent *event)

    {

    CreateImageButton->setIcon(QIcon(":/images/CreateImageLogical.png"));

    }



    That is changes the icon on enterEvent and leaveEvent.

    It is changing the Icon only when I click somewhere on the Dialog
    I m sending you the form only to show u how it is looking.
    Attached Images Attached Images

Similar Threads

  1. Middle Button Mouse
    By jaime in forum Qt Programming
    Replies: 1
    Last Post: 25th August 2006, 03:01
  2. Replies: 2
    Last Post: 24th July 2006, 18:36
  3. Draw QtCanvasElipse on mouse press event position
    By YuriyRusinov in forum Newbie
    Replies: 1
    Last Post: 31st May 2006, 11:57
  4. mouse click event
    By vijay anandh in forum Qt Programming
    Replies: 1
    Last Post: 1st May 2006, 09:24
  5. QStackerWidget and mouse events
    By high_flyer in forum Qt Programming
    Replies: 3
    Last Post: 25th April 2006, 19:25

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.