Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt WebKit
  4. QWebFrame original HTML for WYSIWYG editor
Forum Updated to NodeBB v4.3 + New Features

QWebFrame original HTML for WYSIWYG editor

Scheduled Pinned Locked Moved Qt WebKit
10 Posts 3 Posters 6.8k 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.
  • C Offline
    C Offline
    clynamen
    wrote on last edited by
    #1

    Hi! I'm trying to develop an html editor. The document can be modified through a QWebPage and through a text editor:
    http://img31.imageshack.us/img31/8369/26566672.png

    I do this to update the text editor content when the user modify the QWebPage:
    @ QString a = QWepPage::mainFrame()->toHtml() ;
    testEditor.setContent(a);
    @
    The problem is that toHtml() method return a processed html string where some characters are replaced. The user doesn't want this, only the user's changes should be visible. I thought to use the unprocessed string of the QWebFramePrivate, but it is private. I could also save the original text and add the differences of QWepPage::mainFrame()->toHtml() to it, but I can't distinguish user's modifications

    1 Reply Last reply
    0
    • K Offline
      K Offline
      KA51O
      wrote on last edited by
      #2

      Did I understand you correctly? You want to allow the user to edit the HTML inside the QWebView (contentEditable) and inside your own texteditor ? Because I would suggest you allow either the first OR the second, that would make life a whole lot easier for you ^^.

      EDIT: Maybe this link will help "WYSIWYG editor":http://labs.qt.nokia.com/2009/03/12/wysiwyg-html-editor/

      1 Reply Last reply
      0
      • C Offline
        C Offline
        clynamen
        wrote on last edited by
        #3

        bq. that would make life a whole lot easier for you

        I know, but it would be nice to edit both in the same time :)

        unfortunately the git rep of that project is unavailable

        EDIT: yes, you understand me correctly

        1 Reply Last reply
        0
        • K Offline
          K Offline
          KA51O
          wrote on last edited by
          #4

          Try this link: "HTMLEditor":http://qt.gitorious.org/qt-labs/graphics-dojo/trees/master/htmleditor

          I'm not sure it's the one (I got it directly next to the other link in my bookmarks)

          1 Reply Last reply
          0
          • C Offline
            C Offline
            clynamen
            wrote on last edited by
            #5

            yes, it is, thank you.

            but the plaintextedit of that project is readonly, you can modify the source only through the webview.
            I was thinking to insert javascript code (invisible to user) to print the source code, the browser will read the printed code and send it to textEditor

            1 Reply Last reply
            0
            • K Offline
              K Offline
              KA51O
              wrote on last edited by
              #6

              Keep me posted about your progress as I'm really curious how you will solve this.

              And may the force be with you ;-)

              1 Reply Last reply
              0
              • C Offline
                C Offline
                clynamen
                wrote on last edited by
                #7

                so, It seems the only possible thing to do is to access the QWebFramePrivate member of QWebFrame, anyone know how is it possible?

                there's also a way to make this work, but it's expansive.

                1. save the text of the editor in QString a, open with QWebFrame and QString b = toHtml()
                2. once the user modified the document save another time toHtml() to QString c
                3. find difference between b and c, character by character, and apply them to a.

                I'm not going to use this method, I hope somehow the QWebFramePrivate could be accessed to use it's
                QWebFramePrivate::frame->document() function

                1 Reply Last reply
                0
                • K Offline
                  K Offline
                  KA51O
                  wrote on last edited by
                  #8

                  I once had to use a private function from a class I had no way of changing for my needs. I found a way to use that private function by making a new class derived from the class whose private function I wanted to use. It was in no way safe or good programming style but it worked for me. Since I luckily found a workaround for my problem I removed that later and forgot about it.

                  I suggest you create a new thread asking for a way to access a private member from one of the Qt classes. Something like "How to access the private member QWebFramePrivate of QWebFrame".

                  Sry I can't help you.

                  1 Reply Last reply
                  0
                  • C Offline
                    C Offline
                    clynamen
                    wrote on last edited by
                    #9

                    ok, thank you anyway. I'm going to open another thread

                    1 Reply Last reply
                    0
                    • L Offline
                      L Offline
                      luisvt
                      wrote on last edited by
                      #10

                      How can I acces to de CSS data from the QWebView. I mean, I know that I can edit the styles using the QInspector, but I want to save the editions after editing with the inspector. How could I do that?

                      1 Reply Last reply
                      0

                      • Login

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