当前位置: 首页>>代码示例>>C++>>正文


C++ ensureVisible函数代码示例

本文整理汇总了C++中ensureVisible函数的典型用法代码示例。如果您正苦于以下问题:C++ ensureVisible函数的具体用法?C++ ensureVisible怎么用?C++ ensureVisible使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ensureVisible函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: switch

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;
}
开发者ID:AliYousuf,项目名称:univ-aca-mips,代码行数:26,代码来源:moc_qscrollview.cpp

示例2: qDebug

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 );
	
}
开发者ID:bagonzalez,项目名称:ncreport,代码行数:33,代码来源:ncpreview.cpp

示例3: ensureVisible

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() );
}
开发者ID:ShermanHuang,项目名称:kdesdk,代码行数:8,代码来源:bytearraycolumnview_p.cpp

示例4: update

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);
}
开发者ID:Antidote,项目名称:wiiking2_editor,代码行数:31,代码来源:qhexedit_p.cpp

示例5: tr

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.");

  }
}
开发者ID:BackupTheBerlios,项目名称:miro-middleware-svn,代码行数:29,代码来源:PolicyView.cpp

示例6: setCursorPosition

void QHexEdit::selectData(int position, int size)
{
	setCursorPosition(position * 2 - 1);
	resetSelection(position * 2);
	setSelection(position * 2 + size * 2);
	ensureVisible();
}
开发者ID:SilentControl,项目名称:mangler,代码行数:7,代码来源:qhexedit.cpp

示例7: dlg

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();
	}
}
开发者ID:antoine163,项目名称:Talv,代码行数:30,代码来源:manAction.cpp

示例8: ensureVisible

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
}
开发者ID:rperrot,项目名称:i-score,代码行数:7,代码来源:TemporalScenarioView.cpp

示例9: switch

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);
}
开发者ID:Frankie-666,项目名称:qupzilla,代码行数:32,代码来源:combotabbar.cpp

示例10: ensureVisible

bool ScrollArea::viewportEvent(QEvent* event)
{
  bool ret = QScrollArea::viewportEvent(event);
  if(event->type() == QEvent::LayoutRequest && widget() && scrollEnabled)
    ensureVisible(0, widget()->size().height());
  return ret;
}
开发者ID:weilandetian,项目名称:Yoyo,代码行数:7,代码来源:Console.cpp

示例11: makeUpToDate

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);
}
开发者ID:temper8,项目名称:FBReader-Tizen,代码行数:35,代码来源:LibraryView.cpp

示例12: ensureVisible

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 );
}
开发者ID:shanewfx,项目名称:vlc-arib,代码行数:32,代码来源:ctrl_tree.cpp

示例13: setTransformationAnchor

void CQLayoutView::slotResetZoom()
{
  setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
  resetMatrix();
  ensureVisible(scene()->itemsBoundingRect());
  update();
}
开发者ID:PriKalra,项目名称:COPASI,代码行数:7,代码来源:CQLayoutView.cpp

示例14: QMAX

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++;
	}
}
开发者ID:serghei,项目名称:kde3-kdegraphics,代码行数:31,代码来源:thumbnaillist.cpp

示例15: ensureVisible

void QHexEdit::refresh(bool showCursor)
{
    if (showCursor)
        ensureVisible();
    readBuffers();
    viewport()->update();
}
开发者ID:Lo91,项目名称:bsnes-plus,代码行数:7,代码来源:qhexedit.cpp


注:本文中的ensureVisible函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。