void QLineEdit::mousePressEvent( QMouseEvent *e ) { killTimers(); d->inDoubleClick = FALSE; int margin = frame() ? 4 : 2; cursorPos = offset + xPosToCursorPos( &tbuf[(int)offset], fontMetrics(), e->pos().x() - margin, width() - 2*margin ); if ( e->button() == MidButton ) { #if defined(_WS_X11_) insert( QApplication::clipboard()->text() ); #else if ( style() == MotifStyle ) insert( QApplication::clipboard()->text() ); #endif return; #if 0 // it works, but it's wait until we have an API } else if ( hasMarkedText() && e->button() == LeftButton && ( (markAnchor > cursorPos && markDrag < cursorPos) || (markAnchor < cursorPos && markDrag > cursorPos) ) ) { QTextDrag * tdo = new QTextDrag( this ); tdo->setText( markedText() ); tdo->dragCopy(); delete tdo; return; #endif } int m1 = minMark(); int m2 = maxMark(); markAnchor = cursorPos; newMark( markAnchor, FALSE ); if ( cursorPos > m2 ) m2 = cursorPos; else if ( cursorPos < m1 ) m1 = cursorPos; repaintArea( m1, m2 ); dragScrolling = FALSE; }
void ClsFEGroupPlot::startDragging() { #ifdef DEBUG_CLSFEGROUPPLOT cout << "ClsFEGroupPlot::startDragging()" << endl; #endif QTextDrag *d = new QTextDrag( "", this ); d->setSubtype("iqr-plot"); string strParamList=dynamic_cast<ClsQNeuronStateVariableDisplay*>(clsQBaseStateVariableDisplay)->getSelectedStatesAsString(); string strRange = ""; QArray<int> qarraySelected = wSpacePlot->getSelecIndexList (); strRange = wSpacePlotSelected2Range(qarraySelected); string str = ""; str = ClsDragDropDeEncoder::encode(ClsFESystemManager::ITEM_GROUP, clsQBaseStateVariableDisplay->getItemID(), strParamList, strRange); d->setText(str.c_str()); d->dragMove(); };