QStringList : Can't access to member functions



  • Hi everyone,
    I don't know why, i can't access to the member functions of QStringList but i can access to all the inherited functions...

    Do you have an idea?


  • Lifetime Qt Champion

    Hi,

    That's a bit vague as a question. What member function can't you access ?

    By the way, what version of Qt are you using ?
    On what platform ?



  • @SGaist

    Thank you for your answer,

    i can't access any public functions of QStringList like sort() or removeDuplicates() , only the ones inherited from QList.

    I'm using Qt 5.10


  • Lifetime Qt Champion

    Can you show a sample code that triggers this as well as the exact error message ?



  • @SGaist
    (Sorry if my english is bad, it's not my mother language)

    void FenServeur::recuperationPseudo(const QString &message, client *emetteur)
    {
        QRegularExpression patternPseudo(">(.+)<");
        QRegularExpressionMatch match = patternPseudo.match(message);
    
        if (match.hasMatch())
        {
            const QString matched = match.captured(1); // matched == "pseudo"
            emetteur->setPseudo(matched);
            pseudosListe << matched;        
            pseudosListe.sort();
            pseudosListe.removeDuplicates();
        }
    }
    

    There is no error, it compile...
    it's just , that do nothing.

    in Qt when you start to type a function it show you a list of functions that you can use, the public functions of QStringList are not in.

    and of course if i write the entire name of the function it's not colored so i presume it's not recognized.

    but when i run minGW there is no warning, error etc but the function don't work at the execution like sort() don't sort the list.


  • Lifetime Qt Champion

    If it compiles then there's no problem code wise.

    The fact that is "doesn't do anything" is highly suggestive. How do you know it "doesn't do anything" ? How do you know the list is not sorted ? What does message contain ?



  • I know it because i can see it in a QTextEdit at the axecution that it is not sorted.
    "Message" contain the name and message comming from a client.
    The code that i have wrote is in the server code.
    This code take the name from the message and put it in a QStringList.

    Edit: You were right, i am a big idiot, the list is sorted i'm confused.
    Thank you for wasting your time on this !


Log in to reply
 

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