1
여기 내가하는 일 : mainwindow with MdiArea 및 하위 영역으로 MdiArea에 스크롤 영역 위젯 (이미지 레이블 포함)을 추가합니다. 작동하지 않습니다 (사진이 표시되지 않음).QMdiArea 및 QScrollArea를 사용하는 QT4 이상한 사용 문제
여기 내 코드입니다 :
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
QScrollArea sa;
QPixmap *image = new QPixmap("2.jpg");
QLabel* imageLabel = new QLabel();
imageLabel->setPixmap(*image);
sa.setWidget(imageLabel);
sa.show();
ui->mdiArea->addSubWindow(&sa);
}
하지만 직접 서브 윈도우로 QLabel
를 사용하는 경우, 즉와 마지막 줄을 바꿉니다
ui->mdiArea->addSubWindow(imageLabel);
그것을 완벽하게 작동합니다.
왜 이런 일이 발생하는지 알고 계십니까?