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;
}
Example #2
0
void NCPreviewScrollArea::keyPressEvent( QKeyEvent * e )
{
	int key = e->key();
	//const int scrollstep =20;

#ifdef REPORT_DEBUG_ON
	qDebug("NCPreviewScrollArea::keyPressEvent ... e->key()=%i", key );
	qDebug("verticalScrollBar()->value()=%i verticalScrollBar()->minimum()=%i verticalScrollBar()->maximum()=%i", 
		   verticalScrollBar()->value(), verticalScrollBar()->minimum(), verticalScrollBar()->maximum());
#endif
	
	if ( key == Qt::Key_PageUp ) {
		if ( verticalScrollBar()->value() == verticalScrollBar()->minimum() && pvForm->pageNo > 1  )
			pvForm->slotPrev();
		QScrollArea::keyPressEvent( e );
	}
	else if ( key == Qt::Key_PageDown ) {
		if ( verticalScrollBar()->value() == verticalScrollBar()->maximum() && pvForm->pageNo < pvForm->pageCount ) {
			pvForm->slotNext();
			ensureVisible( 0, 0 );
		} else
			QScrollArea::keyPressEvent( e );
	}
	else if ( key == Qt::Key_Home ) {
		ensureVisible( 0, 0 );
	}
	else if ( key == Qt::Key_End ) {
		ensureVisible( 0, widget()->height() );
	}
	else
		QScrollArea::keyPressEvent( e );
	
}
void ByteArrayColumnViewPrivate::ensureVisible( const AddressRange& range, bool ensureStartVisible )
{
    const CoordRange coords = mTableLayout->coordRangeOfIndizes( range );

    // TODO: this is a make-it-work-hack, better do a smart calculation
    ensureVisible( *mActiveColumn, ensureStartVisible ? coords.end() : coords.start() );
    ensureVisible( *mActiveColumn, ensureStartVisible ? coords.start() : coords.end() );
}
Example #4
0
void QHexEditPrivate::setCursorPos(int position)
{
    // delete cursor
    _blink = false;
    update();

    // cursor in range?
    if (_overwriteMode || !_insertAllowed)
    {
        if (position > (_xData.size() * 2 - 1))
            position = _xData.size() * 2 - 1;
    } else {
        if (position > (_xData.size() * 2))
            position = _xData.size() * 2;
    }

    if (position < 0)
        position = 0;

    // calc position
    _cursorPosition = position;
    _cursorY = (position / (2 * BYTES_PER_LINE)) * _charHeight + 4;
    int x = (position % (2 * BYTES_PER_LINE));
    _cursorX = (((x / 2) * 3) + (x % 2)) * _charWidth + _xPosHex;

    // immiadately draw cursor
    _blink = true;
    update();
    ensureVisible();
    emit currentAddressChanged(_cursorPosition/2);
}
void 
PolicyViewClass::onAddPattern()
{
  bool ok = false;
  QString text = QInputDialog::getText(
                    tr( "Add Pattern" ),
                    tr( "Pattern name:" ),
                    QLineEdit::Normal, QString::null, &ok, this );
  if ( ok && !text.isEmpty() ) {
    if (document.addPattern(text, picked_x, picked_y)) {
      PatternWidgetClass* patternWidget = new PatternWidgetClass(this, viewport(), text);
      addChild(patternWidget, picked_x, picked_y);
      patternWidget->show();  
      
      QRect r = viewport()->childrenRect();
      QPoint s = viewportToContents(r.bottomRight());

      resizeContents(s.x(), s.y());
      ensureVisible(picked_x, picked_y);

    }
    else
      QMessageBox::warning(this, 
			   "Add Pattern", 
			   "Pattern " + text + " allready exists.\n" + 
			   "No pattern added.");

  }
}
Example #6
0
void QHexEdit::selectData(int position, int size)
{
	setCursorPosition(position * 2 - 1);
	resetSelection(position * 2);
	setSelection(position * 2 + size * 2);
	ensureVisible();
}
Example #7
0
void WinManAction::onFind(wxCommandEvent&)
{	
	DlgPickShortcutKey dlg(this, _("Find a shortcut"));
	
	if(dlg.ShowModal() == wxID_OK)
	{
		//On récupère le raccourcie.
		ShortcutKey shortcut = dlg.getShortcutKey();
		
		//Le raccourci n'est pas valide.
		if(!shortcut.isOk())
		{
			wxMessageDialog dlg(this,
				_("You didn't pick a shortcut."),
				_("Shortcut no valid"),
				wxOK|wxICON_INFORMATION|wxCENTRE);
			dlg.ShowModal();
			
			return;
		}
		
		//On le rend visible
		if(ensureVisible(shortcut))
			return;
		
		//On n'a pas trouver le raccourcis.
		wxMessageDialog dlg(this, _("The shortcut didn't find."), _("Shortcut no valid"), wxOK|wxICON_INFORMATION|wxCENTRE);
		dlg.ShowModal();
	}
}
Example #8
0
void TemporalScenarioView::movedAsked(const QPointF& p)
{
    QRectF r = QRectF{m_previousPoint.x(), m_previousPoint.y() , 1, 1};
    ensureVisible(mapRectFromScene(r), 30, 30);
    emit moved(p);
    m_previousPoint = p; // we use the last pos, because if not there's a larsen and crash
}
Example #9
0
bool ComboTabBar::event(QEvent *event)
{
    switch (event->type()) {
    case QEvent::ToolTip:
        if (!isDragInProgress() && !isScrollInProgress()) {
            int index = tabAt(mapFromGlobal(QCursor::pos()));
            if (index >= 0)
                QToolTip::showText(QCursor::pos(), tabToolTip(index));
        }
        break;

    case QEvent::Resize:
        ensureVisible();
        break;

    case QEvent::Show:
        if (!event->spontaneous())
            QTimer::singleShot(0, this, &ComboTabBar::setUpLayout);
        break;

    case QEvent::Enter:
    case QEvent::Leave:
        // Make sure tabs are painted with correct mouseover state
        QTimer::singleShot(100, this, &ComboTabBar::updateTabBars);
        break;

    default:
        break;
    }

    return QWidget::event(event);
}
Example #10
0
bool ScrollArea::viewportEvent(QEvent* event)
{
  bool ret = QScrollArea::viewportEvent(event);
  if(event->type() == QEvent::LayoutRequest && widget() && scrollEnabled)
    ensureVisible(0, widget()->size().height());
  return ret;
}
Example #11
0
void LibraryView::showBook(shared_ptr<Book> book) {
	makeUpToDate();
	ZLBlockTreeNode::List bookNodes;
	std::queue<ZLBlockTreeNode*> nodesQueue;
	nodesQueue.push(&rootNode());
	while (!nodesQueue.empty()) {
		const ZLBlockTreeNode::List &children = nodesQueue.front()->children();
		nodesQueue.pop();
		for (ZLBlockTreeNode::List::const_iterator it = children.begin(); it != children.end(); ++it) {
			if ((*it)->isInstanceOf(BookNode::TYPE_ID)) {
				// TODO: replace with == for shared_ptr<Book>
				//if (((BookNode*)*it)->book() == book) {
				if (((BookNode*)*it)->book()->file() == book->file()) {
					bookNodes.push_back(*it);
				}
			} else {
				nodesQueue.push(*it);
			}
		}
	}
	if (bookNodes.empty()) {
		return;
	}
	ZLBlockTreeNode *nodeToShow = bookNodes[0];
	VisibilityMode mode = INVISIBLE;
	for (ZLBlockTreeNode::List::iterator it = bookNodes.begin(); it != bookNodes.end(); ++it) {
		VisibilityMode nodeMode = visibilityMode(*it);
		if ((nodeMode == VISIBLE && mode != VISIBLE) ||
				(nodeMode != INVISIBLE && mode == INVISIBLE)) {
			nodeToShow = *it;
			mode = nodeMode;
		}
	}
	ensureVisible(nodeToShow);
}
Example #12
0
void CtrlTree::autoScroll()
{
    // Find the current playing stream
    int playIndex = 0;
    VarTree::Iterator it;

    for( it = m_flat ? m_rTree.firstLeaf() : m_rTree.begin();
         it != m_rTree.end();
         it = m_flat ? m_rTree.getNextLeaf( it )
                     : m_rTree.getNextItem( it ) )
    {
        if( it->m_playing )
        {
           m_rTree.ensureExpanded( it );
           break;
        }
    }
    for( it = m_flat ? m_rTree.firstLeaf() : m_rTree.begin();
         it != m_rTree.end();
         it = m_flat ? m_rTree.getNextLeaf( it )
                     : m_rTree.getNextVisibleItem( it ) )
    {
        if( it->m_playing )
           break;
        playIndex++;
    }

    if( it == m_rTree.end() ) return;


    ensureVisible( playIndex );
}
Example #13
0
void CQLayoutView::slotResetZoom()
{
  setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
  resetMatrix();
  ensureVisible(scene()->itemsBoundingRect());
  update();
}
void ThumbnailList::notifyViewportChanged( bool /*smoothMove*/ )
{
	// skip notifies for the current page (already selected)
	int newPage = m_document->viewport().pageNumber;
	if ( m_selected && m_selected->pageNumber() == newPage )
		return;

	// deselect previous thumbnail
	if ( m_selected )
		m_selected->setSelected( false );
	m_selected = 0;

	// select the page with viewport and ensure it's centered in the view
	m_vectorIndex = 0;
	QValueVector<ThumbnailWidget *>::iterator tIt = m_thumbnails.begin(), tEnd = m_thumbnails.end();
	for ( ; tIt != tEnd; ++tIt )
	{
		if ( (*tIt)->pageNumber() == newPage )
		{
			m_selected = *tIt;
			m_selected->setSelected( true );
			if ( KpdfSettings::syncThumbnailsViewport() )
			{
				int yOffset = QMAX( visibleHeight() / 4, m_selected->height() / 2 );
				ensureVisible( 0, childY( m_selected ) + m_selected->height()/2, 0, yOffset );
			}
			break;
		}
		m_vectorIndex++;
	}
}
Example #15
0
void QHexEdit::refresh(bool showCursor)
{
    if (showCursor)
        ensureVisible();
    readBuffers();
    viewport()->update();
}
Example #16
0
void FMSampleTextView::mouseReleaseEvent ( QMouseEvent * e )
{
	if ( isPanning )
	{
		isPanning = false;
		QApplication::restoreOverrideCursor();
		return;
	}
	if ( !isSelecting )
		return;
// 	qDebug()<<"End mouse is "<< mapToScene( e->pos()).toPoint();
	if ( mouseStartPoint.toPoint() == mapToScene ( e->pos() ).toPoint() )
	{
		// scale(1,1)
// 		qDebug() << "Re-init transformation";
		emit pleaseZoom ( 0 );
		isSelecting = false;
		theRect->setRect ( QRectF() );
		return;
	}

	QRect zoomRect ( mouseStartPoint.toPoint(),mapToScene ( e->pos() ).toPoint() );
	ensureVisible ( zoomRect );
	isSelecting = false;
// 	qDebug() << "release " << theRect->scenePos();
	fitInView ( theRect->sceneBoundingRect(), Qt::KeepAspectRatio );
	theRect->setRect ( QRectF() );



}
Example #17
0
void UIPageText::updateContents()
{
        int ch = contentsHeight();
        int vw = visibleWidth();

        ensureVisible( 0, ch, 0, 0 );
        repaintContents( 0, ch - 40, vw, 40, true );
}
void InitVirtualDriveDialog::fail(const QString& reason)
{
    ensureVisible();

    setStatusText(reason);
    mFinishBtn->setVisible(true);
    connect(mFinishBtn, SIGNAL(clicked()), this, SLOT(reject()));
}
Example #19
0
void gTextArea::setPosition(int vl)
{
	GtkTextIter *iter = getIterAt();
	
	gtk_text_iter_set_offset(iter, vl);
	gtk_text_buffer_place_cursor(_buffer, iter);
	ensureVisible();
}
Example #20
0
void ContextualView::setTrack(Track *track) {
    setUpdatesEnabled(false);
    scrollingContextualView->artistInfo->setArtist(track->getArtist());
    scrollingContextualView->albumInfo->setAlbum(track->getAlbum());
    scrollingContextualView->trackInfo->setTrack(track);
    scrollingContextualView->adjustSize();
    ensureVisible(0, 0, 1, 1);
    setUpdatesEnabled(true);
}
Example #21
0
void ePageView::gotoOperator(eGuiOperator *guiOp)
{
    eASSERT(guiOp != eNULL);

    ensureVisible(guiOp);

    m_gotoAnim.setItem(guiOp);
    m_gotoAnimTimeLine.start();
}
Example #22
0
void QTodoList::jumpToFirst()
{
	QTodoListIterator it(this);
	if(QTodoItem* item = it.item())
	{
		item->setFocusOnTask();
		ensureVisible(0,item->mapToParent(QPoint(0,0)).y(),0,0);
	}
}
Example #23
0
void PsiContactListView::contactAlert(const QModelIndex& realIndex)
{
	QModelIndex index = proxyIndex(realIndex);
	itemDelegate()->contactAlert(index);

	bool alerting = index.data(ContactListModel::IsAlertingRole).toBool();
	if (alerting && PsiOptions::instance()->getOption("options.ui.contactlist.ensure-contact-visible-on-event").toBool()) {
		ensureVisible(index);
	}
}
Example #24
0
void TimeLineWidget::update_timer()
{
	if (playing_)
	{
		current_ = time2pos(preview_time_);
		cursor_->setPos(QPointF(current_, cursor_->pos().y()));
		ensureVisible(cursor_);
		repaint();
	}
}
Example #25
0
void QTodoList::addTodo(int index, int depth)
{
	QTodoItem* item = new QTodoItem(vbox);
	insertTodo(item,index,depth);
	item->setFocusOnTask();
	item->adjustSize();
	ensureVisible(0,item->mapToParent(QPoint(0,item->height()/2)).y(),0,item->height()/2);
	QSize s = item->sizeHint();
	s.setWidth(vbox->width()-vbox->margin()*2);
	item->resize(s);
}
Example #26
0
void QTodoList::addTodo()
{
	QTodoItem* item = new QTodoItem(vbox);

	insertTodo(item,-1);
	item->setDepth(0);
	item->setFocusOnTask();
	item->adjustSize();
	ensureVisible(0,item->mapToParent(QPoint(0,item->height())).y(),0,0);
	fixItemSize(item);
}
void UIGChooserView::sltFocusChanged(UIGChooserItem *pFocusItem)
{
    /* Make sure focus-item set: */
    if (!pFocusItem)
        return;

    QSize viewSize = viewport()->size();
    QRectF geo = pFocusItem->geometry();
    geo &= QRectF(geo.topLeft(), viewSize);
    ensureVisible(geo, 0, 0);
}
Example #28
0
    void Display::doSearch(const char* word)
    {
        _resetDisplay();
        _checkThesaurus();

        ensureVisible(0, 0);

        if (d_thesaurus.find(word))
            _displayResults(word);
        else
            _displayAlternatives();
    }
Example #29
0
qint64 QHexEdit::lastIndexOf(const QByteArray &ba, qint64 from)
{
    qint64 pos = _chunks->lastIndexOf(ba, from);
    if (pos > -1)
    {
        qint64 curPos = pos*2;
        setCursorPosition(curPos - 1);
        resetSelection(curPos);
        setSelection(curPos + ba.length()*2);
        ensureVisible();
    }
    return pos;
}
Example #30
0
void QTodoList::navigateDown(QTodoItem* item, int i)
{
	int pos = findWidget(item);
	QTodoListIterator it(this);
	it.goTo(pos+1);
	for(;it.current(); ++it)
		if(QTodoItem* current = dynamic_cast<QTodoItem*>(it.current()))
		{
			current->setCursorToBegin(i);
			ensureVisible(0,current->mapToParent(QPoint(0,current->height())).y(),0,0);
			return;
		}
}