• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ scrollTo函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: scrollDown

bool WidgetScrollBox::getNext() {
	if (children.empty()) {
		scrollDown();
		return true;
	}

	if (currentChild != -1)
		children[currentChild]->in_focus = false;
	currentChild+=1;
	currentChild = (static_cast<unsigned>(currentChild) == children.size()) ? 0 : currentChild;

	if (children[currentChild]->pos.y > (cursor + pos.h) ||
			(children[currentChild]->pos.y + children[currentChild]->pos.h) > (cursor + pos.h)) {
		scrollTo(children[currentChild]->pos.y+children[currentChild]->pos.h-pos.h);
	}
	if (children[currentChild]->pos.y < cursor ||
			(children[currentChild]->pos.y + children[currentChild]->pos.h) < cursor) {
		scrollTo(children[currentChild]->pos.y);
	}
	children[currentChild]->in_focus = true;
	return true;
}
开发者ID:theomission,项目名称:flare-engine,代码行数:22,代码来源:WidgetScrollBox.cpp


示例2: scrollUp

bool WidgetScrollBox::getPrev() {
	if (children.empty()) {
		scrollUp();
		return true;
	}

	if (currentChild != -1)
		children[currentChild]->in_focus = false;
	currentChild-=1;
	currentChild = (currentChild < 0) ? static_cast<int>(children.size()) - 1 : currentChild;

	if (children[currentChild]->pos.y > (cursor + pos.h) ||
			(children[currentChild]->pos.y + children[currentChild]->pos.h) > (cursor + pos.h)) {
		scrollTo(children[currentChild]->pos.y+children[currentChild]->pos.h-pos.h);
	}
	if (children[currentChild]->pos.y < cursor ||
			(children[currentChild]->pos.y + children[currentChild]->pos.h) < cursor) {
		scrollTo(children[currentChild]->pos.y);
	}
	children[currentChild]->in_focus = true;
	return true;
}
开发者ID:theomission,项目名称:flare-engine,代码行数:22,代码来源:WidgetScrollBox.cpp


示例3: setFlow

void ImageThumbnailBar::slotDockLocationChanged(Qt::DockWidgetArea area)
{
    if (area == Qt::LeftDockWidgetArea || area == Qt::RightDockWidgetArea)
    {
        setFlow(TopToBottom);
    }
    else
    {
        setFlow(LeftToRight);
    }

    scrollTo(currentIndex());
}
开发者ID:KDE,项目名称:digikam,代码行数:13,代码来源:imagethumbnailbar.cpp


示例4: model

void EntityView::rowsInserted(const QModelIndex &parent, int start, int end)
{
    QTreeView::rowsInserted(parent, start, end);
    static bool loadedCurrentContact = false;

    if (loadedCurrentContact) {
        return;
    }

    QModelIndex selectedIndex;
    QCommandLineParser parser;

    if (QCoreApplication::arguments().count() == 1 && KTp::kpeopleEnabled()) {
        const QString selectedPersonaId = QCoreApplication::arguments().at(0);
        for (int i = start; i <= end; i++) {
            const QModelIndex index = model()->index(i, 0, parent);
            if (index.data(KTp::PersonIdRole).toUrl().toString() == selectedPersonaId) {
                selectedIndex = index;
                break;
            }
        }
    } else if (QCoreApplication::arguments().count() == 2) {
        QString selectAccountId = QCoreApplication::arguments().at(0);
        QString selectContactId = QCoreApplication::arguments().at(1);

        for (int i = start; i <= end; i++) {
            QModelIndex index = model()->index(i, 0, parent);
            Tp::AccountPtr account = index.data(PersonEntityMergeModel::AccountRole).value<Tp::AccountPtr>();
            KTp::LogEntity entity = index.data(PersonEntityMergeModel::EntityRole).value<KTp::LogEntity>();
            if (account.isNull() || !entity.isValid()) {
                continue;
            }

            if (selectAccountId == account->uniqueIdentifier() && selectContactId == entity.id()) {
                selectedIndex = index;
                break;
            }
        }
    }

    if (selectedIndex.isValid()) {
        loadedCurrentContact = true;
        setCurrentIndex(selectedIndex);
        scrollTo(selectedIndex);
    } else {
        Q_EMIT noSuchContact();
    }

    expandAll();

}
开发者ID:KDE,项目名称:ktp-text-ui,代码行数:51,代码来源:entity-view.cpp


