Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Bloquear cambios en dialog pasados. /Block changes in old dialogs.
Qt 6.11 is out! See what's new in the release blog

Bloquear cambios en dialog pasados. /Block changes in old dialogs.

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 311 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • AracelyQtA Offline
    AracelyQtA Offline
    AracelyQt
    wrote on last edited by AracelyQt
    #1

    Hola, buen día y gracias por abrir mi pregunta.
    Desarrollé una interfaz en Qt que consiste en un sistema de alertas.
    La ventana principal sólo muestra una imagen y una barra de progreso, indicando que está a la espera de una alerta. La alerta llega a un arduino uno y la interfaz lo lee, la trama contiene algunos datos, entre ellos fecha y hora.

    Mi problema, es que cada nueva alerta, sobreescribe a las anteriores ventanas. Por ejemplo: La primer alerta llega a las 14:56:37 y este dato es mostrado en el dialog.
    Después, llega otra alerta a las 14:57:21 y el dialog anterior se sobreescribe con la nueva información. ¿Existe manera de separarlas o de bloquear los cambios en cuanto se abran?

    Hello, good day, thanks for open my question and sorry for my bad english.
    I developed an interface in Qt that consists of an alert system.
    The main window only shows an image and a progress bar, indicating that it is waiting for an alert. The alert arrives at an arduino one and the interface reads it, the plot contains some data, among them date and hour.

    My problem is that each new alert, overwrites the previous windows. For example: The first alert arrives at 14:56:37 and this data is shown in the dialog.
    Then, another alert arrives at 14:57:21 and the previous dialog is overwritten with the new information. Is there a way to separate them or block changes as soon as they open?

    MainWindow.h
    private:
    Ui::MainWindow *ui;

    QSerialPort *arduino;
    static const quint16 arduino_uno_vendor_id = 9025;
    static const quint16 arduino_UNO = 66;
    static const quint16 arduino_MEGA = 67;
    QString arduino_puerto;
    bool arduino_esta_disponible;
    
    alerta *ventana1;
    alerta *ventana2;
    alerta *ventana3;
    alerta *ventana4;
    alerta *ventana5; //I create 5 objects of class "alerta"
    

    MainWindow.cpp
    When the alert arrives, a counter(VentanaActual) increment in one. I did one if sentence for each object.
    if(VentanaActual==1){
    ventana1 = new alerta(this);
    ventana1->setVisible(true);

            ventana1->show();
    
    
            QMediaPlayer *rep = new QMediaPlayer; //Se declara un objeto de QMediaPlayer
            rep->setMedia(QUrl::fromLocalFile("/home/aracely/Proyecto-SAFEKEY/Sonidos/alarma.mp3")); //Indica la ruta del audio
            rep->setVolume(100); //Fija el volumen al 100%
            rep->play(); //Reproduce el archivo
            //}
                //}
    
            connect(this, SIGNAL(EnviarDatos(QStringList)), ventana1, SLOT(RecibirDatos(QStringList)));
            QStringList busDatos;
            busDatos.append(Dia);
            busDatos.append(Mes);
            busDatos.append(Anio);
            busDatos.append(Hora);
            busDatos.append(Min);
            busDatos.append(Seg);
            busDatos.append(Lat);
            busDatos.append(Long);
            busDatos.append(Cod);
    
            primeraVez=false;
            emit EnviarDatos(busDatos);
    

    }

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      From the looks of it, it seems you should handle your alerts differently. For example using a list of alert and showing/updating that list when a new one arrives.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved