PDA

View Full Version : How to view images ???



prajnaranjan.das
17th December 2010, 11:40
I have placed images in QLabel and want to view it larger when I clicks it ......

high_flyer
17th December 2010, 11:58
What is the problem you have?

prajnaranjan.das
17th December 2010, 12:16
I want to perform click operation on QLabel so that the image I have used should become larger...I have used keyPressEvent(QKeyEvent *event) but Its not showing anything ....

high_flyer
17th December 2010, 12:21
show your code.

prajnaranjan.das
17th December 2010, 12:42
void CodeEditor::keyPressEvent(QKeyEvent *event)
{
switch (event->key()) {
case Qt::Key_Home:
if (event->modifiers() & Qt::ControlModifier) {
goToBeginningOfDocument();
} else {
goToBeginningOfLine();
}
break;
case Qt::Key_End:
...
default:
QWidget::keyPressEvent(event);
}
}

stampede
17th December 2010, 12:49
And where is the code that should enlarge the image ?

You have reimplemented keyPressEvent, which is responsible for keyboard events.

I want to perform click operation on QLabel so that the image I have used should become larger...I have used keyPressEvent(QKeyEvent *event) but Its not showing anything ....
If you want to perform actions on mouse button click, you need to reimplement QWidget::mousePressEvent.

high_flyer
17th December 2010, 12:50
I want to perform click operation on QLabel so that the image I have used should become larger
Where is code that is supposed to enlarge the image?

EDIT: oops, someone was faster :-)

prajnaranjan.das
17th December 2010, 13:10
thanks for your reply….Can you please give me a link related to keyPress and mousePressEvent or any example for this….

high_flyer
17th December 2010, 13:24
http://doc.trolltech.com/latest/qwidget.html#mousePressEvent