You may get the index at the cursor position and check whether it's valid:
void fileHandler
::ctxMenu(const QPoint &pos
)//started {
if(!index.isValid())
return;
void fileHandler::ctxMenu(const QPoint &pos)//started
{
QModelIndex index = m_ui->tableWidget->indexAt(pos);
if(!index.isValid())
return;
QMenu *menu = new QMenu;
To copy to clipboard, switch view to plain text mode
Another way, getting the QTableWidgetItem:
void fileHandler
::ctxMenu(const QPoint &pos
)//started {
if(!item)
return;
void fileHandler::ctxMenu(const QPoint &pos)//started
{
QTableWidgetItem *item = m_ui->tableWidget->itemAt(pos);
if(!item)
return;
QMenu *menu = new QMenu;
To copy to clipboard, switch view to plain text mode
Bookmarks