Qt World Summit: Submit your Presentation

QUrl non-class type

  • Compiling ok:
    @QUrl u;

    @QUrl u("");

    Compile error:
    @QUrl u();

    request for member 'setHost' in 'u', which is of non-class type 'QUrl()'

    What is wrong with this?

  • Moderators

    Syntax is incorrect. This should not work for all C++ classes, not only Qt classes.

    You need to use the parentheses only when you specify any arguments do an assignment like this:
    QUrl u;
    u = QUrl();

Log in to reply