本文整理汇总了C++中QScrollBar::sliderPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ QScrollBar::sliderPosition方法的具体用法?C++ QScrollBar::sliderPosition怎么用?C++ QScrollBar::sliderPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QScrollBar
的用法示例。
在下文中一共展示了QScrollBar::sliderPosition方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: replaceScrollBar
/*! \internal
*/
void QAbstractScrollAreaPrivate::replaceScrollBar(QScrollBar *scrollBar,
Qt::Orientation orientation)
{
Q_Q(QAbstractScrollArea);
QAbstractScrollAreaScrollBarContainer *container = scrollBarContainers[orientation];
bool horizontal = (orientation == Qt::Horizontal);
QScrollBar *oldBar = horizontal ? hbar : vbar;
if (horizontal)
hbar = scrollBar;
else
vbar = scrollBar;
scrollBar->setParent(container);
container->scrollBar = scrollBar;
container->layout->removeWidget(oldBar);
container->layout->insertWidget(0, scrollBar);
scrollBar->setVisible(oldBar->isVisibleTo(container));
scrollBar->setInvertedAppearance(oldBar->invertedAppearance());
scrollBar->setInvertedControls(oldBar->invertedControls());
scrollBar->setRange(oldBar->minimum(), oldBar->maximum());
scrollBar->setOrientation(oldBar->orientation());
scrollBar->setPageStep(oldBar->pageStep());
scrollBar->setSingleStep(oldBar->singleStep());
scrollBar->setSliderDown(oldBar->isSliderDown());
scrollBar->setSliderPosition(oldBar->sliderPosition());
scrollBar->setTracking(oldBar->hasTracking());
scrollBar->setValue(oldBar->value());
delete oldBar;
QObject::connect(scrollBar, SIGNAL(valueChanged(int)),
q, horizontal ? SLOT(_q_hslide(int)) : SLOT(_q_vslide(int)));
QObject::connect(scrollBar, SIGNAL(rangeChanged(int,int)),
q, SLOT(_q_showOrHideScrollBars()), Qt::QueuedConnection);
}
示例2: moveDrag
/**
* @param x x coordinate
* @param y y coordinate
*/
void CanvasView::moveDrag(int x, int y)
{
const int dx = _dragx - x;
const int dy = _dragy - y;
if(_isdragging==ROTATE) {
qreal preva = qAtan2( width()/2 - _dragx, height()/2 - _dragy );
qreal a = qAtan2( width()/2 - x, height()/2 - y );
setRotation(rotation() + qRadiansToDegrees(preva-a));
} else {
QScrollBar *ver = verticalScrollBar();
ver->setSliderPosition(ver->sliderPosition()+dy);
QScrollBar *hor = horizontalScrollBar();
hor->setSliderPosition(hor->sliderPosition()+dx);
}
_dragx = x;
_dragy = y;
// notify of scene change
sceneChanged();
}
示例3: moveDrag
/**
* @param x x coordinate
* @param y y coordinate
*/
void EditorView::moveDrag(int x, int y)
{
const int dx = dragx_ - x;
const int dy = dragy_ - y;
if(isdragging_==ROTATE) {
qreal preva = atan2( width()/2 - dragx_, height()/2 - dragy_ );
qreal a = atan2( width()/2 - x, height()/2 - y );
setRotation(rotation() + (preva-a) * (180.0 / M_PI));
} else {
QScrollBar *ver = verticalScrollBar();
ver->setSliderPosition(ver->sliderPosition()+dy);
QScrollBar *hor = horizontalScrollBar();
hor->setSliderPosition(hor->sliderPosition()+dx);
}
dragx_ = x;
dragy_ = y;
// notify of scene change
sceneChanged();
}
示例4: moveDefinicio
void Main::moveDefinicio(QEvent *event)
{
int type = event->type();
int step,pagestep;
QScrollBar *bar;
bar=ui.definicio->verticalScrollBar();
step=bar->singleStep();
pagestep=bar->pageStep();
if (type == QEvent::User+Auxiliar::KeyDown()) {
bar->setSliderPosition(bar->sliderPosition()+step);
}
else if (type == QEvent::User+Auxiliar::KeyUp()) {
bar->setSliderPosition(bar->sliderPosition()-step);
}
else if (type == QEvent::User+Auxiliar::KeyNextPage()) {
bar->setSliderPosition(bar->sliderPosition()+pagestep);
}
else if (type == QEvent::User+Auxiliar::KeyPrevPage()) {
bar->setSliderPosition(bar->sliderPosition()-pagestep);
}
}
示例5: populateTable
void TrackListView::populateTable()/*{{{*/
{
if(debugMsg)
printf("TrackListView::populateTable\n");
QScrollBar *bar = m_table->verticalScrollBar();
int barPos = 0;
if(bar)
barPos = bar->sliderPosition();
m_model->clear();
for(iMidiTrack i = song->artracks()->begin(); i != song->artracks()->end(); ++i)
{
MidiTrack* track = (MidiTrack*)(*i);
PartList* pl = track->parts();
if(m_displayRole == PartRole && pl->empty())
{
continue;
}
QStandardItem* trackName = new QStandardItem();
trackName->setForeground(QBrush(QColor(205,209,205)));
trackName->setBackground(QBrush(QColor(20,20,20)));
trackName->setFont(QFont("fixed-width", 10, QFont::Bold));
trackName->setText(track->name());
trackName->setCheckable(true);
trackName->setCheckState(m_selectedTracks.contains(track->id()) ? Qt::Checked : Qt::Unchecked);
trackName->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
trackName->setData(1, TrackRole);
trackName->setData(track->name(), TrackNameRole);
trackName->setData(track->id(), TrackIdRole);
trackName->setEditable(true);
m_model->appendRow(trackName);
for(iPart ip = pl->begin(); ip != pl->end(); ++ip)
{
Part* part = ip->second;
QStandardItem* partName = new QStandardItem();
partName->setFont(QFont("fixed-width", 9, QFont::Bold));
partName->setText(part->name());
partName->setData(part->sn(), PartRole);
partName->setData(2, TrackRole);
partName->setData(track->name(), TrackNameRole);
partName->setData(part->name(), PartNameRole);
partName->setData(part->tick(), TickRole);
partName->setData(track->id(), TrackIdRole);
partName->setEditable(true);
partName->setCheckable(true);
partName->setCheckState(m_editor->hasPart(part->sn()) ? Qt::Checked : Qt::Unchecked);
if(!partColorIcons.isEmpty() && part->colorIndex() < partColorIcons.size())
partName->setIcon(partColorIcons.at(part->colorIndex()));
m_model->appendRow(partName);
}
}
m_model->setHorizontalHeaderLabels(m_headers);
if(m_selectedIndex < m_model->rowCount())
{
m_table->selectRow(m_selectedIndex);
m_table->scrollTo(m_model->index(m_selectedIndex, 0));
}
if(bar)
bar->setSliderPosition(barPos);
}/*}}}*/
示例6:
bool BCI2000Viewer::ChannelDown_Enabled()
{ QScrollBar* s = ui->verticalScrollBar;
return s->isEnabled() && s->sliderPosition() < s->maximum(); }
示例7: max
void BCI2000Viewer::ChannelPagePrev()
{ QScrollBar* s = ui->verticalScrollBar;
s->setSliderPosition( max( s->minimum(), s->sliderPosition() - s->pageStep() ) ); }
示例8: min
void BCI2000Viewer::ChannelPageNext()
{ QScrollBar* s = ui->verticalScrollBar;
s->setSliderPosition( min( s->maximum(), s->sliderPosition() + s->pageStep() ) ); }