Hello,
I am using the QT GUI editor to create a small aplication that displays my SQLITE data. I created a class called IdentitySQL that reads the data and returns a QTableView*. When I use the GUI editor, I dragged a tableview object into my main window and gave it the name identityTableView. I'm trying to set that tableview to the one I generated in my class.
ImsiViewerGui
::ImsiViewerGui(QWidget *parent
) : ui(new Ui::ImsiViewerGui)
{
ui->setupUi(this);
setTable();
}
ImsiViewerGui::~ImsiViewerGui()
{
delete ui;
}
void ImsiViewerGui
::changeEvent(QEvent *e
) {
switch (e->type()) {
ui->retranslateUi(this);
break;
default:
break;
}
}
void ImsiViewerGui::setTable()
{
IdentitySQL *isql = new IdentitySQL(this);
isql->connect("c:\\temp\\Identity.db");
ui->identityTableView = isql->createTableView( "IMSI Grabber ");
}
ImsiViewerGui::ImsiViewerGui(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::ImsiViewerGui)
{
ui->setupUi(this);
setTable();
}
ImsiViewerGui::~ImsiViewerGui()
{
delete ui;
}
void ImsiViewerGui::changeEvent(QEvent *e)
{
QMainWindow::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
ui->retranslateUi(this);
break;
default:
break;
}
}
void ImsiViewerGui::setTable()
{
IdentitySQL *isql = new IdentitySQL(this);
isql->connect("c:\\temp\\Identity.db");
ui->identityTableView = isql->createTableView( "IMSI Grabber ");
}
To copy to clipboard, switch view to plain text mode
In the above code, I set the ui object equal to the other table view but it will never show it when I start the application. The only way I can get this to work is if I edit the ui_<project name>.h file. Unfortunately, every time I made changes to the ui it regenerates the ui_ file and deletes my changes.
What is the best way to accomplish what I am trying to do? Is there a simple refresh command that I need to run or is there a better method?
Thanks in advance!
Emorgen
Bookmarks