我写了一段代码但是最后的效果不是我想要的,还请高人帮忙指点一下,谢谢啦!
void ClientInfoBase::openfile1()
{
QString newfilename1 = QFileDialog::getOpenFileName( "",
tr("Jpg File(*.jpg);;Bmp File(*.bmp);;Png File(*.png)"),
this,
"open files dialog"
"Select one file to open" );
if ( !newfilename1.isEmpty() ) {
textLabel1->setPixmap(newfilename1);
scrollArea->addChild(textLabel1);
scrollArea->setHScrollBarMode(QScrollView::ScrollBarMode::AlwaysOn);
scrollArea->setVScrollBarMode(QScrollView::ScrollBarMode::AlwaysOn);
scrollArea->show();
}
}
所要显示的图片没有在原来的窗口上显示,而是新打开了一个窗口,在新打开的窗口上显示了。怎样才能在原来的窗口上显示呢?还请高人指点,谢谢!