QlistWidget,context menu and passing currentitem() to another form
Hi.
What I'm trying to do is load list of accounts from database to QlistWidget,then when I right click on account, a context menu pops out.
After I choose "Manage User", I want to get text from selected row and pass it to the open form.
Everything works well,the only problem is,that i have no idea how to get text form row using pos
A little bit of code:
Code:
QString RMClass
::ShowCXmenu(const QPoint
& pos
){
/////////////////////////////////////////////////////////////////////////////////////////////
openUsrMgr_WND
= new QAction(tr
("Manage User"),
this);
// openUsrMgr_WND->setStatusTip(tr(""));
connect(openUsrMgr_WND, SIGNAL(triggered()),this, SLOT(USRMGR()));
/////////////////////////////////////////////////////////////////////////////////////////////
//USRDELETE = new QAction(tr("Delete User"), this);
//usrmgg->setShortcut(QKeySequence::New);
// USRDELETE->setStatusTip(tr(""));
// connect(USRDELETE, SIGNAL(triggered()),this, SLOT(USRDEL()));
//////////////////////////////////////////////////////////////////////////////////////////////
myMenu.addAction(openUsrMgr_WND);
myMenu.addSeparator();
// myMenu.addAction(USRDELETE);
return UserNameCX; //that should return text from selected row
}
I also tried:
Code:
UserNameCX = ui->listWidget->currentItem()->text();
But everytime i right click inside listWidget program crashing
Thanks in advance
xer
Re: QlistWidget,context menu and passing currentitem() to another form
QListView::indexAt() or QListWidget::itemAt() will identify which index/item is under that point (if any)
Re: QlistWidget,context menu and passing currentitem() to another form
Hi..
It works...
Thank You Chris...