qt - close qlistwidget deligate on double click on any item -
qt - close qlistwidget deligate on double click on any item -
i using qlistwidget deligate within cell of qtreeview. have written handler double click on item of qtreelist . double click handler qlistview deligate working fine.
my requirement on double click on item of qlistwidget deligate qlistwidget closes. please suggest exact signal used it.
slot double click on qtreewidgetlist item :---
void listwidgetdeligate::onlistwidgetitemdoubleclicked(qlistwidgetitem * item) { // emit signal close deligate }
double click handler pass qlistwidgetitem argument slot.
how can utilize argument close delicate means signal emit ?
if haven't found appropriate built-in signals widget can define own signal in .h file :
signals: void closeondoubleclick();
if need slot void listwidgetdeligate::onlistwidgetitemdoubleclicked(qlistwidgetitem * item)
emit signal , nil else, can do
connect(<the object of listwidgetdeligate>, signal(<signal connected slot onlistwidgetitemdoubleclicked>()), signal(closeondoubleclick()));
that means listwidgetdeligate emit signal closeondoubleclick()
after onlistwidgetitemdoubleclicked>() emitted.
thus, not need slot. remember, declared parameters of signal , slot connected each other must same.
qt
Comments
Post a Comment