Pablik
12th August 2013, 11:39
Hi i want detect when i click on Qimage inserted to QTextEdit . i make Filee class but dont work.
// .H
#ifndef FILEE_H
#define FILEE_H
#include <QWidget>
#include <QMessageBox>
#include <QEvent>
class Filee : public QWidget, public QImage
{
Q_OBJECT
public:
Filee();
signals:
public slots:
void lol();
protected :
bool event(QEvent *);
};
#endif // FILEE_H
//.CPP
#include "filee.h"
Filee::Filee()
: QImage(":/File.png")
{
}
bool Filee::event(QEvent * e)
{
QMessageBox::information(0, QString::number(e->type()) , "sdf");
return true;
}
//Add Filee to textedit
Filee f1;
ui->textEdit->textCursor().insertImage( (QImage) f1, "f1");
After click on this image in textedit do nothing , event are not detected ;(
// .H
#ifndef FILEE_H
#define FILEE_H
#include <QWidget>
#include <QMessageBox>
#include <QEvent>
class Filee : public QWidget, public QImage
{
Q_OBJECT
public:
Filee();
signals:
public slots:
void lol();
protected :
bool event(QEvent *);
};
#endif // FILEE_H
//.CPP
#include "filee.h"
Filee::Filee()
: QImage(":/File.png")
{
}
bool Filee::event(QEvent * e)
{
QMessageBox::information(0, QString::number(e->type()) , "sdf");
return true;
}
//Add Filee to textedit
Filee f1;
ui->textEdit->textCursor().insertImage( (QImage) f1, "f1");
After click on this image in textedit do nothing , event are not detected ;(