void eDBField::setData( QWidget *o, aCfg *md ) { // const QObject *o = sender(); if ( o ) { if ( o->className() != QString("wDBField") || !md ) { reject(); return; } } else { reject(); return; } int w=0, d=0, idx=0; unsigned int i; long oid, widgetId, fieldId; QString pn; aWidget *widget; wDBField *field = (wDBField*)o; QWidget *pWidget = field->parentWidget(); while ( pWidget ) { pn = ""; pn = pWidget->className(); if ( pn == QString("wCatalogue") || pn == QString("wDocument") ) break; pWidget = pWidget->parentWidget(); } if ( pn == QString("wCatalogue") ) widget = (wCatalogue*)pWidget; else if ( pn == QString("wDocument") ) widget = (wDocument*)pWidget; else return; widgetId = widget->getId(); //fieldId = field->getId(); if ( widgetId ) widget->setMDObject( md->find( widgetId ) ); // printf( "parent widget id = %i\n", widgetId ); // printf( "field id = %i\n", fieldId ); // printf( "metadata id = %i\n", md->id( *widget->getMDObject() ) ); QStringList tlist = md->types( md_field, widget->getMDObject() ); otypes.clear(); eType->clear(); for ( QStringList::Iterator it = tlist.begin(); it != tlist.end(); ++it ) { otypes.append( (*it).section( "\t", 0, 0 ) ); eName->insertItem( (*it).section("\t", 1, 1 ), idx++ ); } for ( i = 0 ; i < otypes.count(); i++ ) { oid = 0; if( otypes[i][0] == 'O' ) { sscanf( (const char *)otypes[ i ], "O %d", &oid ); if ( oid == fieldId ) { eName->setCurrentItem( i ); break; } } } }
/*! * \en Creates catalog editor widget. \_en * \ru Создает виджет для редактирования каталога. * В принципе он не предусмотрен использоваться ни как иначе, кроме как часть * объекта wField, т.е его родительский объект должен быть wField * или его наследник для обеспечения корректной инициализации. * При создании объекта runtime не предусмотрено, за исключением случая, * когда виджет используется в составе wField в объекте wDBTable. * \param parent - \en parent object. \_en \ru родительский объект. \_ru * \param name - \en name \_en \ru имя \_ru * \param catname \en not used \_en \ru не используется \_ru */ wCatalogEditor::wCatalogEditor( wField *parent, const char *name, const char *catname) : QWidget(parent, name) { QWidget* w =0; md = NULL; QString str; label = new QLabel(parent, name); label->setFrameShape(QFrame::Box); w =(QWidget*) parent->parent()->parent(); str = parent->getFieldType(); catId = atoi(str.remove(0,2));// gets catalog id. if(w) { if(strcmp(w->className(),"wDBTable")==0) // wField is element wDBTable { initCat(((wDBTable*)w)->db); } } }
void VerticalLayout::doLayout() { bool needMove, needReparent; if ( !prepareLayout( needMove, needReparent ) ) return; QVBoxLayout *layout = (QVBoxLayout*)WidgetFactory::createLayout( layoutBase, 0, WidgetFactory::VBox ); for ( QWidget *w = widgets.first(); w; w = widgets.next() ) { if ( needReparent && w->parent() != layoutBase ) w->reparent( layoutBase, 0, QPoint( 0, 0 ), FALSE ); if ( qstrcmp( w->className(), "Spacer" ) == 0 ) layout->addWidget( w, 0, ( (Spacer*)w )->alignment() ); else layout->addWidget( w ); w->show(); } finishLayout( needMove, layout ); }
void JabberSearch::setSize() { if (!m_bDirty || (parent() == NULL)) return; m_bDirty = false; for (QWidget *p = this; p; p = p->parentWidget()){ QSize s = p->sizeHint(); QSize s1 = QSize(p->width(), p->height()); p->setMinimumSize(s); p->resize(QMAX(s.width(), s1.width()), QMAX(s.height(), s1.height())); log(L_DEBUG, "%s: %u %u %u %u", p->className(), s.width(), s.height(), s1.width(), s1.height()); if (p->layout()) p->layout()->invalidate(); if (p == topLevelWidget()) break; } QWidget *t = topLevelWidget(); QSize s = t->sizeHint(); t->resize(QMAX(t->width(), s.width()), QMAX(t->height(), s.height())); t->adjustSize(); }
bool Container::eventFilter(QObject *s, QEvent *e) { // kdDebug() << e->type() << endl; switch(e->type()) { case QEvent::MouseButtonPress: { m_insertBegin = QPoint(-1, -1); m_mousePressEventReceived = true; kdDebug() << "QEvent::MouseButtonPress sender object = " << s->name() << "of type " << s->className() << endl; kdDebug() << "QEvent::MouseButtonPress this = " << name() << endl; m_moving = static_cast<QWidget*>(s); QMouseEvent *mev = static_cast<QMouseEvent*>(e); m_grab = QPoint(mev->x(), mev->y()); // we are drawing a connection if(FormManager::self()->isCreatingConnection()) { drawConnection(mev); return true; } if(((mev->state() == ControlButton) || (mev->state() == ShiftButton)) && (!FormManager::self()->isInserting())) // multiple selection mode { if(m_form->selectedWidgets()->findRef(m_moving) != -1) // widget is already selected { if(m_form->selectedWidgets()->count() > 1) // we remove it from selection unSelectWidget(m_moving); else // the widget is the only selected, so it means we want to copy it { //m_copyRect = m_moving->geometry(); m_state = CopyingWidget; if(m_form->formWidget()) m_form->formWidget()->initBuffer(); } } else // the widget is not yet selected, we add it setSelectedWidget(m_moving, true, (mev->button() == RightButton)); } else if((m_form->selectedWidgets()->count() > 1))//&& (!m_form->manager()->isInserting())) // more than one widget selected { if(m_form->selectedWidgets()->findRef(m_moving) == -1) // widget is not selected, it becomes the only selected widget setSelectedWidget(m_moving, false, (mev->button() == RightButton)); // If the widget is already selected, we do nothing (to ease widget moving, etc.) } else// if(!m_form->manager()->isInserting()) setSelectedWidget(m_moving, false, (mev->button() == RightButton)); // we are inserting a widget or drawing a selection rect in the form if((/*s == m_container &&*/ FormManager::self()->isInserting()) || ((s == m_container) && !m_toplevel)) { int tmpx,tmpy; if(!FormManager::self()->snapWidgetsToGrid() || (mev->state() == (LeftButton|ControlButton|AltButton))) { tmpx = mev->x(); tmpy = mev->y(); } else { int gridX = m_form->gridSize(); int gridY = m_form->gridSize(); tmpx = int( (float)mev->x() / ((float)gridX) + 0.5 ); // snap to grid tmpx *= gridX; tmpy = int( (float)mev->y() / ((float)gridY) + 0.5 ); tmpy *= gridX; } m_insertBegin = (static_cast<QWidget*>(s))->mapTo(m_container, QPoint(tmpx, tmpy)); if(m_form->formWidget()) m_form->formWidget()->initBuffer(); if(!FormManager::self()->isInserting()) m_state = DrawingSelectionRect; } else { if(s->inherits("QTabWidget")) // to allow changing page by clicking tab return false; } if (m_objectForMouseReleaseEvent) { const bool res = handleMouseReleaseEvent(m_objectForMouseReleaseEvent, &m_mouseReleaseEvent); m_objectForMouseReleaseEvent = 0; return res; } return true; } case QEvent::MouseButtonRelease: { QMouseEvent *mev = static_cast<QMouseEvent*>(e); if (!m_mousePressEventReceived) { m_mouseReleaseEvent = *mev; m_objectForMouseReleaseEvent = s; return true; } m_mousePressEventReceived = false; m_objectForMouseReleaseEvent = 0; return handleMouseReleaseEvent(s, mev); } case QEvent::MouseMove: { QMouseEvent *mev = static_cast<QMouseEvent*>(e); if(m_insertBegin!=QPoint(-1,-1) && FormManager::self()->isInserting() && ((mev->state() == LeftButton) || (mev->state() == (LeftButton|ControlButton)) || (mev->state() == (LeftButton|ControlButton|AltButton)) || (mev->state() == (LeftButton|ShiftButton)) ) ) // draw the insert rect { drawInsertRect(mev, s); return true; } // Creating a connection, we highlight sender and receiver, and we draw a link between them else if(FormManager::self()->isCreatingConnection() && !FormManager::self()->createdConnection()->sender().isNull()) { ObjectTreeItem *tree = m_form->objectTree()->lookup(FormManager::self()->createdConnection()->sender()); if(!tree || !tree->widget()) return true; if(m_form->formWidget() && (tree->widget() != s)) m_form->formWidget()->highlightWidgets(tree->widget(), static_cast<QWidget*>(s)); } else if(m_insertBegin!=QPoint(-1,-1) && s == m_container && !m_toplevel && (mev->state() != ControlButton) && !FormManager::self()->isCreatingConnection()) // draw the selection rect { if((mev->state() != LeftButton) || /*m_inlineEditing*/ m_state == InlineEditing) return true; int topx = (m_insertBegin.x() < mev->x()) ? m_insertBegin.x() : mev->x(); int topy = (m_insertBegin.y() < mev->y()) ? m_insertBegin.y() : mev->y(); int botx = (m_insertBegin.x() > mev->x()) ? m_insertBegin.x() : mev->x(); int boty = (m_insertBegin.y() > mev->y()) ? m_insertBegin.y() : mev->y(); QRect r = QRect(QPoint(topx, topy), QPoint(botx, boty)); m_insertRect = r; if(m_form->formWidget()) m_form->formWidget()->drawRect(r, 1); m_state = DoingNothing; return true; } else if(mev->state() == (LeftButton|ControlButton)) // draw the insert rect for the copied widget { if(s == m_container)// || (m_form->selectedWidgets()->count() > 1)) return true; drawCopiedWidgetRect(mev); return true; } else if( ( (mev->state() == Qt::LeftButton) || (mev->state() == (LeftButton|ControlButton|AltButton)) ) && !FormManager::self()->isInserting() && (m_state != CopyingWidget)) // we are dragging the widget(s) to move it { if(!m_toplevel && m_moving == m_container) // no effect for form return false; if((!m_moving) || (!m_moving->parentWidget()))// || (m_moving->parentWidget()->inherits("QWidgetStack"))) return true; moveSelectedWidgetsBy(mev->x() - m_grab.x(), mev->y() - m_grab.y()); m_state = MovingWidget; } return true; // eat } case QEvent::Paint: // Draw the dotted background { if(s != m_container) return false; int gridX = m_form->gridSize(); int gridY = m_form->gridSize(); QPainter p(m_container); p.setPen(QPen(white, 2)); p.setRasterOp(XorROP); int cols = m_container->width() / gridX; int rows = m_container->height() / gridY; for(int rowcursor = 1; rowcursor <= rows; ++rowcursor) { for(int colcursor = 1; colcursor <= cols; ++colcursor) { p.drawPoint(-1 + colcursor *gridX, -1 + rowcursor *gridY); } } return false; } case QEvent::Resize: // we are resizing a widget, so we set m_move to true -> the layout will be reloaded when releasing mouse { if(m_form->interactiveMode()) m_state = MovingWidget; break; } //case QEvent::AccelOverride: case QEvent::KeyPress: { QKeyEvent *kev = static_cast<QKeyEvent*>(e); if(kev->key() == Key_F2) // pressing F2 == double-clicking { m_state = InlineEditing; QWidget *w; // try to find the widget which was clicked last and should be edited if(m_form->selectedWidgets()->count() == 1) w = m_form->selectedWidgets()->first(); else if(m_form->selectedWidgets()->findRef(m_moving) != -1) w = m_moving; else w = m_form->selectedWidgets()->last(); m_form->library()->startEditing(w->className(), w, this); } else if(kev->key() == Key_Escape) { if(FormManager::self()->isCreatingConnection()) FormManager::self()->stopCreatingConnection(); else if(FormManager::self()->isInserting()) FormManager::self()->stopInsert(); return true; } else if((kev->key() == Key_Control) && (m_state == MovingWidget)) { if(!m_moving) return true; // we simulate a mouse move event to update screen QMouseEvent *mev = new QMouseEvent(QEvent::MouseMove, m_moving->mapFromGlobal(QCursor::pos()), NoButton, LeftButton|ControlButton ); eventFilter(m_moving, mev); delete mev; } else if(kev->key() == FormManager::self()->contextMenuKey()) { FormManager::self()->createContextMenu(static_cast<QWidget*>(s), this, false); return true; } else if (kev->key() == Key_Delete) { FormManager::self()->deleteWidget(); return true; } // directional buttons move the widget else if(kev->key() == Key_Left){ // move the widget of gridX to the left moveSelectedWidgetsBy(-form()->gridSize(), 0); return true; } else if(kev->key() == Key_Right){ // move the widget of gridX to the right moveSelectedWidgetsBy(form()->gridSize(), 0); return true; } else if(kev->key() == Key_Up){ // move the widget of gridY to the top moveSelectedWidgetsBy(0, - form()->gridSize()); return true; } else if(kev->key() == Key_Down){ // move the widget of gridX to the bottom moveSelectedWidgetsBy(0, form()->gridSize()); return true; } else if((kev->key() == Key_Tab) || (kev->key() == Key_BackTab)){ ObjectTreeItem *item = form()->objectTree()->lookup(form()->selectedWidgets()->first()->name()); if(!item || !item->parent()) return true; ObjectTreeList *list = item->parent()->children(); if(list->count() == 1) return true; int index = list->findRef(item); if(kev->key() == Key_BackTab){ if(index == 0) // go back to the last item index = list->count() - 1; else index = index - 1; } else { if(index == int(list->count() - 1)) // go back to the first item index = 0; else index = index + 1; } ObjectTreeItem *nextItem = list->at(index); if(nextItem && nextItem->widget()) form()->setSelectedWidget(nextItem->widget(), false); } return true; } case QEvent::KeyRelease: { QKeyEvent *kev = static_cast<QKeyEvent*>(e); if((kev->key() == Key_Control) && (m_state == CopyingWidget)) { // cancel copying //m_copyRect = QRect(); if(m_form->formWidget()) m_form->formWidget()->clearForm(); } return true; } case QEvent::MouseButtonDblClick: // editing { kdDebug() << "Container: Mouse dbl click for widget " << s->name() << endl; QWidget *w = static_cast<QWidget*>(s); if(!w) return false; //m_inlineEditing = true; m_state = InlineEditing; m_form->library()->startEditing(w->className(), w, this); return true; } case QEvent::ContextMenu: case QEvent::Enter: case QEvent::Leave: case QEvent::FocusIn: case QEvent::FocusOut: // case QEvent::DragEnter: // case QEvent::DragMove: // case QEvent::DragLeave: return true; // eat them default: return false; // let the widget do the rest ... } return false; }
QWidget *KFileMetaInfoWidget::makeWidget() { QString valClass; QWidget *w; switch(m_value.type()) { case QVariant::Invalid: // no type // just make a label w = new QLabel(i18n("<Error>"), this, "label"); break; case QVariant::Int: // an int case QVariant::UInt: // an unsigned int w = makeIntWidget(); break; case QVariant::Bool: // a bool w = makeBoolWidget(); break; case QVariant::Double: // a double w = makeDoubleWidget(); break; case QVariant::Date: // a QDate w = makeDateWidget(); break; case QVariant::Time: // a QTime w = makeTimeWidget(); break; case QVariant::DateTime: // a QDateTime w = makeDateTimeWidget(); break; #if 0 case QVariant::Size: // a QSize case QVariant::String: // a QString case QVariant::List: // a QValueList case QVariant::Map: // a QMap case QVariant::StringList: // a QStringList case QVariant::Font: // a QFont case QVariant::Pixmap: // a QPixmap case QVariant::Brush: // a QBrush case QVariant::Rect: // a QRect case QVariant::Color: // a QColor case QVariant::Palette: // a QPalette case QVariant::ColorGroup: // a QColorGroup case QVariant::IconSet: // a QIconSet case QVariant::Point: // a QPoint case QVariant::Image: // a QImage case QVariant::CString: // a QCString case QVariant::PointArray: // a QPointArray case QVariant::Region: // a QRegion case QVariant::Bitmap: // a QBitmap case QVariant::Cursor: // a QCursor case QVariant::ByteArray: // a QByteArray case QVariant::BitArray: // a QBitArray case QVariant::SizePolicy: // a QSizePolicy case QVariant::KeySequence: // a QKeySequence #endif default: w = makeStringWidget(); } kdDebug(7033) << "*** item " << m_item.key() << "is a " << m_item.value().typeName() << endl; if(m_validator) kdDebug(7033) << " and validator is a " << m_validator->className() << endl; kdDebug(7033) << "*** created a " << w->className() << " for it\n"; return w; }
bool IMPluginSwitcher::keyPressed(QKeyEvent *p_keyPressEvent, ZInputField* field) //bool IMPluginSwitcher::keyReleased(QKeyEvent *p_keyPressEvent, ZInputField* field) //bool IMPluginSwitcher::hack(QKeyEvent *p_keyPressEvent, ZInputField* field) { toLog( "##### Start my keyPressed! "); bool ret = keyPressedInternal( p_keyPressEvent, field ); if ( field != NULL && p_keyPressEvent->key() == KEY_GREEN ) { toLog( "##### Key code is GREEN !!! " ); toLog( "##### Getting editor" ); QWidget * editor = field->getEditorWidget(); toLog( "##### Create action dlg" ); EDIT_FILD_TYPE tupeEditor = TYPE_UDEFINE; { //For not use more memory, to store class name QString s = QString(editor->className()); toLog( "##### Editor class: "+s ); if ( s.find("MultiLineEdit") != -1) tupeEditor = TYPE_MULTI_LINE_EDIT; else if ( s.find("LineEdit") != -1 ) tupeEditor = TYPE_LINE_EDIT; else if ( (s.find("ZTextEdit") != -1) || (s.find("MMS_PageWidget") != -1) ) tupeEditor = TYPE_TEXT_EDIT; else if ( s.find("SVGCanvas") != -1 ) return false; //Copy past don't work( } int selected=CANCEL_CODE; if ( onSelectText ) { toLog( "##### Auto select" ); selected = ACTION_SELECT_END; } else { QRect rect(0,0,SCREEN_WIDTH,SCREEN_HEIGHT); ZOptionsMenu * menu = new ZOptionsMenu (rect, editor);//editor->topLevelWidget() toLog( "##### Insert item to list" ); INSERT_ITEM(ZWidget::tr("TXT_RID_OPTION_COPY", "Copy"), ACTION_COPY); INSERT_ITEM(ZWidget::tr("TXT_RID_OPTION_INSERT", "Paste"), ACTION_PAST); int x1=0,x2=0,y1,y2; bool oldSel=false; if ( tupeEditor != TYPE_UDEFINE ) { INSERT_ITEM(ZWidget::tr("TXT_RID_MENU_CUT", "Cut"), ACTION_CUT); INSERT_SEP(); INSERT_ITEM(ZWidget::tr("TXT_RID_OPTION_SELECT_ALL", "onSelectText all"), ACTION_SELECT_ALL); INSERT_ITEM(ZWidget::tr("TXT_RID_HEADER_SELECT", "Select"), ACTION_SELECT_START); //save curren state of input fild and get cursor point QPoint pos(0,0); switch ( tupeEditor ) { case TYPE_MULTI_LINE_EDIT: pos = ((ZMultiLineEdit*)editor)->mapToGlobal(((ZMultiLineEdit*)editor)->cursorPoint()); oldSel = ((ZMultiLineEdit*)editor)->hasMarkedText(); if ( oldSel ) ((ZMultiLineEdit*)editor)->getMarkedRegion( &x1, &y1, &x2, &y2 ); else ((ZMultiLineEdit*)editor)->getCursorPosition( &x1, &y1 ); break; case TYPE_LINE_EDIT: pos = ((ZLineEdit*)editor)->mapToGlobal(((ZLineEdit*)editor)->cursorPoint()); oldSel = ((ZLineEdit*)editor)->hasMarkedText(); if ( !oldSel ) x1=((ZLineEdit*)editor)->cursorPosition(); break; case TYPE_TEXT_EDIT: default: pos = editor->mapToGlobal( field->getCursorPos() ); break; } menu->setPosition(ZOptionsMenu::TopLeft, pos ); } toLog( "##### Show dlg" ); menu->popup(); while ( !menu->isHidden() ) qApp->processEvents(); selected = menu->getCurrentSelectedItemId(); //load state of input fild if ( tupeEditor>0 ) { switch ( tupeEditor ) { case TYPE_MULTI_LINE_EDIT: if ( oldSel ) ((ZMultiLineEdit*)editor)->setSelection( x1, y1, x2, y2 ); else ((ZMultiLineEdit*)editor)->setCursorPosition( x1, y1, false ); break; case TYPE_LINE_EDIT: if ( oldSel ) { if ( GET_CURSOR_Y == -1 ) ((ZLineEdit*)editor)->selectAll(); else ((ZLineEdit*)editor)->setSelection( GET_CURSOR_X, GET_CURSOR_Y ); } else ((ZLineEdit*)editor)->setCursorPosition(x1); break; default: break; } } toLog( "##### Delete dlg" ); delete menu; menu = NULL; } if ( selected >= 0 ) { toLog( "##### Operate code:" << selected << " edit type:" << tupeEditor ); switch (tupeEditor) { case TYPE_UDEFINE: { switch (selected) { case ACTION_COPY: { QString text = field->getText(QPoint(-1,-1),true); QApplication::clipboard()->setText( text=="text/plain"?"":text ); toLog( "##### >Text:" + text ); break; } case ACTION_PAST: { field->insertString( field->getCursorPos(), QApplication::clipboard()->text()); break; } } break; } case TYPE_MULTI_LINE_EDIT: { switch (selected) { case ACTION_COPY: { ((ZMultiLineEdit*)editor)->copy(); break; } case ACTION_PAST: { ((ZMultiLineEdit*)editor)->paste(); break; } case ACTION_CUT: { ((ZMultiLineEdit*)editor)->cut(); break; } case ACTION_SELECT_ALL: { ((ZMultiLineEdit*)editor)->selectAll(); break; } case ACTION_SELECT_START: { int iSelX = 0; int iSelY = 0; ((ZMultiLineEdit*)editor)->getCursorPosition( &iSelX, &iSelY ); onSelectText = true; SET_CURSOR break; } case ACTION_SELECT_END: { if ( !onSelectText ) break; int iSelX = 0; int iSelY = 0; ((ZMultiLineEdit*)editor)->getCursorPosition( &iSelX, &iSelY ); ((ZMultiLineEdit*)editor)->setCursorPosition( GET_CURSOR_X, GET_CURSOR_Y, false ); ((ZMultiLineEdit*)editor)->setCursorPosition( iSelX, iSelY, true ); onSelectText = false; break; } } break; } case TYPE_TEXT_EDIT: { switch (selected) { case ACTION_COPY: { if ( ((ZTextEdit*)editor)->hasSelectedText() ) QApplication::clipboard()->setText( ((ZTextEdit*)editor)->selectedText() ); else QApplication::clipboard()->setText( ((ZTextEdit*)editor)->text() ); break; } case ACTION_PAST: { if ( ((ZTextEdit*)editor)->hasSelectedText() ) ((ZTextEdit*)editor)->del(); int iSelX = 0; int iSelY = 0; ((ZTextEdit*)editor)->getCursorPosition( &iSelX, &iSelY ); ((ZTextEdit*)editor)->insertAt(QApplication::clipboard()->text(), iSelX, iSelY); break; } case ACTION_CUT: { if ( ((ZTextEdit*)editor)->hasSelectedText() ) QApplication::clipboard()->setText( ((ZTextEdit*)editor)->selectedText() ); else QApplication::clipboard()->setText( ((ZTextEdit*)editor)->text() ); if ( ((ZTextEdit*)editor)->hasSelectedText() ) ((ZTextEdit*)editor)->del(); else ((ZTextEdit*)editor)->clear(); break; } case ACTION_SELECT_ALL: { ((ZTextEdit*)editor)->selectAll(true); break; } case ACTION_SELECT_START: { int iSelX = 0; int iSelY = 0; ((ZTextEdit*)editor)->getCursorPosition( &iSelX, &iSelY ); onSelectText = true; SET_CURSOR break; } case ACTION_SELECT_END: { if ( !onSelectText ) break; int iSelX = 0; int iSelY = 0; ((ZTextEdit*)editor)->getCursorPosition( &iSelX, &iSelY ); ((ZTextEdit*)editor)->setSelection( GET_CURSOR_X, GET_CURSOR_Y, iSelX, iSelY ); onSelectText = false; break; } } break; } case TYPE_LINE_EDIT: { switch (selected) { case ACTION_COPY: { if ( ((ZLineEdit*)editor)->hasMarkedText() ) QApplication::clipboard()->setText( ((ZLineEdit*)editor)->markedText() ); else { QString text = ((ZLineEdit*)editor)->text(); QApplication::clipboard()->setText( text=="text/plain"?"":text ); } break; } case ACTION_PAST: { ((ZLineEdit*)editor)->insert(QApplication::clipboard()->text()); break; } case ACTION_CUT: { if ( ((ZLineEdit*)editor)->hasMarkedText() ) QApplication::clipboard()->setText( ((ZLineEdit*)editor)->markedText() ); else QApplication::clipboard()->setText( ((ZLineEdit*)editor)->text() ); if ( ((ZLineEdit*)editor)->hasMarkedText() ) ((ZLineEdit*)editor)->del(); else ((ZLineEdit*)editor)->clear(); break; } case ACTION_SELECT_ALL: { ((ZLineEdit*)editor)->selectAll(); int iSelX=-1; int iSelY=0; SET_CURSOR break; } case ACTION_SELECT_START: { onSelectText = true; int iSelX=(((ZLineEdit*)editor)->cursorPosition()); int iSelY=0; SET_CURSOR break; } case ACTION_SELECT_END: { if ( !onSelectText ) break; int iSelY = ((ZLineEdit*)editor)->cursorPosition()-GET_CURSOR_X; int iSelX=GET_CURSOR_X; if ( iSelY > 0 ) ((ZLineEdit*)editor)->setSelection( GET_CURSOR_X, iSelY ); SET_CURSOR onSelectText = false; break; } } break; } } }