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. When QTextEdit will understand tag <strike>?

When QTextEdit will understand tag <strike>?

Scheduled Pinned Locked Moved Solved General and Desktop
9 Posts 3 Posters 2.5k 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.
  • S Offline
    S Offline
    sersver00
    wrote on last edited by
    #1

    Qt5.5, 5.6, 5.7 don't undersand tag <strike> in QTextEdit, but they understand tag <s>

    raven-worxR 1 Reply Last reply
    0
    • S sersver00

      Qt5.5, 5.6, 5.7 don't undersand tag <strike> in QTextEdit, but they understand tag <s>

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @sersver00
      the supported HTML subset can be viewed here.
      Nevertheless you should ask this question on the developer mailing list.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      S 1 Reply Last reply
      5
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi
        Most likely never as
        "<strike> has been deprecated in HTML 4 and XHTML 1, and obsoleted in HTML5. If semantically appropriate, i.e., if it represents deleted content, use the <del> instead; in all other cases use an <s> element."

        S 1 Reply Last reply
        6
        • raven-worxR raven-worx

          @sersver00
          the supported HTML subset can be viewed here.
          Nevertheless you should ask this question on the developer mailing list.

          S Offline
          S Offline
          sersver00
          wrote on last edited by
          #4

          @raven-worx Thank you very much.

          raven-worxR 1 Reply Last reply
          0
          • mrjjM mrjj

            Hi
            Most likely never as
            "<strike> has been deprecated in HTML 4 and XHTML 1, and obsoleted in HTML5. If semantically appropriate, i.e., if it represents deleted content, use the <del> instead; in all other cases use an <s> element."

            S Offline
            S Offline
            sersver00
            wrote on last edited by
            #5

            @mrjj Ok, but QTextEdit may paste Rich HTML text. I only copy text from last version of Firefox and the text contains <strike>. I paste the text to QTextEdit and see ordinar text. :( I think, the tag <strike> is still need.

            mrjjM 1 Reply Last reply
            0
            • S sersver00

              @mrjj Ok, but QTextEdit may paste Rich HTML text. I only copy text from last version of Firefox and the text contains <strike>. I paste the text to QTextEdit and see ordinar text. :( I think, the tag <strike> is still need.

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by mrjj
              #6

              @sersver00 said in When QTextEdit will understand tag <strike>?:

              I paste the text to QTextEdit and see ordinar text

              But does pasting bold text and other stuff works?
              Maybe it strips all HTML ?
              (Dont have a QTextEdit to test with right now :)

              S 1 Reply Last reply
              2
              • mrjjM mrjj

                @sersver00 said in When QTextEdit will understand tag <strike>?:

                I paste the text to QTextEdit and see ordinar text

                But does pasting bold text and other stuff works?
                Maybe it strips all HTML ?
                (Dont have a QTextEdit to test with right now :)

                S Offline
                S Offline
                sersver00
                wrote on last edited by
                #7

                @mrjj I test the text with the tag in standard example from qt packet too. As described here <strike> is not support now. My way is the developer mailing list. I see no other way out.
                Thanks!

                1 Reply Last reply
                0
                • S sersver00

                  @raven-worx Thank you very much.

                  raven-worxR Offline
                  raven-worxR Offline
                  raven-worx
                  Moderators
                  wrote on last edited by VRonin
                  #8

                  @sersver00
                  Here's a little workaround:

                  void MyTextEdit::insertFromMimeData(const QMimeData *mimeData)
                  {
                        QMimeData mimeDataCopy;
                  
                        // duplicate mimeData
                        foreach( QString format, mimeData.formats() )
                        {
                               QByteArray data = mimeData->data(format);
                               if( format.startsWith( QLatin1String("text/html"), Qt::CaseInsensitive )
                               {
                                         data.replace(QByteArray("<strike>"), QByteArray("<s>"));
                                         data.replace(QByteArray("</strike>"), QByteArray("</s>"));
                               }
                               mimeDataCopy.setData( format,  data );
                         }
                  
                        QTextEdit::insertFromMimeData( &mimeDataCopy );
                  }
                  

                  --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                  If you have a question please use the forum so others can benefit from the solution in the future

                  S 1 Reply Last reply
                  3
                  • raven-worxR raven-worx

                    @sersver00
                    Here's a little workaround:

                    void MyTextEdit::insertFromMimeData(const QMimeData *mimeData)
                    {
                          QMimeData mimeDataCopy;
                    
                          // duplicate mimeData
                          foreach( QString format, mimeData.formats() )
                          {
                                 QByteArray data = mimeData->data(format);
                                 if( format.startsWith( QLatin1String("text/html"), Qt::CaseInsensitive )
                                 {
                                           data.replace(QByteArray("<strike>"), QByteArray("<s>"));
                                           data.replace(QByteArray("</strike>"), QByteArray("</s>"));
                                 }
                                 mimeDataCopy.setData( format,  data );
                           }
                    
                          QTextEdit::insertFromMimeData( &mimeDataCopy );
                    }
                    
                    S Offline
                    S Offline
                    sersver00
                    wrote on last edited by sersver00
                    #9

                    @raven-worx Thank you. Your idea works.
                    The question is solved

                    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