의 위젯을 코드로 FormWindow에 추가하려면 어떻게해야합니까? createWidget() ... 등의 메서드는 모두 추상이므로 내부 머티리얼을 제대로 사용하여 QLabel을 활성 FormWindow에 추가하려면 어떻게해야합니까?위젯을 양식에 추가하는 방법 qdesigner_workbench.cpp의 QtDesigner에서
편집 : (fw-> mainContainer()에서 얻은)
QDesignerFormWindowManagerInterface* fwm = core()->formWindowManager();
QDesignerFormWindowInterface* fw = fwm->activeFormWindow();
QWidget* mw = fw->mainContainer();
QLabel* label = new QLabel(mw); //can be added correctly but not in the right hierarchy
label->setText("I am a good girl.");
MW를 MainWindow를 실제로, 그러나 실제 데이터를 :
qdesigner_workbench.cpp에서, 이것은 내가 가지고있는 현재 내가 필요합니다 :
mw -> children[2] (which is a QDesignerWidget) -> children
디자이너에는 9 개의 위젯이 있으며 위에서 언급 한 어린이 9 개의 배열을 볼 수 있습니다. 설명을 보려면이 링크 (이미지)를 참조하십시오.
http://img24.imagevenue.com/img.php?image=98871_a_122_476lo.jpg
그래서 ... 어떻게 제대로 QLabel 위젯을 추가 할 수 있습니까? 시도했습니다 모두
QLabel* label = new QLabel(fw); // will be a sibling of MainContainer, which is the QMainWindow (mw) in this case
QLabel* label = new QLabel(mw); // will be a sibling of QDesignerWidget
및 apprarently 작품 중 하나. 라벨을 추가 할 경우이 중앙 위젯
mainWindow->setCentralWidget(centralWidget);
같이
와우, 빠릅니다. 내일 직장에서 그것을 확인합니다 :) – purga