Results 1 to 6 of 6

Thread: How to Run an URL link when checkBox is checked

  1. #1
    Join Date
    May 2014
    Posts
    3
    Thanks
    2
    Qt products
    Qt5
    Platforms
    Windows Android

    Default How to Run an URL link when checkBox is checked

    Hello everyone,
    I have looked around the forum as well as Qt documentation (I am still new to Qt) about running a link from qt. Can anyone help me with that. a simple example or some sort would be greatly appropriated.

    My goal here is using the Check-box state to activate the url. I was looking at Qurl but not many example are there on the internet. I cant post my code up here since it is a 1500 line of code program (and still expanding) that connect tightly to each other. but basically it is a interface design where i can choose what channel is activate by check the checkbox. if the checkbox is checked, it will run an url that control a piece of hardware over the cloud.
    thank in advance

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to Run an URL link when checkBox is checked

    What do you mean with "run an url"?

    Opening it in a browser? See QDesktopServices::openUrl()Fetching the datafrom the serve? See QNetworkAccessManager::get()
    Cheers,
    _

  3. The following user says thank you to anda_skoa for this useful post:

    soibac35 (15th May 2014)

  4. #3
    Join Date
    May 2014
    Posts
    3
    Thanks
    2
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: How to Run an URL link when checkBox is checked

    thanks for reply

    Those are useful information since eventually im gonna fetch log data to a table in the main windows.
    However, is there a way to NOT open the url in the browser ? (Since it is only support in desktop environment). I am looking for something that doesnt have to open the browser since the program will connect to the internet and can be convert-able to android (since running in android is the ultimate goal, for now i just want it in desktop to check if it work)

  5. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to Run an URL link when checkBox is checked

    It would be really helpful if you stated what you would like to achieve.

    "Run an URL link" doesn't mean anything, an URL is usually not an executable, it cannot be run.

    So you don't want to show a web page in a browser and you don't want to get the data of said web page.
    So what should your program do?

    Cheers,
    _

  6. #5
    Join Date
    May 2014
    Posts
    3
    Thanks
    2
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: How to Run an URL link when checkBox is checked

    Sorry if my intention was not clear.

    My project will run an IMP electric device where it will sample multiple signals. IMP is a device that help you to control anything over the cloud. So to control which channel will be activated, a address will be given to each state of the pin in this form https://agent.electricimp.com/QtWnl0k5V9OW?=channel_1=1. If you go to your browser and put this address in, the pin will be activated and the whole process of mumbo jumbo will follow .

    The project will need an GUI interface. This is where qt comes in. since the user only want to activate some of the channel, I used checkbox to indicate which channel user will use. When the check box is checked, I want that address above to run, and if not, it will do nothing or turn the activated pin off. << this is my main question for now

    One more thing is the sample data will be send over the cloud to some storage server. I also have a table where the data will be retrieved from that cloud server in real time if possible. << I am still not sure how to execute this one yet

    Those are the 2 things that i want to do at the moment. it would be great if there is some example code or some sort that i can study from
    Thank you for your help

  7. #6
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to Run an URL link when checkBox is checked

    So you are interacting with a web service and do not need to show a web page, right?

    In this case you are looking for QNetworkAccessManager.
    A browser that loads an HTTP URL uses an HTTP "get" request. That operation is QNetworkAccessManager::get()
    A browser that submits a web form usually sends a "post" request. That operation is QNetworkAccessManager:ost()

    Cheers,
    _

  8. The following user says thank you to anda_skoa for this useful post:

    soibac35 (20th May 2014)

Similar Threads

  1. Checked ListBox in Qt
    By sankar in forum Newbie
    Replies: 1
    Last Post: 6th July 2012, 23:55
  2. Replies: 4
    Last Post: 1st June 2011, 14:54
  3. Replies: 11
    Last Post: 5th May 2011, 14:05
  4. How to link a Push Button with a Web link ???
    By prajnaranjan.das in forum Newbie
    Replies: 3
    Last Post: 10th December 2010, 07:25
  5. Replies: 8
    Last Post: 2nd February 2009, 12:25

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.