Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QLPreviewView cannot display after insert to QStackedWidget
Forum Updated to NodeBB v4.3 + New Features

QLPreviewView cannot display after insert to QStackedWidget

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 227 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    iwant
    wrote on 27 Oct 2021, 08:33 last edited by
    #1

    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:
    b438d2ac-e544-47d4-adca-7485b4f66913.png

    After insert widget(with QLPreviewView) to QStackedWidget:
    680223e7-0887-4b4d-92a1-6eb9c589d714.png

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 27 Oct 2021, 18:48 last edited by
      #2

      Hi and welcome to devnet,

      What is QLPreviewView ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • C Offline
        C Offline
        ChrisW67
        wrote on 28 Oct 2021, 05:48 last edited by
        #3

        Seems to be an Apple OS widget: QL = Quick Look

        1 Reply Last reply
        0

        1/3

        27 Oct 2021, 08:33

        • Login

        • Login or register to search.
        1 out of 3
        • First post
          1/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved