Menu

Main Menu
Talk Get Daily Search

Member's Online

    User Name
    Password

    qt4 homescreen widget refresh

    Reply
    OliverN900 | # 1 | 2010-12-31, 13:27 | Report

    I'm just starting out with Qt4 and C++ in general. I've downloaded the qt4-homescreen-example and followed the instructions on this page.

    I took the testwidget.h from the example and reworked that so that it calls (QProcess) a helper-script that calls wget on a certain url and outputs to a file, the contents of that file are then displayed in the QLabel through QFile and QTextStream. So far it's working.

    QNetworkManager was a little over my head, plus this method gives me a means to check the wget-output in a terminal.


    The remote file is updated every 10 minutes, so I want to do the same with the widget. I added a timer (either for 6 or 600 seconds) like the one in the qt4 analogclok example, but it seems to be completely ignored.

    Should QTimer work on homescreen widgets?
    Can I go about this another way?

    Here's what I slapped together up until now:
    http://devio.us/~oliverh/servermonitor.html

    Yes, this is all done in the header file and yes using words from my native language is a conscious choice helping me to learn C++.

    I use scratchbox and vim for development, nothing else.

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following 2 Users Say Thank You to OliverN900 For This Useful Post:
    Creamy Goodness, Venemo

     
    Venemo | # 2 | 2010-12-31, 21:45 | Report

    Yes, QTimer should work just fine.

    In your code, you connected the QTimer with the update() slot of the widget. However in the update slot you don't do anything related to the QFile. That is the reason.

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following User Says Thank You to Venemo For This Useful Post:
    OliverN900

     
    OliverN900 | # 3 | 2011-01-03, 02:08 | Report

    I see what you mean. It's working now, thanks!

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following User Says Thank You to OliverN900 For This Useful Post:
    Venemo

     
vBulletin® Version 3.8.8
Normal Logout