when I try to use event it freeze everything
*.h
#include <QtGui/QWidget>
namespace Ui
{
class Widget;
}
{
Q_OBJECT
protected:
virtual bool event
(QEvent * event
);
public:
~Widget();
public slots:
private:
Ui::Widget *ui;
};
#include <QtGui/QWidget>
namespace Ui
{
class Widget;
}
class Widget : public QWidget
{
Q_OBJECT
protected:
virtual bool event(QEvent * event);
public:
Widget(QWidget *parent = 0);
~Widget();
public slots:
private:
Ui::Widget *ui;
};
To copy to clipboard, switch view to plain text mode
*.cpp
bool Widget
::event(QEvent * event
) {event->accept();
if(event
->type
()==QEvent::Enter) {
ui->label_2->setText("QEvent::Enter");
}
return true;
}
bool Widget::event(QEvent * event)
{event->accept();
if(event->type()==QEvent::Enter)
{
ui->label_2->setText("QEvent::Enter");
}
return true;
}
To copy to clipboard, switch view to plain text mode
it looks like it is working but only some miliseconds and stops. label_2 had write only half of text "QEvent::E"
Bookmarks