English 中文(简体)
Center Q Graphics Widget的观点
原标题:Center QGraphicsView in Widget
  • 时间:2009-09-28 20:41:35
  •  标签:

我有一个QDialog,它包含几个码头和一门QGraphics。 植被布局为电网,QGraphicsView大小政策将固定在2轴上,QGraphicsView是QDialog空区的核心。

I would like to resize my QGraphicsView and let it at the center of the empty zone of the QDialog. I have tried this code:

// resize QGraphicsView
ui->mProjectView->resize(mProject->getSize() + QSize(2,2));

But Q Graphics 观点正在调整其规模,以适应QDialog的转化。

我当时试图这样做:

// resize QGraphicsView
ui->mProjectView->resize(mProject->getSize() + QSize(2,2));
// Adjust size of QDialog to fit new widget s size
ui->centralWidget->adjustSize();

但这并不可行。 梯度 观点保持最后的规模......

我确信,实现这个目标的途径是简单明了的,但我没有东西。 您能否帮助?

最佳回答

你可以尝试

ui->mProjectView->setFixedSize(mProject->getSize() + QSize(2,2));

相反。

问题回答

暂无回答




相关问题
热门标签