Unsolved QLPreviewView cannot display after insert to QStackedWidget
-
I'm trying to use QLPreviewView to preview keynote/PDF file on mac.
I found it's work fine to insert a QLPreviewView into a QWidget , code like:QWidget* widget = new QWidget(); widget->setGeometry(0, 0, 500, 500); NSView* nativeView = reinterpret_cast<NSView*>(widget->winId()); [nativeView addSubView: myQLPreviewView]; widget->show();
But when I tryed to insert the widget into a QStackedWidget, I found that nothing displayed at last:
QStackedWidget* sw= new QStackedWidget(); sw->setGeometry(0, 0, 500, 500); sw->insertWidget(0, widget) sw->setCurrentIndex(0); sw->show();
Here is the different from Debug View Hierarchy:
Insert to qwidget:
After insert widget(with QLPreviewView) to QStackedWidget:
-
Hi and welcome to devnet,
What is QLPreviewView ?
-
Seems to be an Apple OS widget: QL = Quick Look