Unsolved Bloquear cambios en dialog pasados. /Block changes in old dialogs.
-
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);
}
-
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.