[SOLVED]Destruct and rePaint a widget



  • Hi all,

    I have a problemi for "reload" a widget follow the code:

    @#include "Imigliori/imigliori.h"
    #include "ui_imigliori.h"
    #include "CineticList/listawidget.h"
    #include <QDebug>
    #include <QVBoxLayout>
    #include <SQLInteraction/sqlinteraction.h>

    IMigliori::IMigliori(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::IMigliori)
    {
    ui->setupUi(this);

    connect(ui->gamberi,SIGNAL(clicked()),this,SLOT(gamberi()));
    
    showLista = new QLinkedList<Ristorante*>();
    QString query("Select * From ristoranti where FORCHETTE = 3");
    showLista = SQLInteraction::instance()->queryRequest(query);
    lista = new listaWidget(showLista,this);
    lista->setGeometry(0,100,360,500);
    

    }

    IMigliori::~IMigliori()
    {
    delete lista;
    delete ui;
    }

    void IMigliori::paintEvent(QPaintEvent *event){
    qDebug()<< "PAINT EVENT IMIGLIORI";

    }

    void IMigliori::gamberi(){
    qDebug("Pulsante Gamberi()");
    delete lista;

    QString query("Select * From ristoranti where GAMBERI = 3");
    showLista = SQLInteraction::instance()->queryRequest(query);
    lista = new listaWidget(showLista,this);
    lista->setGeometry(0,100,360,500);
    

    // lista->update();
    }
    @

    in the construct I create the Widget "lista" that i have declared in the .h file.

    but i have to change it if i click the Button "ui->gamberi" but when i click the button the widget was deleted but was not rePaint however the construct of the widget "lista" was call.

    What is my error?

    Regards



  • Solved with a reload method implement in the list widget that cange the item to load!!! :)


Log in to reply
 

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