Breakpoint with QString Condition in QtCreator



  • Hi, is there a way how to set up more complex condition for breakpoint in QtCreator? At least comparing the QStrings. Integer comparsion like in tutorials works fine, but how about:

    void foo(QString bar){
     qDebug() << bar;
    }
    

    breakpoint on qDebug line and condition:
    bar == "BAR", or bar.equals("BAR")

    Is it possible, or just basic data types are available? If so, how?

    Thanks



  • Hi,
    Bump with same question.


  • Moderators

    Hi,

    Can you elaborate on this? What is it you want exactly?

    Eddy



  • I think I have the same problem. The condition does not seem to be evaluated. I have something like this in the condition field of my breakpoint:

    qstringVar.compare("some value") == 0
    

    However, the breakpoint is hit every iteration on that line although the qstringVar is not equal to the "some value". Why is that?



  • I got the same problem with a std::string. For instance using tmp.compare("some-value") == 0 with tmp being a std::string in the condition field does not work, i.e., the program stops whenever the breakpoint is reached even if the condition is not true.

    Is this a bug? I am using QtCreator 4.5.0.


Log in to reply
 

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