示例5: QWidget

RubberbandmanMainWidget::RubberbandmanMainWidget( QWidget *parent, Qt::WindowFlags flags )
: QWidget( parent, flags )
, mpBrowseWidget( new BrowseWidget( this ) )
, mpSatelliteWidget( new SatelliteWidget( this ) )
, mpDatabaseWidget( new DatabaseWidget( this ) )
, mpTabs( new QTabWidget( this ) )
, mpSettingsButton( new QPushButton( tr("Settings"), this ) )
, mpDatabaseActivity( new QLabel( this ) )
, mpConfigDialog( new RubberbandmanConfigDialog( this ) )
, mActiveLED( LEDIcon::pixmap( QColor("#ff0000"), 25 ) )
, mIdleLED( LEDIcon::pixmap( QColor("#5f0000"), 25 ) )
{
   mpBrowseWidget->setObjectName( "BrowseWidget" );
   mpSatelliteWidget->setObjectName( "SatelliteWidget" );
   mpDatabaseWidget->setObjectName( "DatabaseWidget" );
   QVBoxLayout *mainLayout = new QVBoxLayout( this );
   mainLayout->setContentsMargins( 3, 3, 3, 3 );
   parent->setWindowIcon( QIcon( ":/Rubberbandman/Icon.png" ) );

   mpTabs->addTab( mpBrowseWidget,    tr("Filesystem") );
   mpTabs->addTab( mpSatelliteWidget, tr("Satellite") );
   mpTabs->addTab( mpDatabaseWidget,  tr("Database") );
   mpTabs->setCurrentIndex( Settings::value( Settings::RubberbandmanCurrentTab ) );

   mainLayout->addWidget( mpTabs );
   QHBoxLayout *bottomLayout( new QHBoxLayout() );
   bottomLayout->addWidget( mpSettingsButton, 1 );
   bottomLayout->addWidget( mpDatabaseActivity, 0 );
   mainLayout->addLayout( bottomLayout );

   connect( mpSatelliteWidget, SIGNAL(showInFilesystem(QString)),
            mpBrowseWidget, SLOT(scrollTo(QString)) );
   connect( mpSatelliteWidget, SIGNAL(showInFilesystem(QString)),
            this, SLOT(goToFilesystem()) );
   connect( mpTabs, SIGNAL(currentChanged(int)),
            this, SLOT(handleTabChange(int)) );
   connect( mpSettingsButton, SIGNAL(clicked()),
            mpConfigDialog, SLOT(exec()) );
   connect( mpSatelliteWidget, SIGNAL(partymanConfigUpdate()),
            mpDatabaseWidget, SLOT(readPartymanConfig()) );
   DatabaseInterface::get()->connectActivityIndicator( this, SLOT(databaseActive(bool)) );
   WindowIconChanger *wic = new WindowIconChanger( parent, QIcon(":/Common/DatabaseUp.png"), this );
   DatabaseInterface::get()->connectActivityIndicator( wic, SLOT(changed(bool)) );

   setLayout( mainLayout );

   mpSettingsButton->setObjectName( QString("SettingsButton") );

   WidgetShot::addWidget( "MainWidget", this );
}
开发者ID:SvOlli,项目名称:SLART,代码行数:50,代码来源:RubberbandmanMainWidget.cpp


示例6: model

void EventList::setCurrentEvent(EventModel* eventPtr)
{
    for(int i = 0; i < events.size(); ++i)
    {
        if ((*events[i]) == *eventPtr)
        {
            QModelIndex index = model()->index(i, 0, QModelIndex());
            setCurrentIndex(index);
            scrollTo(index);
            return;
        }
    }
    qFatal("Can't find given event in the list");
}
开发者ID:cojuer,项目名称:vis4,代码行数:14,代码来源:event_list.cpp


示例7: throw

