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. Write rich text into .odt file
Forum Updated to NodeBB v4.3 + New Features

Write rich text into .odt file

Scheduled Pinned Locked Moved Solved General and Desktop
16 Posts 3 Posters 2.6k Views 3 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.
  • SGaistS SGaist

    Hi,

    @Tamfub said in Write rich text into .odt file:

    @artwaw
    Hi,
    Unfortunately there cannot be a textEdit in my project, so I was wondering if I could do the same with the bits that make the QTextDocument and put them inside it.

    Out of curiosity, can you explain the reasons you can't have a QTextEdit in your UI ?

    T Offline
    T Offline
    Tamfub
    wrote on last edited by Tamfub
    #6

    @SGaist
    Hello,
    the project I am working on is something like this:
    https://conclave-team.github.io/conclave-site/
    The client and server send data with QTcpSockets. The server side does not have a GUI (it is on the client side, with a textEdit), the client sends each Symbol and the server keeps them in a QList.
    Now, we would like to store this Symbols (that compose a rich text) in a local .odt file.
    I think it is unconvenient to send the whole textEdit->document() at every change inside the client textEdit.

    artwawA 1 Reply Last reply
    0
    • T Tamfub

      @SGaist
      Hello,
      the project I am working on is something like this:
      https://conclave-team.github.io/conclave-site/
      The client and server send data with QTcpSockets. The server side does not have a GUI (it is on the client side, with a textEdit), the client sends each Symbol and the server keeps them in a QList.
      Now, we would like to store this Symbols (that compose a rich text) in a local .odt file.
      I think it is unconvenient to send the whole textEdit->document() at every change inside the client textEdit.

      artwawA Offline
      artwawA Offline
      artwaw
      wrote on last edited by
      #7

      @Tamfub I'd still stick with internal representation as QTextEdit, you can edit it as the symbols flow in.

      For more information please re-read.

      Kind Regards,
      Artur

      SGaistS 1 Reply Last reply
      0
      • artwawA artwaw

        @Tamfub I'd still stick with internal representation as QTextEdit, you can edit it as the symbols flow in.

        SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #8

        @artwaw said in Write rich text into .odt file:

        @Tamfub I'd still stick with internal representation as QTextEdit, you can edit it as the symbols flow in.

        Agreed, establish a protocol to keep the documents in sync but there's no need to reinvent the wheel.

        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
        • T Offline
          T Offline
          Tamfub
          wrote on last edited by
          #9

          Ok, I have a distributed application and I must apply the CRDT algorithm to keep consistency in shared documents. Since more than one clients may work on the same document (like in Google Docs), how can I keep more than one textEdit graphical element on the server? Maybe I'm not getting it at all.

          artwawA 1 Reply Last reply
          0
          • T Tamfub

            Ok, I have a distributed application and I must apply the CRDT algorithm to keep consistency in shared documents. Since more than one clients may work on the same document (like in Google Docs), how can I keep more than one textEdit graphical element on the server? Maybe I'm not getting it at all.

            artwawA Offline
            artwawA Offline
            artwaw
            wrote on last edited by
            #10

            @Tamfub you don't need QTextEdit on the server. Just QTextDocument that's being kept up to date.

            For more information please re-read.

            Kind Regards,
            Artur

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #11

              So you want to implement something like Google Docs ?

              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
              • T Offline
                T Offline
                Tamfub
                wrote on last edited by Tamfub
                #12

                Yes, something like that. But if I have a Symbol like one of the first post:

                Symbol s('H', QFont::Bold)
                

                can I create an empty QTextDocument and insert the Symbol character and properties inside it?

                artwawA 1 Reply Last reply
                0
                • T Tamfub

                  Yes, something like that. But if I have a Symbol like one of the first post:

                  Symbol s('H', QFont::Bold)
                  

                  can I create an empty QTextDocument and insert the Symbol character and properties inside it?

                  artwawA Offline
                  artwawA Offline
                  artwaw
                  wrote on last edited by
                  #13

                  @Tamfub Of course.

                  For more information please re-read.

                  Kind Regards,
                  Artur

                  T 1 Reply Last reply
                  0
                  • artwawA artwaw

                    @Tamfub Of course.

                    T Offline
                    T Offline
                    Tamfub
                    wrote on last edited by
                    #14

                    @artwaw ok, how can I insert the character? Should I create a QTextBlock inside the QTextDocument or what?

                    artwawA 1 Reply Last reply
                    0
                    • T Tamfub

                      @artwaw ok, how can I insert the character? Should I create a QTextBlock inside the QTextDocument or what?

                      artwawA Offline
                      artwawA Offline
                      artwaw
                      wrote on last edited by
                      #15

                      @Tamfub You edit QTextDocument using QTextCursor (it is mentioned in QTextDocument documentation btw.).
                      Also worth reading before you begin is Rich Text Editing overview page.

                      It is a fair amount of reading but in my honest opinion - it is worth it.

                      For more information please re-read.

                      Kind Regards,
                      Artur

                      1 Reply Last reply
                      2
                      • T Offline
                        T Offline
                        Tamfub
                        wrote on last edited by
                        #16

                        Fine, I'll give it a read then. Thank you both @artwaw and @SGaist! :)

                        1 Reply Last reply
                        1

                        • Login

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