[EDIT]
You are definitely right, I seem to create another instance of a label. Somehow Its on the same position as the other label.. with exact geometry 4X12
How do I asign an Existing instance of a QLabel in such way, that no new instance of QLabel is created upon creation of my own class which is derived from QLabel (or other way round, sry I'm not sure about the right term)
[/EDIT]
first thing: the width and height of the object assigned as parent is 500X500 So crazy thing that mousePressEvent is only called in such a small area.
As far as I know I do not create the label through code.. here my code:
Definitin in header file:
.
.
.
class CXRayDisplay
: public QLabel {
Q_OBJECT
public:
CXRayDisplay
(QLabel* parent,
QImage* XRayImage, ....
and several other vars...
);
.
.
.
.
.
.
class CXRayDisplay : public QLabel
{
Q_OBJECT
public:
CXRayDisplay(QLabel* parent, QImage* XRayImage, ....and several other vars...);
.
.
.
To copy to clipboard, switch view to plain text mode
Here how a new instance of my class is generated and the label assigned to it and I assign a Pixmap which is retrieved from my class back to the label:
.
.
.
//XRayDisplay part start
//Initializing display
test
= new QImage("Resources\\xray.bmp");
m_display2 = new CXRayDisplay(ui.xrayDisplay,test,-300,-300,-600,600);
//and show it
ui.xrayDisplay->setPixmap(m_display2->getPixmap());
.
.
.
.
.
.
.
//XRayDisplay part start
//Initializing display
QImage* test;
test = new QImage("Resources\\xray.bmp");
m_display2 = new CXRayDisplay(ui.xrayDisplay,test,-300,-300,-600,600);
//and show it
ui.xrayDisplay->setPixmap(m_display2->getPixmap());
.
.
.
.
To copy to clipboard, switch view to plain text mode
by the way: ui.xrayDisplay is the Label I created with ui Designer
[EDIT]
I just see: maybe you are right about the creation of a new Label... I am not too good with derived attributes so someone can help me?
Well this is the deifintion of the source file of my class:
CXRayDisplay
::CXRayDisplay(QLabel *parent,
QImage* XRayImage, ..
several other variables...
)
CXRayDisplay::CXRayDisplay(QLabel *parent, QImage* XRayImage, ..several other variables...)
: QLabel(parent)
To copy to clipboard, switch view to plain text mode
[/EDIT]
Bookmarks