Nominate our 2022 Qt Champions!

Best technique for this case

  • I need options to solve this problem: I want to support several domains in order to grab a few information on them, for example: CNN, USA Today, NY Times, Fox News and so on.
    Imagine that the user has a link to one of the networks listed above, and he puts it in a QLineEdit and press the button to submit, I want the application to parse the address and find who can handle that domain. I though of using the plugin system in order to register the handlers for the domains, but I don't know how to determinate who can handle who and call the right one.

    Is there a way to create handlers for each domain and determine who can handle the domain?

    Thank you.

  • Someone can help me here, please?

  • Hi and welcome to devnet,

    I think your question is too generic; anyway you could use QUrl to parse the user input and detect the domain.

    Are you trying to implement a feed reader?

  • @mcosta I think that I found what I was looking for, it's the chain of responsibility pattern, the only thing missing is how to return a value in a chain if the handler can handle and return an error if no handler can handle the network. Is this a case for use QVariant?

Log in to reply