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. How does this syntax of findText() work

How does this syntax of findText() work

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 4 Posters 1.7k 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.
  • B Offline
    B Offline
    bask185
    wrote on last edited by
    #1

    I am trying to use this function but whatever I try I just cannot please the compiler.

    void QWebEngineView::findText(const QString &subString, QWebEnginePage::FindFlags options = QWebEnginePage::FindFlags())
    
    const QString S = "/// B.V.";
    engine->findText(&S, QWebEnginePage::xxx);
    Debug() << S;
    

    I don't understand the Qdoc and I don't know what to fill on the spot of the xxx.
    I don't have special options I want to make use of.

    m.sueM 1 Reply Last reply
    0
    • B bask185

      I am trying to use this function but whatever I try I just cannot please the compiler.

      void QWebEngineView::findText(const QString &subString, QWebEnginePage::FindFlags options = QWebEnginePage::FindFlags())
      
      const QString S = "/// B.V.";
      engine->findText(&S, QWebEnginePage::xxx);
      Debug() << S;
      

      I don't understand the Qdoc and I don't know what to fill on the spot of the xxx.
      I don't have special options I want to make use of.

      m.sueM Offline
      m.sueM Offline
      m.sue
      wrote on last edited by
      #2

      Hi @bask185

      You should call it with S not the address of S, and probably it's good enough to call it without explicitly using an option.

      It then selects the text, i.e. colors it with a usually blue background.

      -Michael.

      1 Reply Last reply
      1
      • B Offline
        B Offline
        bask185
        wrote on last edited by
        #3

        Why is there a '&' in the damned Qdocs? -_-"

        Anyways I made my compiler happy again with your suggestion but I am not getting the purpose of this function. I can let it search for a certain string and I am just not seeing what the actually function does. It doesn't return anything and it doesn't set anything?

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

          Hi,

          Where did you saw that code sample ?

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

          B 1 Reply Last reply
          0
          • B bask185

            Why is there a '&' in the damned Qdocs? -_-"

            Anyways I made my compiler happy again with your suggestion but I am not getting the purpose of this function. I can let it search for a certain string and I am just not seeing what the actually function does. It doesn't return anything and it doesn't set anything?

            jsulmJ Online
            jsulmJ Online
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @bask185 Do you mean here:

            const QString &subString
            

            ?
            Here & means that subString is a reference. Are you familiar with C++?

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • SGaistS SGaist

              Hi,

              Where did you saw that code sample ?

              B Offline
              B Offline
              bask185
              wrote on last edited by
              #6

              @SGaist said in How does this syntax of findText() work:

              Hi,

              Where did you saw that code sample ?

              I only read the Qdoc and there aren't code examples in like 95% of those, hence my discontent of Qdocs

              @jsulm said in How does this syntax of findText() work:

              @bask185 Do you mean here:

              const QString &subString
              

              ?
              Here & means that subString is a reference. Are you familiar with C++?

              Familiar enough to avoid & en * wherever it is possible, I studied electrical engineering not IT and our programming teacher was one helluva clown. Unfortunately for me I can't avoid them most of the time. I know how to use them most often but I don't understand them.

              Right now I know it well enough to get most stuff to work. I am already at like 3k lines of code and I expect I need another 1 or 2k before I am finished.

              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