FreezeInfo::FreezeInfo(QObject *parent,
		       QMultiScope *backend0, QScrollBar *frontend0,
		       QLabel *timereport0, int width_ms0,
		       RawSFCli *rawsrc, SpikeSFCli *spikesrc,
		       QWidget *hideme0) throw(Error):
  QObject(parent) {
  origrawsf = rawsrc;
  origspikesf = spikesrc;
  backend = backend0;
  frontend = frontend0;
  timereport = timereport0;
  hideme = hideme0;
  width_ms = width_ms0;
  dead = false;
  
  dbx("Freezeinfo constructor - building sources");
  if (rawsrc) 
    rawsf = new SFFreeze<Sample, RawAux>(*rawsrc);
  else
    rawsf = 0;
  if (spikesrc)
    spikesf = new SFFreeze<Spikeinfo, SpikeAux>(*spikesrc);
  else
    spikesf = 0;
  dbx("Freezeinfo constructor - done building sources");

  QSSource qss = backend->source();
  qss.sf = rawsf;
  backend->setSource(qss);
  backend->setSpikeSource(spikesf);

  if (rawsf) {
    int dt_ms = (rawsf->safelatest() - rawsf->safefirst()) / FREQKHZ;
    t0 = rawsf->safelatest() - dt_ms*FREQKHZ;
    sdbx("Freezeinfo: dt_ms=%i t0=%Li first=%Li latest=%Li",
	 dt_ms,t0,rawsf->safefirst(),rawsf->safelatest());
  } else {
    t0 = 0;
  }
  frontend->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,
				      QSizePolicy::Fixed));
  frontend->show();
  if (hideme)
    hideme->hide();
  resetslider();
  connect(frontend,SIGNAL(valueChanged(int)),this,SLOT(scrollTo(int)));
  frontend->setValue(frontend->maxValue());
  scrollTo(frontend->maxValue());
}
开发者ID:maru-n,项目名称:meabench_robot,代码行数:49,代码来源:FreezeInfo.C


示例8: model

// Preserves item's selection state
void CFileListView::moveCursorToItem(const QModelIndex& index, bool invertSelection)
{
	if (index.isValid() && selectionModel()->model()->hasIndex(index.row(), index.column()))
	{
		const QModelIndex fixedIndex = model()->index(index.row(), index.column());
		const QModelIndex currentIdx = currentIndex();
		if (invertSelection && currentIdx.isValid())
		{
			for (int row = currentIdx.row(); row < fixedIndex.row(); ++row)
				selectionModel()->setCurrentIndex(fixedIndex, (!_shiftPressedItemSelected ? QItemSelectionModel::Select : QItemSelectionModel::Deselect) | QItemSelectionModel::Rows);
		}
		selectionModel()->setCurrentIndex(fixedIndex, QItemSelectionModel::Current | QItemSelectionModel::Rows);
		scrollTo(fixedIndex);
	}
}
开发者ID:antis81,项目名称:file-commander,代码行数:16,代码来源:cfilelistview.cpp


示例9: RK_TRACE

void RKObjectListView::setObjectCurrent (RObject *object, bool only_if_none_current) {
	RK_TRACE (APP);

	if (!object) return;
	if (only_if_none_current && currentIndex ().isValid ()) return;

	QModelIndex index = settings->mapFromSource (RKGlobals::tracker ()->indexFor (object));
	if (index.isValid ()) {
		scrollTo (index);
		setCurrentIndex (index);
		resizeColumnToContents (0);
	} else {
		RK_ASSERT (false);
	}
}
开发者ID:KDE,项目名称:rkward,代码行数:15,代码来源:rkobjectlistview.cpp


示例10: scrollTo

void Viewport::changeSceneZoom(){
    Vec2 orgPt = m_TargetNode->getPosition();
    float orgS = m_TargetNode->getScale();
    float finalS = orgS - 0.2;
    float time = 0.2;
    Vec2 setPt = orgPt * (finalS / orgS);
    scrollTo(setPt, NULL);
    applyZoom(finalS);
    Vec2 finalPt = m_TargetNode->getPosition();
    finalS = m_TargetNode->getScale();
    m_TargetNode->setPosition(orgPt);
    m_TargetNode->setScale(orgS);
    Spawn *spawn =Spawn::createWithTwoActions(MoveTo::create(time, finalPt), ScaleTo::create(time, finalS));
    m_TargetNode->runAction(spawn);
}
开发者ID:ourgames,项目名称:nbg,代码行数:15,代码来源:Viewport.cpp


示例11: findIndex

void MusicListView::onLocate(const MetaPtr meta)
{
    QModelIndex index = findIndex(meta);
    if (!index.isValid()) {
        return;
    }

    clearSelection();

    auto viewRect = QRect(QPoint(0, 0), size());
    if (!viewRect.intersects(visualRect(index))) {
        scrollTo(index, MusicListView::PositionAtCenter);
    }
    setCurrentIndex(index);
}
开发者ID:linuxdeepin,项目名称:deepin-music,代码行数:15,代码来源:musiclistview.cpp


