24,854
社区成员
发帖
与我相关
我的任务
分享
private slots:
// Reimplement the wheelEvent() to Achieve Zoom in and Zoom out.
void wheelEvent(QWheelEvent *e);
void MatchWindowSingle::wheelEvent(QWheelEvent *e)
{
// If numDegress > 0, then zoom in,
// else, zoom out.
// The scale control the picture's size.
int numDegress = e->delta();
// Update ScrollArea 下面是执行图片缩放的函数代码
if (ui.sa_geoImage->hasFocus()){
identityScaleFactor(&numDegress, &scaleFactor_MIN_g, &scaleFactor_g);
updateScrollArea(&geoPic, ui.sa_geoImage, &geoImageLable, &scaleFactor_g);
}else if (ui.sa_videoImage->hasFocus()){
identityScaleFactor(&numDegress, &scaleFactor_MIN_v, &scaleFactor_v);
updateScrollArea(&videoPic, ui.sa_videoImage, &videoImageLable, &scaleFactor_v);
}
}
QLabel *pGeoImgLabel = new QLabel;
QLabel *pVideoImgLabeo = new QLabel;
ui.sa_geoImage->setWidget(pGeoImgLabel);
ui.sa_geoImage->setWidget(pVideoImgLabeo);
private slots:
// Reimplement the wheelEvent() to Achieve Zoom in and Zoom out.
void wheelEvent(QWheelEvent *e);
void MatchWindowSingle::wheelEvent(QWheelEvent *e)
{
// If numDegress > 0, then zoom in,
// else, zoom out.
// The scale control the picture's size.
int numDegress = e->delta();
// Update ScrollArea 下面是执行图片缩放的函数代码
if (pGeoImgLabel->hasFocus()){
identityScaleFactor(&numDegress, &scaleFactor_MIN_g, &scaleFactor_g);
updateScrollArea(&geoPic, ui.sa_geoImage, &geoImageLable, &scaleFactor_g);
return true;
}else if (pVideoImgLabel->hasFocus()){
identityScaleFactor(&numDegress, &scaleFactor_MIN_v, &scaleFactor_v);
updateScrollArea(&videoPic, ui.sa_videoImage, &videoImageLable, &scaleFactor_v);
return true;
}
}