Hi every one. I'm very very beginner in QT. Plz help me if u have any idea for my problem, with many thanks.
Now my problem:
In part of my project I load an image and now I want to zoom in/out it; but I can't. The image and "scaleSlider" are shown on the screen properly, but changing scale by scaleSlider does not affect the image. this is my code:
void PanelWidgets::slotChangeImage(int val)
{
image.scaled(image.width()*val/100, image.height()*val/100);
qDebug()<<val;
}
void PanelWidgets::slotChangeImage(int val)
{
image.scaled(image.width()*val/100, image.height()*val/100);
qDebug()<<val;
}
To copy to clipboard, switch view to plain text mode
and after many lines, we have:
bool b = image.load(":res/dab/logo.jpg");
if(!b) qDebug()<<"Can not load image from path";
if(b
) scene
->addPixmap
(QPixmap::fromImage(image
));
scaleslider->setRange(10,1000);
scaleslider->setGeometry(700,100,200,30);
connect(scaleslider,SIGNAL(valueChanged(int)),this,SLOT(slotChangeImage(int)),Qt::UniqueConnection);
bool b = image.load(":res/dab/logo.jpg");
if(!b) qDebug()<<"Can not load image from path";
if(b) scene->addPixmap(QPixmap::fromImage(image));
QSlider *scaleslider = new QSlider(Qt::Horizontal,this);
scaleslider->setRange(10,1000);
scaleslider->setGeometry(700,100,200,30);
connect(scaleslider,SIGNAL(valueChanged(int)),this,SLOT(slotChangeImage(int)),Qt::UniqueConnection);
To copy to clipboard, switch view to plain text mode
I'm using QT Creator 2.4.1 (based on QT 4.7.4 32bit) and Win 7 x86.
Bookmarks