void SketchToolButton::actionEvent(QActionEvent *event) { switch (event->type()) { case QEvent::ActionChanged: if (event->action() == defaultAction()) { setEnabled(defaultAction()->isEnabled()); // update button state } break; default: QToolButton::actionEvent(event); } }
void ComboBoxAction:: setCheckedAction( QAction* a ) { if (!actions().contains(a)) addActionItem(a); if (a != defaultAction()) { defaultAction()->setChecked(false); } setDefaultAction(a); a->setChecked(true); setChecked(true); }
void ListStyleButton::itemSelected(QAction *action) { if(action != defaultAction()) { m_lastAction = action; } emit itemTriggered(m_actionMap[m_lastAction]); }
bool C3DSLightReader::onChunk(const Chunk& chunk) { switch ( chunk.id ) { case LIGHT_CHUNK: { Light light; read(light.position); m_lights.push_back(light); return true; } case SPOT_LIGHT_CHUNK: { Light& light = m_lights.back(); light.isSpotLight = true; read(light.spotTarget); read(light.hotSpot); read(light.falloff); return false; } case LIGHT_OFF: { m_lights.back().lightOff = true; return false; } case LIGHT_ATTENUATION_ON: { m_lights.back().attenuationOn = true; return false; } default: return defaultAction(chunk); } }
void ComboBoxAction:: addActionItem( QAction* a ) { addAction( a ); if (0 == defaultAction()) setDefaultAction(a); }
void CWizUserInfoWidgetBase::mousePressEvent(QMouseEvent* event) { // show menu at proper position if (hitButton(event->pos())) { QPoint pos(event->pos().x(), sizeHint().height()); menu()->popup(mapToGlobal(pos), defaultAction()); } }
void QWaylandDrag::updateTarget(const QString &mimeType) { setCanDrop(!mimeType.isEmpty()); if (canDrop()) { updateCursor(defaultAction(drag()->supportedActions(), m_display->currentInputDevice()->modifiers())); } else { updateCursor(Qt::IgnoreAction); } }
void QWaylandDrag::setResponse(const QPlatformDragQtResponse &response) { setCanDrop(response.isAccepted()); if (canDrop()) { updateCursor(defaultAction(drag()->supportedActions(), m_display->currentInputDevice()->modifiers())); } else { updateCursor(Qt::IgnoreAction); } }
Action *TestDispatcher::getHandler(string action) { //Esto será una tabla o una clase o similar if ( action.compare("test") == 0 ) return TestAction::createHandler(); return defaultAction(action); }
void SBWidget::UnfoldTabClass (const TabClassInfo& tc) { if (!TabClass2Folder_.contains (tc.TabClass_)) return; auto button = TabClass2Folder_.take (tc.TabClass_); delete button->defaultAction (); delete button; Q_FOREACH (QAction *act, TabClass2Action_ [tc.TabClass_]) CurTab2Button_ [act] = AddTabButton (act, Ui_.TabsLay_); }
void SBWidget::RemoveTabButton (QAction *act, QLayout *lay) { for (int i = 0; i < lay->count (); ++i) { auto tb = qobject_cast<QToolButton*> (lay->itemAt (i)->widget ()); if (tb && tb->defaultAction () == act) { tb->deleteLater (); lay->removeWidget (tb); break; } } }
Qt::DropAction QDragManager::drag(QDrag *o) { Q_ASSERT(!qt_symbian_dnd_dragging); if (object == o || !o || !o->source()) return Qt::IgnoreAction; if (object) { cancel(); qApp->removeEventFilter(this); beingCancelled = false; } object = drag_object = o; oldstate = Qt::NoModifier; // #### Should use state that caused the drag willDrop = false; updatePixmap(); updateCursor(); #ifndef QT_NO_CURSOR qt_symbian_set_cursor_visible(true); //force cursor on even for touch phone #endif object->d_func()->target = 0; qApp->installEventFilter(this); global_accepted_action = defaultAction(dragPrivate()->possible_actions, Qt::NoModifier); qt_symbian_dnd_dragging = true; eventLoop = new QEventLoop; // block (void) eventLoop->exec(QEventLoop::AllEvents); delete eventLoop; eventLoop = 0; #ifndef QT_NO_CURSOR qt_symbian_set_cursor_visible(false); overrideCursor = QCursor(); //deref the cursor data qt_symbian_dnd_dragging = false; #endif return global_accepted_action; }
void updateCell(const QModelIndex& index, MWidget *cell) const { MContentItem *contentItem = qobject_cast<MContentItem *>(cell); QObject::connect(contentItem, SIGNAL(clicked()), m_page, SLOT(defaultAction()), Qt::UniqueConnection); contentItem->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); QString type = index.data(McaFeedModel::RequiredTypeRole).toString(); QString name = index.data(McaFeedModel::GenericTitleRole).toString(); QString body = index.data(McaFeedModel::GenericContentRole).toString(); if (type == "content") name.prepend("Content: "); else if (type == "request") { name.prepend("Request: "); body.prepend("[Accept] [Decline] "); } contentItem->setTitle(name); contentItem->setSubtitle(body); m_page->addButtonIndexMapping(contentItem, index); }
virtual void updateContext() { defaultAction()->setSelectionContext(selectionContext()); if (selectionContext().isValid()) { defaultAction()->setEnabled(isEnabled(selectionContext())); defaultAction()->setVisible(isVisible(selectionContext())); defaultAction()->setCheckable(true); QmlItemNode itemNode = QmlItemNode(selectionContext().currentSingleSelectedNode()); if (itemNode.isValid()) defaultAction()->setChecked(itemNode.instanceValue("visible").toBool()); else defaultAction()->setEnabled(false); } }
void Queen::update(float frameTime){ if(getActive()) { if(cooldown > 0) cooldown -= frameTime; if(cooldown <= 0) cooldown = 0; //age age += frameTime; if(age > antNS::QUEEN_LIFE_EXPECTANCY) health -= antNS::OLD_AGE_DAMAGE * frameTime; //eat food foodLevel -= antNS::METABOLISM*frameTime; if(foodLevel < 0) health -= antNS::STARVATION_DAMAGE * frameTime; //determine behavior if(foodLevel < antNS::QUEEN_STOMACH_SIZE *0.25) behavior = Behavior::BEGGING; else behavior = Behavior::DEFAULT; if(behavior == Behavior::DEFAULT) { defaultAction(frameTime); } if(behavior == Behavior::BEGGING) { hungryAction(frameTime); } //reset signals for(int i = 0 ; i < antNS::NUM_SIMULTANEOUS_SIGNALS; i++) { signals[i] = Signal(); } if(health <= 0) die(); } }
void PDFWindow :: keyPressEvent(QKeyEvent* event) { int Key = event -> key(); if(Key >= Qt::Key_0 && Key <= Qt::Key_9 && event -> modifiers() == Qt::NoModifier) { // The input is a number NumPrefix.append(Key); // Key is also the ascii/unicode of the character. std::cerr << "NumPrefix = " << NumPrefix.toStdString() << std::endl; return; } QKeySequence Seq(event -> key() + event -> modifiers()); if(KeyBindings.find(Seq) == KeyBindings.end()) { std::cerr << Seq.toString().toStdString() << " captured. "; defaultAction(*this); return; } KeyBindings[Seq](*this); NumPrefix.clear(); return; }
virtual void updateContext() { defaultAction()->setSelectionContext(selectionContext()); if (selectionContext().isValid()) { defaultAction()->setEnabled(isEnabled(selectionContext())); defaultAction()->setVisible(isVisible(selectionContext())); defaultAction()->setCheckable(true); QmlItemNode itemNode = QmlItemNode(selectionContext().currentSingleSelectedNode()); if (itemNode.isValid()) { bool flag = false; if (itemNode.modelNode().hasProperty(m_propertyName) || itemNode.propertyAffectedByCurrentState(m_propertyName)) { flag = itemNode.modelValue(m_propertyName).toBool(); } defaultAction()->setChecked(flag); } else { defaultAction()->setEnabled(false); } } }
/******************************* MAIN ***********************/ void main(void) { short wrFlag = 1; short errFlag = 1; short key = 0; /* System restore conditions. */ short SaveQSExt = 0; short SaveQSOn = 0; unsigned long abc; short FuncFlg = 0; char strTime[80]; char *a, *b, *c, *d; unsigned long word; short settleDelay; Diode_SetPt =Diode_SetPt2= 0; LOOP = 10; TPFLAG = 0; BEEPER = 0; DspTmr = 0; /* Initialize registers and variables */ Initialize(); /*** SETUP LCD DISPLAY ***/ LCDSetup(); /* Make sure the shutter is off on start up. */ shutterOff(); //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% while(1) { /* Check to see if the key switch is on. */ if(!KEYSW_ON) wait(20); if( !KEYSW_ON && !OLD_KEYSW_ON && !WriteFlag) keyswOffAction (&SaveQSExt,&SaveQSOn,&key); if( KEYSW_ON) wait(20); if( KEYSW_ON && !OLD_KEYSW_ON ) { //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% keyswFirstOnAction(&settleDelay,&SaveQSExt,&SaveQSOn); } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% if(InitingError==0) { //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% while( KEYSW_ON ) { *PCDATDIR = 0xF00F; /* ANY KEY PRESSED ?*/ //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //*PCDATDIR = 0xF000; if(SecurityIniting==1) { *PCDATDIR = 0xF0F0; //tang suojianpan } else { *PCDATDIR = 0xF000; } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% while(((*PCDATDIR & 0x0003)==3)&&((*PFDATDIR & 0x0003)==3)&& KEYSW_ON) {//no key pressed if( !ADTIMER ) { tempctl(); //0.1sec DspTmr++; //%%%%%%%%%%%%%%%%%%%%%%%%%%% if(SecurityIniting==1) { TimeC_Sec++; if(TimeC_Sec==10) { TimeC_Sec=0; TimeC_Min++; } if(TimeC_Min==60) { TimeC_Min=0; TimeC_2Min++; TimeC_8Min++; } if(TimeC_2Min==1) { TimeC_2Min=0; Sign_2Min=1; } if(TimeC_8Min==5) { TimeC_8Min=0; Sign_8Min=1; } } //%%%%%%%%%%%%%%%%%%%%%%%%%%% } if(REMLOC) { FUNCTION=15; *IMR=*IMR|0x10; } else {if(FUNCTION==15) {FUNCTION=0; } *IMR=*IMR&0xEF; } if(LOOP) continue; /* Do this every 0.5sec */ if(!LOOP) LOOP = 10000; LCDRefresh(&DspTmr); //============================================================================== /* Test temperature and make sure it is within acceptable range. * The temperature should be greater than or equal to 15 degrees C * less than or equal to 35 degrees C. */ //============================================================================== if( KEYSW_ON && OLD_KEYSW_ON) //default ACTION every 0.5sec (LOOP) defaultAction(&errFlag,&wrFlag); //%%%%%%%%%%%%%%%%%%%%% if(InitingError==0) { if(SecurityIniting==1) { switch(FirstStemp) { case 1: QSWON = 1; QSWEXT = 1; qswonAction(); RF_OFF=0; // diodeAction_1(0,0.8*INITCUR); //test QSWEXT = 1; qswextAction(); diodeAction_1(0,0.6*INITCUR,0,0.6*INITCUR2); TimeC_2Min=0; Sign_2Min=0; FirstStemp=2; break; case 2: if(Sign_2Min==1) { FirstStemp=3; } break; case 3: diodeAction_1(0.6*INITCUR,INITCUR,0.6*INITCUR2,INITCUR2); TimeC_8Min=0; Sign_8Min=0; //FirstStemp=4; FirstStemp=5; //tang break; case 4: if(Sign_8Min==1) { FirstStemp=5; } break; case 5: SecurityIniting=0; BEEPER = 1; wait(50); BEEPER = 0; *PCDATDIR = 0xF00F; *PCDATDIR = 0xF000; FirstStemp=0; break; default:break; } } } //%%%%%%%%%%%%%%%%%%%%% } //%%%%%%%%%%%%%%%%%%%%%%%%%%% if(InitingError==0) { if(SecurityIniting==0) { //%%%%%%%%%%%%%%%%%%%%%%%%%%% //key is pressed, start scanning BEEPER = 1; wait(50); BEEPER = 0; /* Check Remote/Local key */ /* SET ROW 40 STROBE */ *PCDATDIR = ~0x0F40; wait(1); /* TOGGLE REMOTE/LOCAL MODE */ //if( (!(*PCDATDIR & 0x0002)) && (!FUNCTION) ) if((!FUNCTION)||(REMLOC==1)) { if (!(*PCDATDIR & 0x0002)) wait(20); if( !(*PCDATDIR & 0x0002) ) {REMLOC = !REMLOC; if(REMLOC) { HOLD[0] = 'R'; HOLD[1] = 'E'; HOLD[2] = 'M'; } else { HOLD[0] = 'L'; HOLD[1] = 'O'; HOLD[2] = 'C'; } PLACE=101; wrtchrs(3); } while( !(*PCDATDIR & 0x0002) ); /* REMOTE */ if(REMLOC) { FUNCTION=15; sciPolling(); } else {if(FUNCTION==15) FUNCTION=0;} } /*RESET KEY CHECK AND ACTION */ /*SET ROW 40 STROBE */ *PCDATDIR = ~0x0F40; while(TPFLAG) { if( !(*PCDATDIR & 0x0001) ) /* RESET BUTTON */ { wait(10); if( !(*PCDATDIR & 0x0001) ) { RESET = 1; clearWarning=0; TPFLAG = 0; } while( !(*PCDATDIR & 0x0001) ) if(!KEYSW_ON) port00 = 0x0008; } } /*ENTER KEY CHECK AND ACTION TANG */ /*SET ROW 40 STROBE */ *PCDATDIR = ~0x0F40; if( !(*PFDATDIR & 0x0002) && (!FUNCTION) && (!(FUNCTION == 3)) ) /* ENTER BUTTON */ { wait(10); if( !(*PFDATDIR & 0x0002) ) DIODESELECT=!DIODESELECT; while( !(*PFDATDIR & 0x0002) ); } /*Q-SWITCH INTERNAL/ENTERNAL KEY CHECK AND ACTION*/ /* SET ROW 10 STROBE */ *PCDATDIR = ~0x0F10; wait(1); //DIODE_ON: if( (!(*PCDATDIR & 0x0001)) && (!FUNCTION) && (!(FUNCTION == 3)) ) { wait(10); if( !(*PCDATDIR & 0x0001 )) { RF_OFF = !RF_OFF; diodeAction(); while( !(*PCDATDIR & 0x0001 )); } } //QSW EXT/INT: if( (!(*PCDATDIR & 0x0002)) && (!FUNCTION) && (!(FUNCTION == 3)) ) { wait(10); PLACE = 88; if( !(*PCDATDIR & 0x0002) ) { QSWEXT = !QSWEXT; qswextAction(); while( !(*PCDATDIR & 0x0002) ); } } /* Q-SWITCH ON/OFF KEY CHECK AND ACTION */ if(QSWEN==0) { if( (!(*PFDATDIR & 0x0001) && (!FUNCTION)) && (!(FUNCTION == 3))&&(EXTDCUR<10)&&(EXTDCUR2<10) ) ///tang???? { wait(10); if( !(*PFDATDIR & 0x0001) ) { QSWON = !QSWON; qswonAction(); while( !(*PFDATDIR & 0x0001) ); } } } else { if( (!(*PFDATDIR & 0x0001) && (!FUNCTION)) && (!(FUNCTION == 3)) ) { wait(10); if( !(*PFDATDIR & 0x0001) ) { QSWON = !QSWON; qswonAction(); while( !(*PFDATDIR & 0x0001) ); } } } /* SHUTTER ON/OFF KEY CHECK AND ACTION */ if( (!(*PFDATDIR & 0x0002)) && (!FUNCTION) && (!(FUNCTION == 3)) ) { wait(10); if( !(*PFDATDIR & 0x0002) ) { PLACE = 99; SHTON = !SHTON; shtonAction(); while( !(*PFDATDIR & 0x0002) ); } } /* SET ROW 20 STROBE */ *PCDATDIR = ~0x0F20; wait(1); /* PULSE RATE CHECK AND ACTION */ /* INCREMENT */ UPDRAT = 10; while( (!(*PCDATDIR & 0x0001)) && (!FUNCTION) && (!QSWEXT) ) { if( PULSERATE / 100000 ) PULSERATE = PULSERATE + 1000; // ++ else // ++ if( PULSERATE / 1000 ) PULSERATE = PULSERATE + 100; else PULSERATE++; //if( PULSERATE > 99999 ) PULSERATE = 100000; //频率上限100K //if( PULSERATE > 119999 ) PULSERATE = 120000; //频率上限120K if( PULSERATE > 149999 ) PULSERATE = 150000;//频率上限150K PLACE = 71; num2ascii(PULSERATE,1); pulseRateAction(); if( UPDRAT ) wait(250); else wait(25); if( UPDRAT ) UPDRAT--; } /* DECREMENT */ UPDRAT = 10; while( (!(*PCDATDIR & 0x0002)) && (!FUNCTION) && (!QSWEXT) ) { if( PULSERATE == 1000 ) PULSERATE = 999; else if( PULSERATE / 100000 ) PULSERATE = PULSERATE - 1000; // ++ else // ++ if( PULSERATE / 1000 ) PULSERATE = PULSERATE - 100; else PULSERATE--; if( PULSERATE < 10 ) PULSERATE = 10; PLACE = 71; num2ascii(PULSERATE, 1); pulseRateAction(); if( UPDRAT ) wait(500); else wait(50); if( UPDRAT ) UPDRAT--; } /* INCREASE DIODE CURRENT CHECK AND ACTION */ /* INCREMENT */ UPDRAT = 10; if(QSWEN==0) { while( (!(*PFDATDIR & 0x0001)) && (!FUNCTION) && (QSWON==1) ) { DIODECUR++; /* LIMIT ON CURRENT OUTPUT */ if( DIODECUR > DIMAX ) DIODECUR = DIMAX; if(DIMAX > 250) *T3CMPR = (DIODECUR<<2); else *T3CMPR = (DIODECUR<<2); PLACE = 25; num2ascii(DIODECUR,0); if( UPDRAT ) wait(500); else wait(50); if( UPDRAT ) UPDRAT--; Diode_SetPt= DIODECUR; } } else { while( (!(*PFDATDIR & 0x0001)) && (!FUNCTION) ) { DIODECUR++; /* LIMIT ON CURRENT OUTPUT */ if( DIODECUR > DIMAX ) DIODECUR = DIMAX; if(DIMAX > 250) *T3CMPR = (DIODECUR<<2); else *T3CMPR = (DIODECUR<<2); PLACE = 25; num2ascii(DIODECUR,0); if( UPDRAT ) wait(500); else wait(50); if( UPDRAT ) UPDRAT--; Diode_SetPt= DIODECUR;} } /*DECREMENT */ UPDRAT = 10; if(QSWEN==0) { while( (!(*PFDATDIR & 0x0002)) && (!FUNCTION) && (QSWON==1) ) { if(DIODECUR>0) DIODECUR--; /* LIMIT ON CURRENT OUTPUT */ if( DIODECUR > DIMAX ) DIODECUR = DIMAX; if(DIMAX > 250) *T3CMPR = (DIODECUR<<2); else *T3CMPR = (DIODECUR<<2); PLACE = 25; num2ascii(DIODECUR,0); if( UPDRAT ) wait(500); else wait(50); if( UPDRAT ) UPDRAT--; Diode_SetPt= DIODECUR; } } else { while( (!(*PFDATDIR & 0x0002)) && (!FUNCTION) ) { if(DIODECUR>0) DIODECUR--; /* LIMIT ON CURRENT OUTPUT */ if( DIODECUR > DIMAX ) DIODECUR = DIMAX; if(DIMAX > 250) *T3CMPR = (DIODECUR<<2); else *T3CMPR = (DIODECUR<<2); PLACE = 25; num2ascii(DIODECUR,0); if( UPDRAT ) wait(500); else wait(50); if( UPDRAT ) UPDRAT--; Diode_SetPt= DIODECUR; } } /* SET ROW 80 STROBE */ *PCDATDIR = ~0x0F80; wait(1); /* PWM CHECK AND ACTION */ //+++++++++PWM /* INCREMENT */ UPDRAT = 10; while( (!(*PFDATDIR & 0x0001)) && (!FUNCTION) && (!QSWEXT) ) { if(PWMTime<=20) PWMTime = 20; else PWMTime = PWMTime - 8; PLACE = 79; num2ascii(PWMTime,9); // pulseRateAction(); if( UPDRAT ) wait(250); else wait(25); if( UPDRAT ) UPDRAT--; } /* DECREMENT */ UPDRAT = 10; while( (!(*PFDATDIR & 0x0002)) && (!FUNCTION) && (!QSWEXT) ) { if(PWMTime>= 740) PWMTime = 740; else PWMTime = PWMTime + 8; PLACE = 79; num2ascii(PWMTime, 9); pulseRateAction(); if( UPDRAT ) wait(500); else wait(50); if( UPDRAT ) UPDRAT--; } /* SET ROW 40 STROBE */ *PCDATDIR = ~0x0F40; wait(1); /* EXIT SETUP KEY CHECK AND ACTION */ if( !(*PFDATDIR & 0x0001) ) { wait(10); if( !(*PFDATDIR & 0x0001) ) { FuncFlg = 0; port00 = 12; FUNCTION = 0; REMLOC=0; wait(2); PLACE = 0; message(msg1); PLACE = 64; message(msg2); if( PULSERATE < 10 ) PULSERATE = 10; PLACE = 71; num2ascii(PULSERATE,1); if( QSWEXT ) { HOLD[0] = 'E'; HOLD[1] = 'X'; } else { HOLD[0] = 'I'; HOLD[1] = 'N'; } PLACE = 88; wrtchrs(2); if( SHTON ) { HOLD[0] = 'N'; HOLD[1] = ' '; } else { HOLD[0] = 'F'; HOLD[1] = 'F'; } PLACE = 97; wrtchrs(2); wait(10); PLACE = 25; num2ascii(DIODECUR, 0); while( !(*PFDATDIR & 0x0001) ); } } if(!REMLOC) functionAction(&FuncFlg); //%%%%%%%%%%%%%%%%%%%%%%%%%%% } } //%%%%%%%%%%%%%%%%%%%%%%%%%%% } /* END while( KEYSW_ON ) */ } OLD_KEYSW_ON = 0; FuncFlg = 0; } /* End while(1) */ }
bool C3DSMeshReader::onChunk(const Chunk& chunk) { switch ( chunk.id ) { case OBJECT_CHUNK: { read(m_currentObjectName); return true; } case MESH_CHUNK: { // create a new Mesh m_meshes.push_back(Mesh()); return true; } case VERTEX_LIST: { Mesh &m = m_meshes.back(); m.name = m_currentObjectName; Uint16 nvertices; read(nvertices); for ( int i = 0; i < nvertices; ++i ) { math3d::vec3 v; read(v); m.vertices.push_back(v); } return false; } case FACE_DESC_CHUNK: { Mesh &m = m_meshes.back(); Uint16 nfaces; read(nfaces); for ( int i = 0; i < nfaces; ++i ) { Face f; read(f.indices[0]); read(f.indices[1]); read(f.indices[2]); read(f.faceFlag); m.faces.push_back(f); } return true; } case FACE_MATERIAL: { Mesh &m = m_meshes.back(); m.faceMaterials.push_back(FaceMaterial()); FaceMaterial &mat = m.faceMaterials.back(); Uint16 nentries; read(mat.name); read(nentries); for ( int i = 0; i < nentries; ++i ) { Uint16 face; read(face); mat.faces.push_back(face); } return false; } case SMOOTH_GROUP: { Mesh &m = m_meshes.back(); // one Uint32 for each face Uint16 nentries = (chunk.length - 6) / 4; for ( int i = 0; i < nentries; ++i ) { Uint32 value; read(value); m.smoothingGroup.push_back(value); } return false; } case MAP_COORDS: { Mesh &m = m_meshes.back(); Uint16 nvertices; read(nvertices); for ( int i = 0; i < nvertices; ++i ) { MapCoord coord; read(coord); m.mapCoords.push_back(coord); } return false; } case LOCAL_COORD_SYS: { Mesh &m = m_meshes.back(); math3d::vec3 x1, x2, x3, o; read(x1); read(x2); read(x3); read(o); math3d::mat4 mat( x1[0], x2[0], x3[0], o[0], x1[1], x2[1], x3[1], o[1], x1[2], x2[2], x3[2], o[2], 0, 0, 0, 1 ); m.localCoordSys = mat; return false; } default: return defaultAction(chunk); } }
void CPlayerServer::handleDefaultTimeout() { if(defaultAction) defaultAction(); }
void IfActionParameterDefinition::setDefaultValues(ActionInstance *actionInstance) { actionInstance->setSubParameter(name().original(), "action", defaultAction(actions.second[DoNothing])); actionInstance->setSubParameter(name().original(), "line", defaultLine()); }
void KOListView::defaultItemAction(QListViewItem *i) { KOListViewItem *item = static_cast<KOListViewItem *>(i); if(item) defaultAction(item->data()); }
RCSSetResponse RCSSetResponse::accept() { return defaultAction().setAcceptanceMethod(AcceptanceMethod::ACCEPT); }
void QXcbDrag::move(const QMouseEvent *me) { // The mouse event is in the coordinate system of the window that started the drag. // We do not know which window that was at this point, so we just use the device pixel ratio // of the QGuiApplication. This will break once we support screens with different DPR. Fixing // this properly requires some redesign of the drag and drop architecture. static const int dpr = int(qApp->devicePixelRatio()); QBasicDrag::move(me); QPoint globalPos = me->globalPos(); if (source_sameanswer.contains(globalPos) && source_sameanswer.isValid()) return; const QList<QXcbScreen *> &screens = connection()->screens(); QXcbScreen *screen = connection()->primaryScreen(); for (int i = 0; i < screens.size(); ++i) { if (screens.at(i)->geometry().contains(globalPos)) { screen = screens.at(i); break; } } if (screen != current_screen) { // ### need to recreate the shaped pixmap window? // int screen = QCursor::x11Screen(); // if ((qt_xdnd_current_screen == -1 && screen != X11->defaultScreen) || (screen != qt_xdnd_current_screen)) { // // recreate the pixmap on the new screen... // delete xdnd_data.deco; // QWidget* parent = object->source()->window()->x11Info().screen() == screen // ? object->source()->window() : QApplication::desktop()->screen(screen); // xdnd_data.deco = new QShapedPixmapWidget(parent); // if (!QWidget::mouseGrabber()) { // updatePixmap(); // xdnd_data.deco->grabMouse(); // } // } // xdnd_data.deco->move(QCursor::pos() - xdnd_data.deco->pm_hot); current_screen = screen; } // qt_xdnd_current_screen = screen; xcb_window_t rootwin = current_screen->root(); xcb_translate_coordinates_reply_t *translate = ::translateCoordinates(connection(), rootwin, rootwin, globalPos.x() * dpr, globalPos.y() * dpr); if (!translate) return; xcb_window_t target = translate->child; int lx = translate->dst_x; int ly = translate->dst_y; free (translate); if (target && target != rootwin) { xcb_window_t src = rootwin; while (target != 0) { DNDDEBUG << "checking target for XdndAware" << target << lx << ly; // translate coordinates translate = ::translateCoordinates(connection(), src, target, lx, ly); if (!translate) { target = 0; break; } lx = translate->dst_x; ly = translate->dst_y; src = target; xcb_window_t child = translate->child; free(translate); // check if it has XdndAware xcb_get_property_cookie_t cookie = Q_XCB_CALL(xcb_get_property(xcb_connection(), false, target, atom(QXcbAtom::XdndAware), XCB_GET_PROPERTY_TYPE_ANY, 0, 0)); xcb_get_property_reply_t *reply = xcb_get_property_reply(xcb_connection(), cookie, 0); bool aware = reply && reply->type != XCB_NONE; free(reply); if (aware) { DNDDEBUG << "Found XdndAware on " << target; break; } target = child; } if (!target || target == shapedPixmapWindow()->handle()->winId()) { DNDDEBUG << "need to find real window"; target = findRealWindow(globalPos, rootwin, 6, true); if (target == 0) target = findRealWindow(globalPos, rootwin, 6, false); DNDDEBUG << "real window found" << target; } } QXcbWindow *w = 0; if (target) { w = connection()->platformWindowFromId(target); if (w && (w->window()->type() == Qt::Desktop) /*&& !w->acceptDrops()*/) w = 0; } else { w = 0; target = rootwin; } xcb_window_t proxy_target = xdndProxy(connection(), target); if (!proxy_target) proxy_target = target; int target_version = 1; if (proxy_target) { xcb_get_property_cookie_t cookie = xcb_get_property(xcb_connection(), false, proxy_target, atom(QXcbAtom::XdndAware), XCB_GET_PROPERTY_TYPE_ANY, 0, 1); xcb_get_property_reply_t *reply = xcb_get_property_reply(xcb_connection(), cookie, 0); if (!reply || reply->type == XCB_NONE) target = 0; target_version = *(uint32_t *)xcb_get_property_value(reply); target_version = qMin(xdnd_version, target_version ? target_version : 1); free(reply); } if (target != current_target) { if (current_target) send_leave(); current_target = target; current_proxy_target = proxy_target; if (target) { int flags = target_version << 24; if (drag_types.size() > 3) flags |= 0x0001; xcb_client_message_event_t enter; enter.response_type = XCB_CLIENT_MESSAGE; enter.window = target; enter.format = 32; enter.type = atom(QXcbAtom::XdndEnter); enter.data.data32[0] = connection()->clipboard()->owner(); enter.data.data32[1] = flags; enter.data.data32[2] = drag_types.size()>0 ? drag_types.at(0) : 0; enter.data.data32[3] = drag_types.size()>1 ? drag_types.at(1) : 0; enter.data.data32[4] = drag_types.size()>2 ? drag_types.at(2) : 0; // provisionally set the rectangle to 5x5 pixels... source_sameanswer = QRect(globalPos.x() - 2, globalPos.y() -2 , 5, 5); DEBUG() << "sending Xdnd enter source=" << enter.data.data32[0]; if (w) handleEnter(w->window(), &enter); else if (target) xcb_send_event(xcb_connection(), false, proxy_target, XCB_EVENT_MASK_NO_EVENT, (const char *)&enter); waiting_for_status = false; } } if (waiting_for_status) return; if (target) { waiting_for_status = true; xcb_client_message_event_t move; move.response_type = XCB_CLIENT_MESSAGE; move.window = target; move.format = 32; move.type = atom(QXcbAtom::XdndPosition); move.data.data32[0] = connection()->clipboard()->owner(); move.data.data32[1] = 0; // flags move.data.data32[2] = (globalPos.x() * dpr << 16) + globalPos.y() * dpr; move.data.data32[3] = connection()->time(); move.data.data32[4] = toXdndAction(defaultAction(currentDrag()->supportedActions(), QGuiApplication::keyboardModifiers())); DEBUG() << "sending Xdnd position source=" << move.data.data32[0] << "target=" << move.window; source_time = connection()->time(); if (w) handle_xdnd_position(w->window(), &move); else xcb_send_event(xcb_connection(), false, proxy_target, XCB_EVENT_MASK_NO_EVENT, (const char *)&move); } }
RCSSetResponse RCSSetResponse::ignore() { return defaultAction().setAcceptanceMethod(AcceptanceMethod::IGNORE); }