void QFormAdmin::OnPhysicTbPressed(int nId)
{
int nCols = dtMain->numCols();
int nRows = dtMain->numRows();
// try to clean data table
for (int i=0; i<nCols; i++)
dtMain->removeColumn(0);
for (int i=0; i<nRows; i++)
dtMain->removeRow(0);
dtMain->repaint();
switch(nId)
{
// виклик редактора гілок
case 1:
{
QSqlSelectCursor* curBr = new QSqlSelectCursor( "SELECT deleted FROM branches");
dtMain->setSqlCursor(curBr,false,true );
dtMain->addColumn("deleted", tr("Імя1"));
dtMain->refresh();
break;
}
// виклик редактора контролерів
case 2:
{
QSqlSelectCursor* curCtl = new QSqlSelectCursor( "SELECT controlers.description,controlers.logical_id,controlers.physical_id,controlers.active,controlers.branch,branches.description AS br_name,branches.port,branches.ip_address FROM controlers \
LEFT JOIN branches ON controlers.branch = branches.id");
dtMain->setSqlCursor(curCtl,false,true );
dtMain->addColumn("description", tr("Імя"));
dtMain->addColumn("logical_id", tr("Логічний №"));
dtMain->addColumn("physical_id", tr("Фізичний №"));
dtMain->addColumn("active", tr("Активний"));
dtMain->addColumn("br_name", tr("Імя вітки"));
dtMain->addColumn("port", tr("Порт"));
dtMain->addColumn("ip_address", tr("IP-адрес"));
dtMain->refresh();
break;
}
}
}
void QFormAdmin::OnPhysicTbPressed(int nId)
{
int nCols = dtMain->numCols();
int nRows = dtMain->numRows();
// try to clean data table
for (int i=0; i<nCols; i++)
dtMain->removeColumn(0);
for (int i=0; i<nRows; i++)
dtMain->removeRow(0);
dtMain->repaint();
switch(nId)
{
// виклик редактора гілок
case 1:
{
QSqlSelectCursor* curBr = new QSqlSelectCursor( "SELECT deleted FROM branches");
dtMain->setSqlCursor(curBr,false,true );
dtMain->addColumn("deleted", tr("Імя1"));
dtMain->refresh();
break;
}
// виклик редактора контролерів
case 2:
{
QSqlSelectCursor* curCtl = new QSqlSelectCursor( "SELECT controlers.description,controlers.logical_id,controlers.physical_id,controlers.active,controlers.branch,branches.description AS br_name,branches.port,branches.ip_address FROM controlers \
LEFT JOIN branches ON controlers.branch = branches.id");
dtMain->setSqlCursor(curCtl,false,true );
dtMain->addColumn("description", tr("Імя"));
dtMain->addColumn("logical_id", tr("Логічний №"));
dtMain->addColumn("physical_id", tr("Фізичний №"));
dtMain->addColumn("active", tr("Активний"));
dtMain->addColumn("br_name", tr("Імя вітки"));
dtMain->addColumn("port", tr("Порт"));
dtMain->addColumn("ip_address", tr("IP-адрес"));
dtMain->refresh();
break;
}
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks