Solved I wanna Add a button in the end of QTableView , i tried these ways but didn't work
-
No it is nothing to do with this method. This has no relation to another slots. Have you looked at the example which I have given y'day ?
-
@dheerendra
yes for sure i've checked it and make it as yours (initialized QSqlTableModel and QTableView in the header file)now i create another islolated header and cpp file and put the function i wanna do in them and also same problem that if i closed QTableView it closes the other class , it executes the function but also closes
this is the link of files on GitHub : https://github.com/MOSTAFAEZZAT/QTableViewProlem
Update : Sir this Problem is solved now it was because of initializing the next window by pointer not as usual object
i.e :class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = nullptr); ~MainWindow(); private slots: void on_pushButton_3_clicked(); void on_pushButton_4_clicked(); void on_pushButton_8_clicked(); private: Ui::MainWindow * ui; MainProcess mainprocess ; };
this is a piece of function which if the login done show the next Window else no
if(qry->exec()) { if(qry->next()) { model->setQuery(*qry); QString S = qry->value(0).toString() + "Login Successed "; QMessageBox::information(this,"Result",S) ; hide(); // mainprocess = new MainProcess(this) ; mainprocess.show(); } else { QMessageBox::information(this,"Result","Sorry Try Again") ; qDebug() << qry->lastError(); } }
so in previous
it was like that
MainProcess * mainprocessbut pls i just wanna know why it was destroying this window(MainProcess) if i closed QTableView .. And Thank you so much in Advance