44 #include "FunctionList.hh" 46 #include <QApplication> 48 FunctionList::FunctionList(QWidget *parent)
54 void FunctionList::mousePressEvent(QMouseEvent *event)
56 if (event->button() == Qt::LeftButton){
57 dragStartPosition_ =
event->pos();
58 QListWidgetItem* item = itemAt(event->pos().x(),
event->pos().y());
60 currentFn_ = item->text();
65 QListWidget::mousePressEvent(event);
68 void FunctionList::mouseMoveEvent(QMouseEvent *event)
70 if (!(event->buttons() & Qt::LeftButton))
72 if ((event->pos() - dragStartPosition_).manhattanLength()
73 < QApplication::startDragDistance())
76 QDrag *drag =
new QDrag(
this);
77 QMimeData *mimeData =
new QMimeData;
79 mimeData->setText( currentFn_ );
80 drag->setMimeData(mimeData);
82 drag->exec(Qt::CopyAction);
85 void FunctionList::filter(QString _filter){
87 for (
int i=0; i < count(); i++){
89 QString fnName = item(i)->text();
90 QString slotDescription;
92 QStringList descriptions;
94 emit getDescription(fnName, slotDescription, params, descriptions);
96 if ( fnName.contains(_filter,Qt::CaseInsensitive) || slotDescription.contains(_filter,Qt::CaseInsensitive) )
97 item(i)->setHidden(
false);
99 item(i)->setHidden(
true);
103 void FunctionList::reset(){
104 for (
int i=0; i < count(); i++)
105 item(i)->setHidden(
false);