Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to blank/restore QWSScreenSaver ?



  • I am trying to get QWSScreenSaver to blank and restore my screen.
    I have tried a few different ways, but each time I seem to get stuck.
    Can anyone offer any advice on how to achieve this?
    Can I emit a signal from the screensaver that gets connected to my application and performs hide() and show().
    Or can I do this directly in the restore() and save() of the QWSScreenSaver?

    I would appreciate any pointers :-)

    My main is shown below

    @class SimpleScreenSaver : public QWSScreenSaver
    {
    public:
    void restore()
    {
    qDebug("SimpleScreenSaver::restore");
    // //Repaint the screen
    // //Turn the backlight on
    // ??
    };

    bool save(int level)
    {
    qDebug("SimpleScreenSaver::save");
    // //Blank the screen
    // ??
    // //Turn the backlight off
    // ??
    return true;
    };

    protected:
    };
    #endif

    int main(int argc, char argv[])
    {
    /
    Create application */
    QApplication app(argc, argv);
    QWSServer::setCursorVisible(false);

    /* Setup screen saver */
    QWSServer::setScreenSaver(new SimpleScreenSaver);
    QWSServer::setScreenSaverInterval(15000);
    QWSServer::setScreenSaverBlockLevel(0);

    MainDialog *maindialog = new MainDialog;
    

    maindialog->show();

    /* Run application */
    int ret = app.exec();

    /* Cleanup */
    QWSServer::screenSaverActivate(false);
    return ret;
    @



  • Jinxxy,

    Were you able to get this working? Would like to know because I'm trying to do the save thing.


Log in to reply