本文整理汇总了C++中scrollTo函数的典型用法代码示例。如果您正苦于以下问题:C++ scrollTo函数的具体用法?C++ scrollTo怎么用?C++ scrollTo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了scrollTo函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例3: setFlow
void ImageThumbnailBar::slotDockLocationChanged(Qt::DockWidgetArea area)
{
if (area == Qt::LeftDockWidgetArea || area == Qt::RightDockWidgetArea)
{
setFlow(TopToBottom);
}
else
{
setFlow(LeftToRight);
}
scrollTo(currentIndex());
}
示例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();
}
示例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 );
}
示例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");
}
示例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());
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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);
}
示例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
}
示例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));
}
示例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();
}
示例15: setCurrentIndex
void PoitemTableView::currentChanged(const QModelIndex ¤t, 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");
}