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. QTextBrowser play Epub file but a click of image is not html...
QtWS25 Last Chance

QTextBrowser play Epub file but a click of image is not html...

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 1.2k Views
  • 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.
  • P Offline
    P Offline
    patrik08
    wrote on 28 Aug 2017, 17:47 last edited by
    #1

    If inside html a image is linked .. QTextBrowser ReadOnly click an can not show image... why this?

    If i use setSource(QUrl) its play correct local file & image like a browser at end a screenshot...

    EpubView::EpubView(QWidget *parent) : QTextBrowser(parent) {
      modusNow = 1;
      this->setContextMenuPolicy(Qt::CustomContextMenu);
      ModusPlay();
    }
    void EpubView::ModusPlay() {
      this->setContentsMargins(22, 11, 22, 11);
      this->setReadOnly(true); ////  lesen ..kopieren
      this->setMinimumWidth(400);
      this->setMinimumHeight(400);
      this->resize(600, 500);
      this->setOpenExternalLinks(true);
      this->setOpenLinks(true);
      this->document()->setDocumentMargin(100);
      this->document()->setPageSize(QSizeF(800, 500));
    }
    void EpubView::PlayFile(const QUrl localremote) {
      CCDEBUG() << localremote << " -> open... this ";
      this->OpenEpub(localremote);
    }
    void EpubView::OpenEpub(const QUrl localremote) {
      playepub = new Epub::Converter();
      const QString ebookfile = localremote.toLocalFile();
      CCDEBUG() << ebookfile << " -> !!!!! ebookfile";
      QList<EpubToc> listing = playepub->convert(ebookfile, _ZIPCACHEBOOK_);
      //// list full Table of Contenent toc..   first file cover... 
      CCDEBUG() << listing.size() << " -> size  EpubToc file ... this ";
      if (listing.size() > 0) {
        EpubToc fox = listing.at(0);
        QFileInfo eefile(fox.jumpurl);
        this->setSource(QUrl::fromLocalFile(eefile.absoluteFilePath()));
        ///this->document()->setBaseUrl(QUrl::fromLocalFile(eefile.absolutePath()));
        CCDEBUG() << fox.jumpurl << " -> open first url ... this ";
      }
      ModusPlay();
    }
    
    

    0_1503941813451_qtextbrowser.png

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 28 Aug 2017, 19:58 last edited by
      #2

      Hi,

      Did you check the link itself ? How does it reference the image ? Where is it located ?

      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
      • P Offline
        P Offline
        patrik08
        wrote on 28 Aug 2017, 22:17 last edited by
        #3

        The page having one image as src= image + a href=image
        inside page 3 from "A Book about Qt5" as epub format...
        you can test on mac image Hello World..
        the epub is inside as resource to load to test... code..
        https://github.com/pehohlva/QOASIS/blob/master/bin/EpubRead.dmg only search a idea how to make a menu of contenent page toc...

        code is: https://github.com/pehohlva/QOASIS/tree/master/test/dkernel
        any link need a test from QTextBrowser ...

        1 Reply Last reply
        0
        • P Offline
          P Offline
          patrik08
          wrote on 29 Aug 2017, 09:01 last edited by
          #4

          Hi i solved this render problem by swap
          QTextBrowser to QWebEngineView now it faster.. but edit is now only via javascript...

          1 Reply Last reply
          0

          1/4

          28 Aug 2017, 17:47

          • Login

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