void PlayerWidget::hidePlayer() { clearSelection(); TWidget::hide(); }
void LvlScene::SwitchEditingMode(int EdtMode) { //int EditingMode; // 0 - selecting, 1 - erasing, 2 - placeNewObject // 3 - drawing water/sand zone, 4 - placing from Buffer //bool EraserEnabled; //bool PasteFromBuffer; //bool DrawMode; //Placing/drawing on map, disable selecting and dragging items //bool disableMoveItems; //bool contextMenuOpened; EraserEnabled=false; PasteFromBuffer=false; DrawMode=false; disableMoveItems=false; switch(EdtMode) { case MODE_PlacingNew: switchMode("Placing"); break; case MODE_DrawSquare: switchMode("Square"); break; case MODE_Line: switchMode("Line"); break; case MODE_Resizing: switchMode("Resize"); break; case MODE_PasteFromClip: switchMode("Select"); clearSelection(); disableMoveItems=true; _viewPort->setInteractive(true); _viewPort->setCursor(Themes::Cursor(Themes::cursor_pasting)); _viewPort->setDragMode(QGraphicsView::NoDrag); break; case MODE_Erasing: switchMode("Erase"); break; case MODE_SelectingOnly: switchMode("Select"); disableMoveItems=true; break; case MODE_HandScroll: switchMode("HandScroll"); break; case MODE_Fill: switchMode("Fill"); break; case MODE_Selecting: default: switchMode("Select"); break; } EditingMode = EdtMode; }
MainWindow::MainWindow(ConfigHandler *aConfig, Database * aDb) : QMainWindow(0), config(aConfig), ui(new Ui::MainWindow), db(aDb) { qDebug() << "Main Window Construct"; // Aufsetzen der GUI Grundumgebung + Logger ui->setupUi(this); resize(config->getAppSize()); move(config->getAppPosition()); this->setWindowTitle("BirdCensus"); // Der QGIS Umgebung qgsPvrRegistry = QgsProviderRegistry::instance(); qgsLyrRegistry = QgsMapLayerRegistry::instance(); qgsCheckProviders(); guiInitAdditionals(); // QPalette dark_palette = ui->tbwObjects->palette(); // ui->tbwObjects->viewport()->setBackgroundRole(QPalette::AlternateBase); //// dark_palette.setColor(QPalette::Window, Qt::lightGray); // dark_palette.setColor(QPalette::AlternateBase, Qt::gray); // ui->tbwObjects->setPalette(dark_palette); initSessionFrame(); object_table_model = db->getObjectView(); ui->tbwObjects->setModel(object_table_model); ui->tbwObjects->hideColumn(object_table_model->fieldIndex("ux")); ui->tbwObjects->hideColumn(object_table_model->fieldIndex("uy")); ui->tbwObjects->hideColumn(object_table_model->fieldIndex("lx")); ui->tbwObjects->hideColumn(object_table_model->fieldIndex("ly")); ui->tbwObjects->hideColumn(object_table_model->fieldIndex("cam")); ui->tbwObjects->hideColumn(object_table_model->fieldIndex("img")); ui->tbwObjects->hideColumn(object_table_model->fieldIndex("session")); // ui->tbwObjects->setBackgroundRole(QPalette::Base); // ui->tbwObjects->setAutoFillBackground( true ); ui->tbwObjects->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents); if (config->getAdmin()) { ui->option_admin->setEnabled(false); ui->option_admin->setIcon(QIcon::fromTheme("object-unlocked")); } /* * TODO: * werden die beiden tableview selectionModels wirklich gebraucht? */ objSelector = ui->tbwObjects->selectionModel(); connect( ui->btnMapSelect, SIGNAL(clicked()), this, SLOT(clearSelection())); connect( ui->btnMapRmObj, SIGNAL(clicked()), this, SLOT(deleteSelection())); connect( objSelector, SIGNAL(currentRowChanged(QModelIndex,QModelIndex)), this, SLOT(objUpdateSelection(QModelIndex,QModelIndex))); connect( ui->cmbSession, SIGNAL(currentIndexChanged(int)), this, SLOT(handleSessionSelection())); connect( ui->chbHideMarker, SIGNAL(clicked(bool)), mapCanvas, SLOT(hideMarker(bool))); connect( ui->option_admin, SIGNAL(clicked()), this, SLOT(handleAdminPass())); connect( ui->chbNotReady, SIGNAL(stateChanged(int)), this, SLOT(handleMissingCheckBox(int))); connect( ui->image_table->horizontalHeader(), SIGNAL(sectionClicked(int)), this, SLOT(handleHeaderFilter(int))); connect( ui->option_location, SIGNAL(clicked()), this, SLOT(handleLocationSelection())); }
void TorrentsListWidget::mousePressEvent(QMouseEvent *event) { clearSelection(); };
void WldScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent) { if(MouseReleaseEventOnly) { QGraphicsScene::mousePressEvent(mouseEvent); MouseReleaseEventOnly = false; return; } bool isLeftMouse=false; bool isMiddleMouse=false; if( mouseEvent->button() == Qt::LeftButton ) { mouseLeft=false; isLeftMouse=true; WriteToLog(QtDebugMsg, QString("Left mouse button released [edit mode: %1]").arg(EditingMode)); } if( mouseEvent->button() == Qt::MiddleButton ) { mouseMid=false; isMiddleMouse=true; WriteToLog(QtDebugMsg, QString("Middle mouse button released [edit mode: %1]").arg(EditingMode)); } if( mouseEvent->button() == Qt::RightButton ) { mouseRight=false; WriteToLog(QtDebugMsg, QString("Right mouse button released [edit mode: %1]").arg(EditingMode)); } if(contextMenuOpened) { contextMenuOpened = false; //bug protector QGraphicsScene::mouseReleaseEvent(mouseEvent); return; } contextMenuOpened=false; if(!isLeftMouse) { if(PasteFromBuffer && GlobalSettings::MidMouse_allowDuplicate && isMiddleMouse && (EditingMode==MODE_Selecting||EditingMode==MODE_SelectingOnly)) { clearSelection(); paste( WldBuffer, mouseEvent->scenePos().toPoint() ); Debugger_updateItemList(); PasteFromBuffer = false; } if(GlobalSettings::MidMouse_allowSwitchToDrag && isMiddleMouse && (EditingMode==MODE_Selecting||EditingMode==MODE_SelectingOnly) && selectedItems().isEmpty()) { MainWinConnect::pMainWin->on_actionHandScroll_triggered(); } QGraphicsScene::mouseReleaseEvent(mouseEvent); return; } if(CurrentMode) CurrentMode->mouseRelease(mouseEvent); if(!CurrentMode->noEvent()) QGraphicsScene::mouseReleaseEvent(mouseEvent); }
int Q3ListBox::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = Q3ScrollView::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: highlighted((*reinterpret_cast< int(*)>(_a[1]))); break; case 1: selected((*reinterpret_cast< int(*)>(_a[1]))); break; case 2: highlighted((*reinterpret_cast< const QString(*)>(_a[1]))); break; case 3: selected((*reinterpret_cast< const QString(*)>(_a[1]))); break; case 4: highlighted((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1]))); break; case 5: selected((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1]))); break; case 6: selectionChanged(); break; case 7: selectionChanged((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1]))); break; case 8: currentChanged((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1]))); break; case 9: clicked((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1]))); break; case 10: clicked((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1])),(*reinterpret_cast< const QPoint(*)>(_a[2]))); break; case 11: pressed((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1]))); break; case 12: pressed((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1])),(*reinterpret_cast< const QPoint(*)>(_a[2]))); break; case 13: doubleClicked((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1]))); break; case 14: returnPressed((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1]))); break; case 15: rightButtonClicked((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1])),(*reinterpret_cast< const QPoint(*)>(_a[2]))); break; case 16: rightButtonPressed((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1])),(*reinterpret_cast< const QPoint(*)>(_a[2]))); break; case 17: mouseButtonPressed((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< Q3ListBoxItem*(*)>(_a[2])),(*reinterpret_cast< const QPoint(*)>(_a[3]))); break; case 18: mouseButtonClicked((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< Q3ListBoxItem*(*)>(_a[2])),(*reinterpret_cast< const QPoint(*)>(_a[3]))); break; case 19: contextMenuRequested((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1])),(*reinterpret_cast< const QPoint(*)>(_a[2]))); break; case 20: onItem((*reinterpret_cast< Q3ListBoxItem*(*)>(_a[1]))); break; case 21: onViewport(); break; case 22: clear(); break; case 23: ensureCurrentVisible(); break; case 24: clearSelection(); break; case 25: selectAll((*reinterpret_cast< bool(*)>(_a[1]))); break; case 26: invertSelection(); break; case 27: clearInputString(); break; case 28: refreshSlot(); break; case 29: doAutoScroll(); break; case 30: adjustItems(); break; } _id -= 31; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< uint*>(_v) = count(); break; case 1: *reinterpret_cast< int*>(_v) = numItemsVisible(); break; case 2: *reinterpret_cast< int*>(_v) = currentItem(); break; case 3: *reinterpret_cast< QString*>(_v) = currentText(); break; case 4: *reinterpret_cast< int*>(_v) = topItem(); break; case 5: *reinterpret_cast< SelectionMode*>(_v) = selectionMode(); break; case 6: *reinterpret_cast< bool*>(_v) = isMultiSelection(); break; case 7: *reinterpret_cast< LayoutMode*>(_v) = columnMode(); break; case 8: *reinterpret_cast< LayoutMode*>(_v) = rowMode(); break; case 9: *reinterpret_cast< int*>(_v) = numColumns(); break; case 10: *reinterpret_cast< int*>(_v) = numRows(); break; case 11: *reinterpret_cast< bool*>(_v) = variableWidth(); break; case 12: *reinterpret_cast< bool*>(_v) = variableHeight(); break; } _id -= 13; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 2: setCurrentItem(*reinterpret_cast< int*>(_v)); break; case 4: setTopItem(*reinterpret_cast< int*>(_v)); break; case 5: setSelectionMode(*reinterpret_cast< SelectionMode*>(_v)); break; case 6: setMultiSelection(*reinterpret_cast< bool*>(_v)); break; case 7: setColumnMode(*reinterpret_cast< LayoutMode*>(_v)); break; case 8: setRowMode(*reinterpret_cast< LayoutMode*>(_v)); break; case 11: setVariableWidth(*reinterpret_cast< bool*>(_v)); break; case 12: setVariableHeight(*reinterpret_cast< bool*>(_v)); break; } _id -= 13; } else if (_c == QMetaObject::ResetProperty) { _id -= 13; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 13; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 13; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 13; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 13; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 13; } #endif // QT_NO_PROPERTIES return _id; }
void PropertiesView::onBeginResetModel() { clearSelection(); }
void Inner::leaveEventHook(QEvent *e) { clearSelection(); }
int SELECTION_TOOL::Main( TOOL_EVENT& aEvent ) { // Main loop: keep receiving events while( OPT_TOOL_EVENT evt = Wait() ) { // Should selected items be added to the current selection or // become the new selection (discarding previously selected items) m_additive = evt->Modifier( MD_SHIFT ); // single click? Select single object if( evt->IsClick( BUT_LEFT ) ) { if( evt->Modifier( MD_CTRL ) && !m_editModules ) { highlightNet( evt->Position() ); } else { if( !m_additive ) clearSelection(); selectSingle( evt->Position() ); } } // right click? if there is any object - show the context menu else if( evt->IsClick( BUT_RIGHT ) ) { if( m_selection.Empty() ) selectSingle( evt->Position() ); generateMenu(); } // double click? Display the properties window else if( evt->IsDblClick( BUT_LEFT ) ) { if( m_selection.Empty() ) selectSingle( evt->Position() ); m_toolMgr->RunAction( COMMON_ACTIONS::properties ); } // drag with LMB? Select multiple objects (or at least draw a selection box) or drag them else if( evt->IsDrag( BUT_LEFT ) ) { if( m_additive ) { selectMultiple(); } else if( m_selection.Empty() ) { // There is nothing selected, so try to select something if( !selectSingle( getView()->ToWorld( getViewControls()->GetMousePosition() ), false ) ) { // If nothings has been selected or user wants to select more // draw the selection box selectMultiple(); } else { m_toolMgr->InvokeTool( "pcbnew.InteractiveEdit" ); } } else { // Check if dragging has started within any of selected items bounding box if( selectionContains( evt->Position() ) ) { // Yes -> run the move tool and wait till it finishes m_toolMgr->InvokeTool( "pcbnew.InteractiveEdit" ); } else { // No -> clear the selection list clearSelection(); } } } else if( evt->IsAction( &COMMON_ACTIONS::selectionSingle ) ) { // GetMousePosition() is used, as it is independent of snapping settings selectSingle( getView()->ToWorld( getViewControls()->GetMousePosition() ) ); } else if( evt->IsCancel() || evt->Action() == TA_UNDO_REDO || evt->IsAction( &COMMON_ACTIONS::selectionClear ) ) { clearSelection(); } } // This tool is supposed to be active forever assert( false ); return 0; }
bool UITextEdit::onKeyPress(uchar keyCode, int keyboardModifiers, int autoRepeatTicks) { if(UIWidget::onKeyPress(keyCode, keyboardModifiers, autoRepeatTicks)) return true; if(keyboardModifiers == Fw::KeyboardNoModifier) { if(keyCode == Fw::KeyDelete && m_editable) { // erase right character if(hasSelection() || !m_text.empty()) { del(true); return true; } } else if(keyCode == Fw::KeyBackspace && m_editable) { // erase left character if(hasSelection() || !m_text.empty()) { del(false); return true; } } else if(keyCode == Fw::KeyRight && !m_shiftNavigation) { // move cursor right clearSelection(); moveCursorHorizontally(true); return true; } else if(keyCode == Fw::KeyLeft && !m_shiftNavigation) { // move cursor left clearSelection(); moveCursorHorizontally(false); return true; } else if(keyCode == Fw::KeyHome) { // move cursor to first character if(m_cursorPos != 0) { clearSelection(); setCursorPos(0); return true; } } else if(keyCode == Fw::KeyEnd) { // move cursor to last character if(m_cursorPos != (int)m_text.length()) { clearSelection(); setCursorPos(m_text.length()); return true; } } else if(keyCode == Fw::KeyTab && !m_shiftNavigation) { clearSelection(); if(UIWidgetPtr parent = getParent()) parent->focusNextChild(Fw::KeyboardFocusReason, true); return true; } else if(keyCode == Fw::KeyEnter && m_multiline && m_editable) { appendCharacter('\n'); return true; } else if(keyCode == Fw::KeyUp && !m_shiftNavigation && m_multiline) { moveCursorVertically(true); return true; } else if(keyCode == Fw::KeyDown && !m_shiftNavigation && m_multiline) { moveCursorVertically(false); return true; } } else if(keyboardModifiers == Fw::KeyboardCtrlModifier) { if(keyCode == Fw::KeyV && m_editable) { paste(g_window.getClipboardText()); return true; } else if(keyCode == Fw::KeyX && m_editable && m_selectable) { if(hasSelection()) { cut(); return true; } } else if(keyCode == Fw::KeyC && m_selectable) { if(hasSelection()) { copy(); return true; } } else if(keyCode == Fw::KeyA && m_selectable) { if(m_text.length() > 0) { selectAll(); return true; } } } else if(keyboardModifiers == Fw::KeyboardShiftModifier) { if(keyCode == Fw::KeyTab && !m_shiftNavigation) { if(UIWidgetPtr parent = getParent()) parent->focusPreviousChild(Fw::KeyboardFocusReason, true); return true; } else if(keyCode == Fw::KeyRight || keyCode == Fw::KeyLeft) { int oldCursorPos = m_cursorPos; if(keyCode == Fw::KeyRight) // move cursor right moveCursorHorizontally(true); else if(keyCode == Fw::KeyLeft) // move cursor left moveCursorHorizontally(false); if(m_shiftNavigation) clearSelection(); else { if(!hasSelection()) m_selectionReference = oldCursorPos; setSelection(m_selectionReference, m_cursorPos); } return true; } else if(keyCode == Fw::KeyHome) { // move cursor to first character if(m_cursorPos != 0) { setSelection(m_cursorPos, 0); setCursorPos(0); return true; } } else if(keyCode == Fw::KeyEnd) { // move cursor to last character if(m_cursorPos != (int)m_text.length()) { setSelection(m_cursorPos, m_text.length()); setCursorPos(m_text.length()); return true; } } } return false; }
bool SELECTION_TOOL::selectMultiple() { bool cancelled = false; // Was the tool cancelled while it was running? m_multiple = true; // Multiple selection mode is active KIGFX::VIEW* view = getView(); getViewControls()->SetAutoPan( true ); view->Add( m_selArea ); while( OPT_TOOL_EVENT evt = Wait() ) { if( evt->IsCancel() ) { cancelled = true; break; } if( evt->IsDrag( BUT_LEFT ) ) { if( !m_additive ) clearSelection(); // Start drawing a selection box m_selArea->SetOrigin( evt->DragOrigin() ); m_selArea->SetEnd( evt->Position() ); m_selArea->ViewSetVisible( true ); m_selArea->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY ); } if( evt->IsMouseUp( BUT_LEFT ) ) { // End drawing the selection box m_selArea->ViewSetVisible( false ); // Mark items within the selection box as selected std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR> selectedItems; BOX2I selectionBox = m_selArea->ViewBBox(); view->Query( selectionBox, selectedItems ); // Get the list of selected items std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR>::iterator it, it_end; for( it = selectedItems.begin(), it_end = selectedItems.end(); it != it_end; ++it ) { BOARD_ITEM* item = static_cast<BOARD_ITEM*>( it->first ); // Add only those items that are visible and fully within the selection box if( !item->IsSelected() && selectable( item ) && selectionBox.Contains( item->ViewBBox() ) ) { select( item ); } } // Do not display information about selected item,as there is more than one m_frame->SetCurItem( NULL ); if( !m_selection.Empty() ) { // Inform other potentially interested tools TOOL_EVENT selectEvent( SelectedEvent ); m_toolMgr->ProcessEvent( selectEvent ); } break; // Stop waiting for events } } view->Remove( m_selArea ); m_multiple = false; // Multiple selection mode is inactive getViewControls()->SetAutoPan( false ); return cancelled; }
bool SELECTION_TOOL::selectSingle( const VECTOR2I& aWhere, bool aAllowDisambiguation ) { BOARD_ITEM* item; GENERAL_COLLECTORS_GUIDE guide = m_frame->GetCollectorsGuide(); GENERAL_COLLECTOR collector; // Preferred types (they have the priority when if they are covered by a bigger item) const KICAD_T types[] = { PCB_TRACE_T, PCB_VIA_T, PCB_LINE_T, PCB_MODULE_TEXT_T, EOT }; if( m_editModules ) collector.Collect( getModel<BOARD>(), GENERAL_COLLECTOR::ModuleItems, wxPoint( aWhere.x, aWhere.y ), guide ); else collector.Collect( getModel<BOARD>(), GENERAL_COLLECTOR::AllBoardItems, wxPoint( aWhere.x, aWhere.y ), guide ); switch( collector.GetCount() ) { case 0: if( !m_additive ) clearSelection(); return false; case 1: toggleSelection( collector[0] ); return true; default: // Remove unselectable items for( int i = collector.GetCount() - 1; i >= 0; --i ) { if( !selectable( collector[i] ) ) collector.Remove( i ); } // Check if among the selection candidates there is only one instance of preferred type item = prefer( collector, types ); if( item ) { toggleSelection( item ); return true; } // Let's see if there is still disambiguation in selection.. if( collector.GetCount() == 1 ) { toggleSelection( collector[0] ); return true; } else if( aAllowDisambiguation && collector.GetCount() > 1 ) { item = disambiguationMenu( &collector ); if( item ) { toggleSelection( item ); return true; } } break; } return false; }
void AbstractSelection::mousePressEvent(QMouseEvent *event, ImageArea &imageArea) { mButton = event->button(); mIsMouseMoved = false; if (mIsSelectionExists) { imageArea.setImage(mImageCopy); paint(imageArea); if (mButton == Qt::RightButton) { mIsSelectionAdjusting = true; startAdjusting(imageArea); } if (event->pos().x() > mTopLeftPoint.x() && event->pos().x() < mBottomRightPoint.x() && event->pos().y() > mTopLeftPoint.y() && event->pos().y() < mBottomRightPoint.y()) { if (!mIsSelectionAdjusting) { makeUndoCommand(imageArea); } if (!mIsImageSelected) { startMoving(imageArea); if (!mIsSelectionAdjusting) { mIsImageSelected = true; } } else { drawBorder(imageArea); } mIsSelectionMoving = true; mMoveDiffPoint = mBottomRightPoint - event->pos(); return; } else if (event->pos().x() >= mBottomRightPoint.x() && event->pos().x() <= mBottomRightPoint.x() + 6 && event->pos().y() >= mBottomRightPoint.y() && event->pos().y() <= mBottomRightPoint.y() + 6) { if (!mIsSelectionAdjusting) { makeUndoCommand(imageArea); } startResizing(imageArea); mIsSelectionResizing = true; return; } else { clearSelection(imageArea); } } if (event->button() == Qt::LeftButton) { mBottomRightPoint = mTopLeftPoint = event->pos(); mHeight = mWidth = 0; mImageCopy = *imageArea.getImage(); startSelection(imageArea); mIsPaint = true; } }
bool PaletteView::onProcessMessage(Message* msg) { switch (msg->type) { case JM_REQSIZE: request_size(&msg->reqsize.w, &msg->reqsize.h); return true; case JM_DRAW: { div_t d = div(Palette::MaxColors, m_columns); int cols = m_columns; int rows = d.quot + ((d.rem)? 1: 0); int x, y, u, v; int c, color; BITMAP *bmp; Palette* palette = get_current_palette(); int bordercolor = makecol(255, 255, 255); bmp = create_bitmap(jrect_w(this->rc), jrect_h(this->rc)); clear_to_color(bmp, makecol(0 , 0, 0)); y = this->border_width.t; c = 0; for (v=0; v<rows; v++) { x = this->border_width.l; for (u=0; u<cols; u++) { if (c >= palette->size()) break; if (bitmap_color_depth(ji_screen) == 8) color = c; else color = makecol_depth (bitmap_color_depth(ji_screen), _rgba_getr(palette->getEntry(c)), _rgba_getg(palette->getEntry(c)), _rgba_getb(palette->getEntry(c))); rectfill(bmp, x, y, x+m_boxsize-1, y+m_boxsize-1, color); if (m_selectedEntries[c]) { const int max = Palette::MaxColors; bool top = (c >= m_columns && c-m_columns >= 0 ? m_selectedEntries[c-m_columns]: false); bool bottom = (c < max-m_columns && c+m_columns < max ? m_selectedEntries[c+m_columns]: false); bool left = ((c%m_columns)>0 && c-1 >= 0 ? m_selectedEntries[c-1]: false); bool right = ((c%m_columns)<m_columns-1 && c+1 < max ? m_selectedEntries[c+1]: false); if (!top) hline(bmp, x-1, y-1, x+m_boxsize, bordercolor); if (!bottom) hline(bmp, x-1, y+m_boxsize, x+m_boxsize, bordercolor); if (!left) vline(bmp, x-1, y-1, y+m_boxsize, bordercolor); if (!right) vline(bmp, x+m_boxsize, y-1, y+m_boxsize, bordercolor); } x += m_boxsize+this->child_spacing; c++; } y += m_boxsize+this->child_spacing; } blit(bmp, ji_screen, 0, 0, this->rc->x1, this->rc->y1, bmp->w, bmp->h); destroy_bitmap(bmp); return true; } case JM_BUTTONPRESSED: captureMouse(); /* continue... */ case JM_MOTION: { JRect cpos = jwidget_get_child_rect(this); int req_w, req_h; request_size(&req_w, &req_h); int mouse_x = MID(cpos->x1, msg->mouse.x, cpos->x1+req_w-this->border_width.r-1); int mouse_y = MID(cpos->y1, msg->mouse.y, cpos->y1+req_h-this->border_width.b-1); jrect_free(cpos); Color color = getColorByPosition(mouse_x, mouse_y); if (color.getType() == Color::IndexType) { int idx = color.getIndex(); app_get_statusbar()->showColor(0, "", color, 255); if (hasCapture() && idx != m_currentEntry) { if (!(msg->any.shifts & KB_CTRL_FLAG)) clearSelection(); if (msg->any.shifts & KB_SHIFT_FLAG) selectRange(m_rangeAnchor, idx); else selectColor(idx); // Emit signals jwidget_emit_signal(this, SIGNAL_PALETTE_EDITOR_CHANGE); IndexChange(idx); } } if (hasCapture()) return true; break; } case JM_BUTTONRELEASED: releaseMouse(); return true; case JM_WHEEL: { View* view = View::getView(this); if (view) { gfx::Point scroll = view->getViewScroll(); scroll.y += (jmouse_z(1)-jmouse_z(0)) * 3 * m_boxsize; view->setViewScroll(scroll); } break; } case JM_MOUSELEAVE: app_get_statusbar()->clearText(); break; } return Widget::onProcessMessage(msg); }
void PropertiesView::onBeginResetAllDiagrams() { clearSelection(); }
AMScanDataView::AMScanDataView(AMDatabase *database, QWidget *parent) : QWidget(parent) { // Widgets browseScansView_ = new AMBrowseScansView(database); titleLabel_ = new QLabel(); titleLabel_->setObjectName(QString::fromUtf8("headingLabel_")); titleLabel_->setStyleSheet(QString::fromUtf8("font: 20pt \"Lucida Grande\";\n" "color: rgb(79, 79, 79);")); titleLabel_->setText(QString("%1: Data").arg(AMUser::user()->name())); QIcon searchIcon; searchIcon.addFile(QString::fromUtf8(":/system-search-2.png"), QSize(), QIcon::Normal, QIcon::Off); // Action bar Widgets QHBoxLayout* actionButtonLayout = new QHBoxLayout(); QIcon editButtonIcon; QString actionButtonStyle = QString::fromUtf8("QToolButton:hover {\n" " border-top: 1px solid transparent;\n" "}\n" "\n" "QToolButton:pressed {\n" "border-top: 3px solid transparent;\n" "}\n" "\n" "QToolButton {\n" "border: none;\n" "}\n" "\n" ""); editButtonIcon.addFile(QString::fromUtf8(":/32x32/edit-find-replace.png"), QSize(), QIcon::Normal, QIcon::Off); editButton_ = new QToolButton(); editButton_->setIcon(editButtonIcon); editButton_->setIconSize(QSize(32, 32)); editButton_->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); editButton_->setAutoRaise(true); editButton_->setStyleSheet(actionButtonStyle); editButton_->setEnabled(false); editButton_->setToolTip("View Scans in Separate Windows"); actionButtonLayout->addWidget(editButton_); QIcon compareButtonIcon; compareButtonIcon.addFile(QString::fromUtf8(":/32x32/preferences-desktop-theme.png"), QSize(), QIcon::Normal, QIcon::Off); compareButton_ = new QToolButton(); compareButton_->setIcon(compareButtonIcon); compareButton_->setIconSize(QSize(32, 32)); compareButton_->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); compareButton_->setAutoRaise(true); compareButton_->setStyleSheet(actionButtonStyle); compareButton_->setEnabled(false); compareButton_->setToolTip("View Scans in Same Window"); actionButtonLayout->addWidget(compareButton_); QIcon exportButtonIcon; exportButtonIcon.addFile(QString::fromUtf8(":/32x32/system-file-manager.png"), QSize(), QIcon::Normal, QIcon::Off); exportButton_ = new QToolButton(); exportButton_->setIcon(exportButtonIcon); exportButton_->setIconSize(QSize(32, 32)); exportButton_->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); exportButton_->setAutoRaise(true); exportButton_->setStyleSheet(actionButtonStyle); exportButton_->setEnabled(false); exportButton_->setToolTip("Export Selected Scan(s)"); actionButtonLayout->addWidget(exportButton_); QIcon configButtonIcon; configButtonIcon.addFile(QString::fromUtf8(":/32x32/hammer-wrench.png"), QSize(), QIcon::Normal, QIcon::Off); configButton_ = new QToolButton(); configButton_->setIcon(configButtonIcon); configButton_->setIconSize(QSize(32, 32)); configButton_->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); configButton_->setAutoRaise(true); configButton_->setStyleSheet(actionButtonStyle); configButton_->setEnabled(false); configButton_->setToolTip("Show Scan Config(s)"); actionButtonLayout->addWidget(configButton_); actionButtonLayout->addStretch(); connect(editButton_, SIGNAL(clicked()), this, SLOT(onEditScan())); connect(compareButton_, SIGNAL(clicked()), this, SLOT(onCompareScans())); connect(exportButton_, SIGNAL(clicked()), this, SLOT(onExportScans())); connect(configButton_, SIGNAL(clicked()), this, SLOT(onShowScanConfiguration())); // Context menu contextMenu_ = new QMenu(this); QAction* editScan = contextMenu_->addAction("Edit"); QAction* compareScans = contextMenu_->addAction("Compare"); QAction* exportScans = contextMenu_->addAction("Export"); QAction* viewScanConfig = contextMenu_->addAction("Show Scan Configuration"); QAction* fixCDFile = contextMenu_->addAction("Fix CDF"); contextMenu_->addSeparator(); contextMenu_->addAction("Select All", browseScansView_, SLOT(selectAll())); contextMenu_->addAction("Clear Selection", browseScansView_, SLOT(clearSelection())); // Signals, Slots connect(editScan, SIGNAL(triggered()), this, SLOT(onEditScan())); connect(compareScans, SIGNAL(triggered()), this, SLOT(onCompareScans())); connect(exportScans, SIGNAL(triggered()), this, SLOT(onExportScans())); connect(viewScanConfig, SIGNAL(triggered()), this, SLOT(onShowScanConfiguration())); connect(fixCDFile, SIGNAL(triggered()), this, SLOT(onFixCDF())); connect(browseScansView_, SIGNAL(childContextMenuRequested(const QPoint&)), this, SLOT(onCustomContextMenuRequested(const QPoint&))); connect(browseScansView_, SIGNAL(filterChanged(bool)), this, SLOT(onFilterChanged(bool))); connect(browseScansView_, SIGNAL(selectionChanged()), this, SLOT(onChildViewSelectionChanged())); connect(browseScansView_, SIGNAL(childViewDoubleClicked(const QModelIndex&)), this, SLOT(onChildViewDoubleClicked())); // Layout QVBoxLayout* layout = new QVBoxLayout(); layout->addWidget(titleLabel_); layout->addWidget(browseScansView_); layout->addLayout(actionButtonLayout); setLayout(layout); }
QgsMapToolSimplify::~QgsMapToolSimplify() { clearSelection(); delete mSimplifyDialog; }
void Inner::leaveToChildEvent(QEvent *e, QWidget *child) { clearSelection(); }
void MovieList::mouseReleaseEvent(QMouseEvent *event){ QListView::mousePressEvent(event); QModelIndex index = indexAt(event->pos()); if (!index.isValid()) clearSelection(); qDebug()<<modelColumn(); }
void AMGraphicsTextItem::focusOutEvent(QFocusEvent *event) { QGraphicsTextItem::focusOutEvent(event); setSelectAll(false); clearSelection(); }
void SchematicScene::showEvent(QShowEvent *se) { TSelectionHandle *selHandle = TSelectionHandle::getCurrent(); connect(selHandle, SIGNAL(selectionSwitched(TSelection *, TSelection *)), this, SLOT(onSelectionSwitched(TSelection *, TSelection *))); clearSelection(); }
void Menu::clearMouseSelection() { if (_mouseSelection && !_childShown) { clearSelection(); } }
void TextInstrument::cancel(ImageArea *imageArea) { mText = QString(); clearSelection(*imageArea); }
void Matrix::cutSelection() { copySelection(); clearSelection(); }
void QEnhancedTableView::print(QPrinter *printer, bool onePageWide, bool onePageHigh) { QPrinter* p=printer; //p->setPageMargins(10,10,10,10,QPrinter::Millimeter); if (width()>height()) { p->setOrientation(QPrinter::Landscape); } else { p->setOrientation(QPrinter::Portrait); } clearSelection(); /// PRINT HERE ////////////////////////////////////////////////////////////////////////////////// // calculate the total width/height table would need without scaling const int rows = model()->rowCount(); const int cols = model()->columnCount(); double vhw=verticalHeader()->width()+8; double totalWidth = vhw; double minWidth=1e33; double maxWidth=0; for (int c = -1; c < cols; ++c) { double w=columnWidth(c); totalWidth += w; if (w<minWidth) minWidth=w; if (w>maxWidth) maxWidth=w; } double hhh=horizontalHeader()->height()+8; double totalHeight = hhh; double minHeight=1e33; double maxHeight=0; for (int r = 0; r < rows; ++r) { double h=rowHeight(r); totalHeight += h; if (h<minHeight) minHeight=h; if (h>maxHeight) maxHeight=h; } double scale=1.0; // adjust scale, so the widest/highest column fits on one page /*if (maxWidth*scale>p->pageRect().width()) scale=p->pageRect().width()/maxWidth; if (maxHeight*scale>p->pageRect().height()) scale=p->pageRect().height()/maxHeight;*/ if (onePageWide) { if (totalWidth>p->pageRect().width()) scale=p->pageRect().width()/totalWidth; } if (onePageHigh) { if (totalHeight>p->pageRect().height()) scale=qMin(scale, p->pageRect().height()/totalHeight); } //qDebug()<<scale; // print scaled pixmap int pagesWide=1; int pagesHigh=1; QList<int> pageCols, pageRows; pageCols<<0; pageRows<<0; { // find number of pages needed double x=vhw, x0=vhw; if (!onePageWide) { for (int c=0; c<cols; c++) { double cw=columnWidth(c); if (x+cw>p->pageRect().width()/scale) { pagesWide++; x=0; pageCols<<c; } else { x=x+cw; x0=x0+cw; } } } if (pageCols.size()>0 && cols>pageCols.last()) pageCols<<cols; if (pageCols.size()==1) pageCols<<cols; double y=hhh, y0=hhh; if (!onePageHigh) { for (int r=0; r<rows; r++) { double rh=rowHeight(r); if (y+rh>p->pageRect().height()/scale) { pagesHigh++; pageRows<<r; y=hhh; } else { y=y+rh; y0=y0+rh; } } } if (pageRows.size()>0 && rows>pageRows.last()) pageRows<<rows; if (pageRows.size()==1) pageRows<<rows; } QPainter painter(p); paint(painter, scale, -1, hhh, vhw, pageCols, pageRows, p); painter.end(); /// PRINT DONE ////////////////////////////////////////////////////////////////////////////////// }
void dtkComposerSceneView::setScene(dtkComposerScene *scene) { d->scene = scene; connect(d->scene, SIGNAL(selectionCleared()), this, SLOT(clearSelection())); }
void PartSelectionForm::hideEvent(QHideEvent *) { emit shown(false); clearSelection(); }
void BccWorld::select(const Ray * r) { BaseCurve::RayIntersectionTolerance = totalCurveLength() / m_estimatedNumGroups * .37f; if(!m_cluster->intersectRay(r)) clearSelection(); }
bool TreeWidget::dropMimeData(QTreeWidgetItem* parent, int, const QMimeData* data, Qt::DropAction action) { if (action == Qt::IgnoreAction) { return true; } if (parent && !parent->text(1).isEmpty()) { // parent is a bookmark, go one level up! parent = parent->parent(); } if (!parent) { parent = invisibleRootItem(); } bool ok = false; if (data->hasUrls()) { QString folder = (parent == invisibleRootItem()) ? QLatin1String("unsorted") : parent->text(0); QUrl url = data->urls().at(0); QString title = data->text().isEmpty() ? url.host() + url.path() : data->text(); emit linkWasDroped(url, title, data->imageData(), folder, &ok); return ok; } if (!data->hasFormat(m_mimeType)) { return false; } QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); QByteArray ba = data->data(m_mimeType); QDataStream stream(&ba, QIODevice::ReadOnly); if (stream.atEnd()) { return false; } QSqlDatabase db = QSqlDatabase::database(); db.transaction(); setUpdatesEnabled(false); while (!stream.atEnd()) { QTreeWidgetItem* item = new QTreeWidgetItem; item->read(stream); bool parentIsRoot = item->data(0, ITEM_IS_TOPLEVEL).toBool(); QString oldParentTitle = item->data(0, ITEM_PARENT_TITLE).toString(); bool isFolder = item->text(1).isEmpty(); if (isFolder && (item->text(0) == _bookmarksMenu || item->text(0) == _bookmarksToolbar)) { continue; } bool parentIsOldParent = parentIsRoot ? (parent == invisibleRootItem()) : (oldParentTitle == parent->text(0)); if (parentIsOldParent || (isFolder && parent != invisibleRootItem() && parent->text(0) != _bookmarksToolbar)) { // just 'Bookmarks In ToolBar' folder can have subfolders continue; } if (isFolder) { emit folderParentChanged(item->text(0), parent->text(0) == _bookmarksToolbar, &ok); } else { emit bookmarkParentChanged(item->data(0, Qt::UserRole + 10).toInt(), parent->text(0), oldParentTitle, &ok); } if (!ok) { continue; } } db.commit(); clearSelection(); setUpdatesEnabled(true); QApplication::restoreOverrideCursor(); return true; }