// Constructors. creates the grid with x rows, y columns
{
}
//Creates context menu in main program
void QGrid::setUpContextmenu()
{
addAction(deleterowAct);
setContextMenuPolicy(Qt::ActionsContextMenu);
}
void QGrid::createActions()
{
deleterowAct
= new QAction(IDS_DELETEROW,
this);
deleterowAct->setStatusTip(tr("Delete a row"));
connect(deleterowAct, SIGNAL(triggered()), this, SLOT(deleteTableRow()));
deleterowAct->setEnabled(true);
}
// delete row function
void QGrid::deleteTableRow()
{
this->removeRow(this->currentRow());
}
// Constructors. creates the grid with x rows, y columns
QGrid::QGrid(int x, int y,QWidget *parent) : QTableWidget(x,y,parent)
{
}
//Creates context menu in main program
void QGrid::setUpContextmenu()
{
addAction(deleterowAct);
setContextMenuPolicy(Qt::ActionsContextMenu);
}
void QGrid::createActions()
{
deleterowAct = new QAction(IDS_DELETEROW, this);
deleterowAct->setStatusTip(tr("Delete a row"));
connect(deleterowAct, SIGNAL(triggered()), this, SLOT(deleteTableRow()));
deleterowAct->setEnabled(true);
}
// delete row function
void QGrid::deleteTableRow()
{
QMessageBox::information(this,"hi","hello");
this->removeRow(this->currentRow());
}
To copy to clipboard, switch view to plain text mode
Bookmarks