bool QScrollView::qt_invoke( int _id, QUObject* _o ) { switch ( _id - staticMetaObject()->slotOffset() ) { case 0: resizeContents((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2)); break; case 1: scrollBy((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2)); break; case 2: setContentsPos((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2)); break; case 3: ensureVisible((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2)); break; case 4: ensureVisible((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2),(int)static_QUType_int.get(_o+3),(int)static_QUType_int.get(_o+4)); break; case 5: center((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2)); break; case 6: center((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2),(float)(*((float*)static_QUType_ptr.get(_o+3))),(float)(*((float*)static_QUType_ptr.get(_o+4)))); break; case 7: updateScrollBars(); break; case 8: setEnabled((bool)static_QUType_bool.get(_o+1)); break; case 9: hslide((int)static_QUType_int.get(_o+1)); break; case 10: vslide((int)static_QUType_int.get(_o+1)); break; case 11: hbarIsPressed(); break; case 12: hbarIsReleased(); break; case 13: vbarIsPressed(); break; case 14: vbarIsReleased(); break; case 15: doDragAutoScroll(); break; case 16: startDragAutoScroll(); break; case 17: stopDragAutoScroll(); break; default: return QFrame::qt_invoke( _id, _o ); } return TRUE; }
void ossimGui::ImageScrollWidget::resizeEvent(QResizeEvent* event) { QAbstractScrollArea::resizeEvent(event); m_widget->resize(size()); updateScrollBars(); m_scrollOrigin.x = horizontalScrollBar()->value(); m_scrollOrigin.y = verticalScrollBar()->value(); updateTransforms(); setCacheRect(); if(m_layers->findFirstDirtyLayer()) { if(m_jobQueue.valid()) { if(!m_imageWidgetJob->isRunning()) m_imageWidgetJob->ready(); m_jobQueue->add(m_imageWidgetJob.get()); } } // This would be useful only for HUD?? //m_regOverlay->resize(event->size()); // event->accept(); //??? }
void AdvScrollArea::resizeEvent(QResizeEvent* e) { std::cout << "RESIZE TO: " << e->size().width() << ":"<< e->size().height() << std::endl; Q_UNUSED(e); // scrollbar size unsigned int scrS = 16; unsigned int top = (headerH.widget) ? (headerH.height) : (0); unsigned int left = (headerV.widget) ? (headerV.width) : (0); // area unsigned int areaW = width() - scrS - left; unsigned int areaH = height() - scrS - top; area->setGeometry(left, top, areaW, areaH); area->setMaximumSize(areaW, areaH); // scrollbar position scrollV->setGeometry(width()-scrS, top, scrS, height()-scrS-top); scrollH->setGeometry(left, height()-scrS, width()-scrS-left, scrS); // scrollbar values updateScrollBars(); // move the widget updateWidgetPosition(); }
void ScrollPane::add( Widget *widget ) { pChildContent->add(widget); pChildContent->setSize(Dimension(getContentWidth(),getContentHeight())); updateScrollBars(); }
void ScrollPane::setSize( const Dimension &size ) { Widget::setSize(size); updateScrollBars(); pChildContent->setSize(Dimension(getContentWidth(),getContentHeight())); }
void ossimGui::ImageScrollWidget::inputConnected(ossim_int32 /* idx */) { m_layers->adjustLayers(m_connectableObject.get()); // m_scalarRemapperChain->connectMyInputTo(0, m_connectableObject->getInput()); m_inputBounds = m_connectableObject->getBounds(); // setCacheRect(); if(!m_inputBounds.hasNans()) { updateScrollBars(); } updateTransforms(); setCacheRect(); // QPoint localPt(50,50); // QPoint viewPoint = m_localToView.map(localPt); if(m_jobQueue.valid()) { if(!m_imageWidgetJob->isRunning()) m_imageWidgetJob->ready(); m_jobQueue->add(m_imageWidgetJob.get()); } }
void CQueryTable::refresh() { if (isBlocked()) return; reset(); m_cancel = false; if (!query()->isResultNull()) { setBlocked(true); query()->dataSeek(0); uint num_fields = query()->numFields(); ulong num_rows = query()->numRows(); setNumRows(num_rows); setNumCols(num_fields); QPixmap icon; bool columns_ok = (keepColumnWidth() && previous_columns_map.count() == num_fields); if (columns_ok) for (uint i = 0; i < num_fields; i++) columns_ok &= (previous_columns_map[i].label == query()->fields(i).name); if (!columns_ok && keepColumnWidth()) previous_columns_map.clear(); for (uint i = 0; i < num_fields; i++) { if (IS_PRI_KEY(query()->fields(i).flags)) icon = pkIcon; else if (IS_MUL_KEY(query()->fields(i).flags)) icon = mulIcon; else if (IS_UNI_KEY(query()->fields(i).flags)) icon = uniIcon; else icon = nothingIcon; if (columns_ok && previous_columns_map[i].label == query()->fields(i).name) horizontalHeader()->setLabel(i, icon, query()->fields(i).name, previous_columns_map[i].size); else horizontalHeader()->setLabel(i, icon, query()->fields(i).name); } if (hasProcessEvents()) qApp->processEvents(); else updateScrollBars(); ulong j = 0; while (query()->next(!hasProcessEvents())) { if (m_cancel) break; for (uint i = 0; i < num_fields; i++) setText(j, i, query()->row(i)); j++; } setBlocked(false); emit refreshed(); } else if (!previous_columns_map.empty()) previous_columns_map.clear(); }
void ScrollZoomer::setVScrollBarPosition( ScrollBarPosition pos ) { if ( d_vScrollData->position != pos ) { d_vScrollData->position = pos; updateScrollBars(); } }
void MultiLineEdit::setScrollBarsEnabled(bool enable) { if (_scrollBarsEnabled == enable) return; _scrollBarsEnabled = enable; updateScrollBars(); }
void ScrollPane::sizeChanged( Widget* source, const Dimension &size ) { (void)source; (void)size; updateScrollBars(); if(source != pChildContent) pChildContent->setSize(Dimension(getContentWidth(),getContentHeight())); }
void RosegardenScrollView::resizeEvent(QResizeEvent* e) { QAbstractScrollArea::resizeEvent(e); updateScrollBars(); //### What was the purpose of this? // if (!horizontalScrollBar()->isVisible()) updateBottomWidgetGeometry(); }
void ScrollZoomer::setVScrollBarMode( Qt::ScrollBarPolicy mode ) { if ( vScrollBarMode() != mode ) { d_vScrollData->mode = mode; updateScrollBars(); } }
void CodeEditorComponent::moveCaretTo (const CodeDocument::Position& newPos, const bool highlighting) { caretPos = newPos; columnToTryToMaintain = -1; bool selectionWasActive = isHighlightActive(); if (highlighting) { if (dragType == notDragging) { if (abs (caretPos.getPosition() - selectionStart.getPosition()) < abs (caretPos.getPosition() - selectionEnd.getPosition())) dragType = draggingSelectionStart; else dragType = draggingSelectionEnd; } if (dragType == draggingSelectionStart) { selectionStart = caretPos; if (selectionEnd.getPosition() < selectionStart.getPosition()) { const CodeDocument::Position temp (selectionStart); selectionStart = selectionEnd; selectionEnd = temp; dragType = draggingSelectionEnd; } } else { selectionEnd = caretPos; if (selectionEnd.getPosition() < selectionStart.getPosition()) { const CodeDocument::Position temp (selectionStart); selectionStart = selectionEnd; selectionEnd = temp; dragType = draggingSelectionStart; } } rebuildLineTokensAsync(); } else { deselectAll(); } updateCaretPosition(); scrollToKeepCaretOnScreen(); updateScrollBars(); if (appCommandManager != nullptr && selectionWasActive != isHighlightActive()) appCommandManager->commandStatusChanged(); }
QcScrollArea::QcScrollArea() : paint(false), painting(false) { setViewport( new QWidget() ); scrollWidget = new QcScrollWidget( viewport() ); scrollWidget->installEventFilter( this ); updateScrollBars(); }
void ScrollZoomer::setHScrollBarMode(Qt::ScrollBarPolicy mode) #endif { if (hScrollBarMode() != mode) { d_hScrollData->mode = mode; updateScrollBars(); } }
void ScrollZoomer::rescale() { QwtScaleWidget *xScale = plot()->axisWidget( xAxis() ); QwtScaleWidget *yScale = plot()->axisWidget( yAxis() ); if ( zoomRectIndex() <= 0 ) { if ( d_inZoom ) { xScale->setMinBorderDist( 0, 0 ); yScale->setMinBorderDist( 0, 0 ); QwtPlotLayout *layout = plot()->plotLayout(); for ( int axis = 0; axis < QwtAxis::PosCount; axis++ ) layout->setAlignCanvasToScale( axis, d_alignCanvasToScales ); d_inZoom = false; } } else { if ( !d_inZoom ) { /* We set a minimum border distance. Otherwise the canvas size changes when scrolling, between situations where the major ticks are at the canvas borders (requiring extra space for the label) and situations where all labels can be painted below/top or left/right of the canvas. */ int start, end; xScale->getBorderDistHint( start, end ); xScale->setMinBorderDist( start, end ); yScale->getBorderDistHint( start, end ); yScale->setMinBorderDist( start, end ); QwtPlotLayout *layout = plot()->plotLayout(); for ( int axis = 0; axis < QwtAxis::PosCount; axis++ ) { d_alignCanvasToScales[axis] = layout->alignCanvasToScale( axis ); } layout->setAlignCanvasToScales( false ); d_inZoom = true; } } QwtPlotZoomer::rescale(); updateScrollBars(); }
void AdvScrollArea::setWidget(QWidget* content) { this->content = content; //layout->addWidget(content); content->setParent(area); content->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); content->setMinimumSize(100, 100); content->move(0,0); content->installEventFilter(this); updateScrollBars(); }
void ScrollPane::locationChanged( Widget* source, const Point &location ) { (void)source; (void)location; if(source != pChildContent) updateScrollBars(); if(source != pChildContent) pChildContent->setSize(Dimension(getContentWidth(),getContentHeight())); }
void CodeEditorComponent::moveCaretTo (const CodeDocument::Position& newPos, const bool highlighting) { caretPos = newPos; columnToTryToMaintain = -1; if (highlighting) { if (dragType == notDragging) { if (abs (caretPos.getPosition() - selectionStart.getPosition()) < abs (caretPos.getPosition() - selectionEnd.getPosition())) dragType = draggingSelectionStart; else dragType = draggingSelectionEnd; } if (dragType == draggingSelectionStart) { selectionStart = caretPos; if (selectionEnd.getPosition() < selectionStart.getPosition()) { const CodeDocument::Position temp (selectionStart); selectionStart = selectionEnd; selectionEnd = temp; dragType = draggingSelectionEnd; } } else { selectionEnd = caretPos; if (selectionEnd.getPosition() < selectionStart.getPosition()) { const CodeDocument::Position temp (selectionStart); selectionStart = selectionEnd; selectionEnd = temp; dragType = draggingSelectionStart; } } triggerAsyncUpdate(); } else { deselectAll(); } updateCaretPosition(); scrollToKeepCaretOnScreen(); updateScrollBars(); }
void ScrollPane::childAdded( Widget* source, Widget* widget ) { if(source == pChildContent) { widget->addWidgetListener(this); widget->addMouseListener(this); widget->addKeyboardListener(this); updateScrollBars(); } }
void CodeEditorComponent::resized() { linesOnScreen = (getHeight() - scrollbarThickness) / lineHeight; columnsOnScreen = (int) ((getWidth() - scrollbarThickness) / charWidth); lines.clear(); rebuildLineTokens(); ((CaretComponent*) caret)->updatePosition (*this); verticalScrollBar->setBounds (getWidth() - scrollbarThickness, 0, scrollbarThickness, getHeight() - scrollbarThickness); horizontalScrollBar->setBounds (gutter, getHeight() - scrollbarThickness, getWidth() - scrollbarThickness - gutter, scrollbarThickness); updateScrollBars(); }
void ScrollPane::remove( Widget *widget ) { if(widget) { widget->removeMouseListener(this); widget->removeKeyboardListener(this); widget->removeWidgetListener(this); } pChildContent->remove(widget); pChildContent->setSize(Dimension(getContentWidth(),getContentHeight())); updateScrollBars(); }
// ###### Constructor ####################################################### FractalGeneratorView::FractalGeneratorView(QWidget* parent) : QWidget(parent) { Thread = NULL; installEventFilter(this); Buffer = new FractalBuffer(); Q_CHECK_PTR(Buffer); Display = new ImageDisplay(this); Q_CHECK_PTR(Display); connect(Display, SIGNAL(offsetUpdate(int, int)), this, SLOT(slotOffsetUpdate(int, int))); connect(Display, SIGNAL(zoom()), this, SLOT(zoomIn())); connect(Display, SIGNAL(selection(unsigned int, unsigned int, unsigned int, unsigned int)), this, SLOT(slotSelectionUpdate(unsigned int, unsigned int, unsigned int, unsigned int))); XScrollBar = new QScrollBar(Qt::Horizontal, this); Q_CHECK_PTR(XScrollBar); connect(XScrollBar, SIGNAL(valueChanged(int)), this, SLOT(slotXScrollBarChange(int))); YScrollBar = new QScrollBar(Qt::Vertical, this); Q_CHECK_PTR(YScrollBar); connect(YScrollBar, SIGNAL(valueChanged(int)), this, SLOT(slotYScrollBarChange(int))); ControlLED = new QLabel(this); Q_CHECK_PTR(ControlLED); ControlLED->setFrameStyle(QFrame::Panel|QFrame::Sunken); QGridLayout* layout = new QGridLayout(this); Q_CHECK_PTR(layout); layout->addWidget(Display, 0, 0); layout->addWidget(XScrollBar, 1, 0); layout->addWidget(YScrollBar, 0, 1); layout->addWidget(ControlLED, 1, 1); SizeX = INITIAL_WIDTH; SizeY = INITIAL_HEIGHT; Display->reset(SizeX, SizeY); Display->setMinimumSize(SizeX, SizeY); Buffer->reset(Display->imageWidth(), Display->imageHeight()); Algorithm = FractalAlgorithmInterface::getAlgorithmByIdentifier("Mandelbrot"); Q_CHECK_PTR(Algorithm); ColorScheme = ColorSchemeInterface::getColorSchemeByIdentifier("SimpleHSV"); Q_CHECK_PTR(ColorScheme); C1 = Algorithm->defaultC1(); C2 = Algorithm->defaultC2(); Selection = false; ProgStep = 8; Algorithm->configure(Display->imageWidth(), Display->imageHeight(), C1, C2, Algorithm->defaultMaxIterations()); ColorScheme->configure(Algorithm->getMaxIterations()); startCalculation(); updateScrollBars(); }
void ScrollZoomer::setCornerWidget(QWidget* w) { if (w != d_cornerWidget) { if (canvas()) { delete d_cornerWidget; d_cornerWidget = w; if (d_cornerWidget->parent() != canvas()) d_cornerWidget->setParent(canvas()); updateScrollBars(); } } }
void TLFrameSequenceLayout::updateContentSize() { if ( contentsHeight() < number_of_frame_sequences * 24 ) { resizeContents( contentsWidth(), number_of_frame_sequences * 24 ); } else if ( contentsHeight() > number_of_frame_sequences * 24 && contentsHeight() > 90 ) { resizeContents( contentsWidth(), contentsHeight() - 24 ); } updateContents(); updateScrollBars(); parent_widget -> update(); }
// ###### Change image size ################################################# void FractalGeneratorView::changeSize(int X, int Y) { if(Thread != NULL) { stopCalculation(); } SizeX = X; SizeY = Y; Display->reset(SizeX, SizeY); Buffer->reset(Display->imageWidth(), Display->imageHeight()); Selection = false; Algorithm->changeSize(Display->imageWidth(), Display->imageHeight()); updateScrollBars(); }
bool AdvScrollArea::eventFilter(QObject* o, QEvent* e) { // if (d->widget && o != d->widget && e->type() == QEvent::FocusIn && QApplication::keypadNavigationEnabled()) { // if (o->isWidgetType()) // ensureWidgetVisible(static_cast<QWidget *>(o)); // } // child resized -> adjust scrollbars if (o == content && e->type() == QEvent::Resize) { updateScrollBars(); } return false; }
AdvScrollArea::AdvScrollArea(QWidget* parent) : QWidget(parent), content(nullptr) { // both scrollbars scrollV = new QScrollBar(Qt::Vertical, this); scrollH = new QScrollBar(Qt::Horizontal, this); // connect events connect(scrollV, SIGNAL(valueChanged(int)), this, SLOT(onScrollV())); connect(scrollH, SIGNAL(valueChanged(int)), this, SLOT(onScrollH())); // the widget accepting the content area = new QWidget(this); updateScrollBars(); updateWidgetPosition(); }
//============================================================================== void CodeEditorComponent::resized() { const int visibleWidth = getWidth() - scrollbarThickness - getGutterSize(); linesOnScreen = jmax (1, (getHeight() - scrollbarThickness) / lineHeight); columnsOnScreen = jmax (1, (int) (visibleWidth / charWidth)); lines.clear(); rebuildLineTokens(); updateCaretPosition(); if (gutter != nullptr) gutter->setBounds (0, 0, getGutterSize() - 2, getHeight()); verticalScrollBar.setBounds (getWidth() - scrollbarThickness, 0, scrollbarThickness, getHeight() - scrollbarThickness); horizontalScrollBar.setBounds (getGutterSize(), getHeight() - scrollbarThickness, visibleWidth, scrollbarThickness); updateScrollBars(); }
//============================================================================== void CodeEditorComponent::codeDocumentChanged (const CodeDocument::Position& affectedTextStart, const CodeDocument::Position& affectedTextEnd) { clearCachedIterators (affectedTextStart.getLineNumber()); triggerAsyncUpdate(); ((CaretComponent*) caret)->updatePosition (*this); if (affectedTextEnd.getPosition() >= selectionStart.getPosition() && affectedTextStart.getPosition() <= selectionEnd.getPosition()) deselectAll(); if (caretPos.getPosition() > affectedTextEnd.getPosition() || caretPos.getPosition() < affectedTextStart.getPosition()) moveCaretTo (affectedTextStart, false); updateScrollBars(); }