16,214
社区成员
发帖
与我相关
我的任务
分享
void MainWindow::on_pushButton_clicked()
{
QGraphicsScene* scene=new QGraphicsScene;
QPixmap* image=new QPixmap("C:/test/2.bmp");
scene->addPixmap(*image);
ui->graphicsView->setScene(scene);
ui->graphicsView->resize(image->width() + 10, image->height() + 10);
ui->graphicsView->show();
//delete scene;
//delete image;
}
// Remove the previously assigned scene.
if (d->scene) {
disconnect(d->scene, SIGNAL(changed(QList<QRectF>)),
this, SLOT(updateScene(QList<QRectF>)));
disconnect(d->scene, SIGNAL(sceneRectChanged(QRectF)),
this, SLOT(updateSceneRect(QRectF)));
d->scene->d_func()->removeView(this);
d->connectedToScene = false;
if (isActiveWindow() && isVisible()) {
QEvent windowDeactivate(QEvent::WindowDeactivate);
QApplication::sendEvent(d->scene, &windowDeactivate);
}
if(hasFocus())
d->scene->clearFocus();
}
Q_INLINE_TEMPLATE void QList<T>::node_destruct(Node *n)
{
if (QTypeInfo<T>::isLarge || QTypeInfo<T>::isStatic) delete reinterpret_cast<T*>(n->v);
else if (QTypeInfo<T>::isComplex) reinterpret_cast<T*>(n)->~T();
}
void MainWindow::on_pushButton_clicked()
{
QGraphicsScene* scene=new QGraphicsScene;
QPixmap image("C:/test/2.bmp");
scene->addPixmap(image);
ui->graphicsView->setScene(scene);
ui->graphicsView->resize(image.width() + 10, image.height() + 10);
ui->graphicsView->show();
}