示例12: scrollTop

void scrollTop(NPP instance, NPObject *scroller)
	{
#if 1
	scrollTo(instance, scroller, 0, false);
#else
	//scroller.mojo.revealTop(0)
	//	TODO:	test again with NULL_TO_NPVARIANT(args) and/or VOID_TO_NPVARIANT(args)
	//		as when OBJECT_TO_NPVARIANT(0, args) was used it crashed
	NPVariant args;
	NULL_TO_NPVARIANT(args);
	//debug(DBG_MAIN, "scrollTop()");
	NPVariant var;
	scrollCommon(instance, scroller, "revealTop", args, 1, &var);
#endif
	}
开发者ID:wosigh,项目名称:terminal,代码行数:15,代码来源:api.c


示例13: scrollTo

void HFViewport::changeSceneZoom(){
    CCPoint orgPt = m_TargetNode->getPosition();
    float orgS = m_TargetNode->getScale();
    float finalS = orgS - 0.2;
    float time = 0.2;
    CCPoint setPt = orgPt * (finalS / orgS);
    scrollTo(setPt, NULL);
    applyZoom(finalS);
    CCPoint finalPt = m_TargetNode->getPosition();
    finalS = m_TargetNode->getScale();
    m_TargetNode->setPosition(orgPt);
    m_TargetNode->setScale(orgS);
    CCSpawn *spawn =CCSpawn::createWithTwoActions(CCMoveTo::create(time, finalPt), CCScaleTo::create(time, finalS));
    m_TargetNode->runAction(CCSequence::create(spawn, NULL));
}
开发者ID:ourgames,项目名称:dc208,代码行数:15,代码来源:HFViewport.cpp


示例14: dropIndicatorPosition

void HierarchyTreeControl::HandleDragMoveControlMimeData(QDragMoveEvent *event, const ControlMimeData* /*mimeData*/)
{
    DropIndicatorPosition position = dropIndicatorPosition();
    Logger::Warning("POSITION TYPE^ %i", position);

	// Where we are in tree?
	QTreeWidgetItem* item = itemAt(event->pos());
	if (!item)
	{
		HierarchyTreeController::Instance()->ResetSelectedControl();
		return;
	}

	HierarchyTreeNode::HIERARCHYTREENODEID insertInto = HierarchyTreeNode::HIERARCHYTREENODEID_EMPTY;
	QVariant data = item->data(ITEM_ID);
	insertInto = data.toInt();
	
	// Handle specific types of nodes.
	HierarchyTreeNode* nodeToInsertControlTo = HierarchyTreeController::Instance()->GetTree().GetNode(insertInto);
	if (dynamic_cast<HierarchyTreePlatformNode*>(nodeToInsertControlTo) ||
		dynamic_cast<HierarchyTreeAggregatorControlNode*>(nodeToInsertControlTo))
	{
		// Don't allow to drop the controls directly to Platform or Aggregator.
		HierarchyTreeController::Instance()->ResetSelectedControl();
		return;
	}
	
	// Expand the items while dragging control on them.
	if (!item->isExpanded())
	{
		item->setExpanded(true);
	}

	scrollTo(indexAt(event->pos()));

	HierarchyTreeControlNode* controlNode = dynamic_cast<HierarchyTreeControlNode*>(nodeToInsertControlTo);
	if (controlNode)
	{
		// Don't reselect the same control, if it is already selected.
		if (!HierarchyTreeController::Instance()->IsControlSelected(controlNode))
		{
			HierarchyTreeController::Instance()->ResetSelectedControl();
			HierarchyTreeController::Instance()->SelectControl(controlNode);
		}
	}

	event->accept();
}
开发者ID:droidenko,项目名称:dava.framework,代码行数:48,代码来源:hierarchytreecontrol.cpp


示例15: setCurrentIndex

