50 #include "FunctionList.hh"
52 #include <QApplication>
54 FunctionList::FunctionList(QWidget *parent)
60 void FunctionList::mousePressEvent(QMouseEvent *event)
62 if (event->button() == Qt::LeftButton){
63 dragStartPosition_ =
event->pos();
64 QListWidgetItem* item = itemAt(event->pos().x(),
event->pos().y());
66 currentFn_ = item->text();
71 QListWidget::mousePressEvent(event);
74 void FunctionList::mouseMoveEvent(QMouseEvent *event)
76 if (!(event->buttons() & Qt::LeftButton))
78 if ((event->pos() - dragStartPosition_).manhattanLength()
79 < QApplication::startDragDistance())
82 QDrag *drag =
new QDrag(
this);
83 QMimeData *mimeData =
new QMimeData;
85 mimeData->setText( currentFn_ );
86 drag->setMimeData(mimeData);
88 drag->exec(Qt::CopyAction);
91 void FunctionList::filter(QString _filter){
93 for (
int i=0; i < count(); i++){
95 QString fnName = item(i)->text();
96 QString slotDescription;
98 QStringList descriptions;
100 emit getDescription(fnName, slotDescription, params, descriptions);
102 if ( fnName.contains(_filter,Qt::CaseInsensitive) || slotDescription.contains(_filter,Qt::CaseInsensitive) )
103 item(i)->setHidden(
false);
105 item(i)->setHidden(
true);
109 void FunctionList::reset(){
110 for (
int i=0; i < count(); i++)
111 item(i)->setHidden(
false);