automatic closing output window on qt 5.3.2



  • hello can anyone tell me how to close window automatic in qt i used "onClicked: Qt.quit()" but i dont want to close on click


  • Moderators

    Could you please explain better what you want to do? What do you mean by "automatic"?



  • my main.qml file==>
    Rectangle
    {
    width: 300
    height:300
    color: "green"
    MouseArea
    {
    anchors.fill: parent
    onClicked: Qt.quit()
    }
    Text
    {
    text: qsTr("hello....")
    anchors.centerIn:parent
    color:"yellow"
    }
    }
    in above code "onClicked: Qt.quit()" this line close the qml output window when i clicked the button of mouse..is any function to close that window automatic after seeing the output?? i am newer in qt
    main.cpp==>
    #include "qtquick1applicationviewer.h"
    #include <QApplication>

    int main(int argc, char *argv[])
    {
    QApplication app(argc, argv);

    QtQuick1ApplicationViewer viewer;
    
    viewer.addImportPath(QLatin1String("modules"));
    viewer.setOrientation(QtQuick1ApplicationViewer::ScreenOrientationAuto);
    viewer.setMainQmlFile(QLatin1String("qrc:/main.qml"));
    viewer.setWindowFlags(Qt::FramelessWindowHint);
    QApplication::setOverrideCursor(QCursor(Qt::BlankCursor));
    viewer.showExpanded();
    return app.exec();
    

    }


  • Moderators

    I still don't understand what you mean by "automatic". After some time?



  • means after some interval?



  • import QtQuick 1.1

    Rectangle
    {
    width: 500
    height:300
    color: "red"
    MouseArea
    {
    anchors.fill: parent
    ** interval: 500; running: true; repeat: true
    onTriggered: Qt.quit()
    **
    }
    Text
    {
    width: 100
    height:100
    text: qsTr ("hello....")
    anchors.centerIn:parent
    color:"black"
    }
    }

    i am using this but cant get output...



  • solved my issue by
    Rectangle
    {
    id : root
    width: 500
    height:300
    color: "red"
    MouseArea
    {
    anchors.fill: parent.Center
    Item
    {
    Timer
    {
    interval: 5000; running: true; repeat: true
    onTriggered: Qt.quit()
    }
    Text { id: time }
    }

      }
    
    Text
    {
        width:30
        height:20
        text: qsTr ("hello....")
        anchors.centerIn: parent
        color:"black"
    }
    

    }


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.