void PoitemTableView::currentChanged(const QModelIndex &current, const QModelIndex &previous )
{
  if (DEBUG) qDebug("PoitemTableView::currentChanged(current %d,%d prev %d,%d)",
                    current.row(),  current.column(),
                    previous.row(), previous.column());
  if (current != QModelIndex() && current != previous)
  {
    if (DEBUG) qDebug("PoitemTableView::currentChanged setting current");
    setCurrentIndex(current);
    if (DEBUG) qDebug("PoitemTableView::currentChanged scrolling to current");
    scrollTo(current);
    if (DEBUG) qDebug("PoitemTableView::currentChanged editing current");
    edit(current);
  }
  if (DEBUG) qDebug("PoitemTableView::currentChanged returning");
}
开发者ID:dwatson78,项目名称:qt-client,代码行数:16,代码来源:poitemTableView.cpp


示例16: selectionModel

void DActionsListView::makeSelection(QModelIndexList indexes, QModelIndex ScrolledTo)
{
    //selectionModel()->clear();
    bool CurrentIndexHasBeenSet = false;
    for(auto& index : indexes)
    {
        if(not CurrentIndexHasBeenSet)
        {
            selectionModel()->setCurrentIndex(index, QItemSelectionModel::NoUpdate);
            CurrentIndexHasBeenSet = false;
        }
        selectionModel()->select(index, QItemSelectionModel::Select);
    }
    if(ScrolledTo.isValid())
        scrollTo(ScrolledTo);
}
开发者ID:WhiZTiM,项目名称:duplichase,代码行数:16,代码来源:dactionslistview.cpp


示例17: scrollTo

void FlickCharm::timerEvent(QTimerEvent *event) {
  //  qDebug() << __FUNCTION__ << "timer" << m_count <<  m_speed << m_count * m_speed;
  m_count++;

  // 0..100 -> 0..1
  scrollTo(m_releasePos + m_speed / MULT);

  // create unit vector
  QPoint unit = MULT * m_speed / m_speed.manhattanLength();
  if(m_count >= 1000 || unit.manhattanLength() > m_speed.manhattanLength()) 
    m_timer.stop();
  else
    m_speed -= unit;
  
  QObject::timerEvent(event);
} 
开发者ID:harbaum,项目名称:CacheMe,代码行数:16,代码来源:flickcharm.cpp


示例18: scrollTo

void Pageview::scrollToEnd (bool ifAtEnd)
   {
//    QScrollBar *vs = verticalScrollBar ();

//    qDebug () << "scrollToEnd" << _autoscroll;
   if (!ifAtEnd || _autoscroll)
      {
      _ignore_scroll = true;
      // doesn't seem to work, perhaps because the window extent hasn't been updated yet
//       vs->setValue (vs->maximum ());

      // so use this instead
      scrollTo (model ()->index (model ()->rowCount (QModelIndex ()) - 1, 0, QModelIndex ()));
      _ignore_scroll = false;
      }
   }
开发者ID:arunjalota,项目名称:paperman,代码行数:16,代码来源:pageview.cpp


示例19: expand

void DiveListView::selectDive(struct dive *dive, bool scrollto, bool toggle)
{
	QSortFilterProxyModel *m = qobject_cast<QSortFilterProxyModel*>(model());
	QModelIndexList match = m->match(m->index(0,0), TreeItemDT::NR, dive->number, 1, Qt::MatchRecursive);
	QItemSelectionModel::SelectionFlags flags;
	QModelIndex idx = match.first();

	QModelIndex parent = idx.parent();
	if (parent.isValid())
		expand(parent);
	flags = toggle ? QItemSelectionModel::Toggle : QItemSelectionModel::Select;
	flags |= QItemSelectionModel::Rows;
	selectionModel()->select( idx, flags);
	if (scrollto)
		scrollTo(idx, PositionAtCenter);
}
开发者ID:DeadRoolz,项目名称:subsurface,代码行数:16,代码来源:divelistview.cpp


示例20: clearSelection

void ExtendedTableWidget::selectTableLine(int lineToSelect)
{
    SqliteTableModel* m = qobject_cast<SqliteTableModel*>(model());

    // Are there even that many lines?
    if(lineToSelect >= m->rowCount())
        return;

    QApplication::setOverrideCursor( Qt::WaitCursor );
    m->triggerCacheLoad(lineToSelect);

    // Select it
    clearSelection();
    selectRow(lineToSelect);
    scrollTo(currentIndex(), QAbstractItemView::PositionAtTop);
    QApplication::restoreOverrideCursor();
}
开发者ID:hasufell,项目名称:sqlitebrowser,代码行数:17,代码来源:ExtendedTableWidget.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ scrollToBottom函数代码示例发布时间:2022-05-30
下一篇:
C++ scrollDown函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap