How does this syntax of findText() work



  • 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.



  • 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.



  • 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?


  • Lifetime Qt Champion

    Hi,

    Where did you saw that code sample ?


  • Moderators

    @bask185 Do you mean here:

    const QString &subString
    

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



  • @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.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.