本文整理汇总了C++中QAbstractSlider::sliderPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ QAbstractSlider::sliderPosition方法的具体用法?C++ QAbstractSlider::sliderPosition怎么用?C++ QAbstractSlider::sliderPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QAbstractSlider
的用法示例。
在下文中一共展示了QAbstractSlider::sliderPosition方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: scrollSliderReleased
//---------------------------------------------------------------------------
void MainWindow::scrollSliderReleased()
{
QAbstractSlider *slider = (QAbstractSlider *) QObject::sender();
int ScrollPos = slider->sliderPosition();
bool reset_slider;
calc_scroll(QAbstractSlider::SliderMove + 100, ScrollPos, reset_slider);
slider->setSliderPosition(ScrollPos);
}
示例2: scrollAction
//---------------------------------------------------------------------------
void MainWindow::scrollAction(int action)
{
if ( action == QAbstractSlider::SliderNoAction )
return;
QAbstractSlider *slider = (QAbstractSlider *) QObject::sender();
int ScrollPos = slider->sliderPosition();
bool reset_slider;
int code = calc_scroll(action, ScrollPos, reset_slider);
if ( code != 0 )
{
if ( reset_slider )
slider->setSliderPosition(ScrollPos);
if ( slider == (QAbstractSlider *) canvas->verticalScrollBar() )
move_focus(0, code);
else
move_focus(code, 0);
canvas->viewport()->update();
}
}
示例3: eventFilter
//.........这里部分代码省略.........
}
ox = mevent->x();
oy = mevent->y();
}
else if(mevent->button() == Qt::RightButton ) //Added by AiO
{
//query the cordinates of the mouse for node
char curNodeTitle[1024];
char * curNode;
char *index; //used for search
QMessageBox msgBox;
curNode = node_xy_title(mevent->x(),mevent->y());
if(curNode == 0) return true;
strncpy(curNodeTitle, curNode, 1024-1);
curNodeTitle[1024-1] = 0;
//label ends with ':'
//test for color characters format sym num num TEXT sym :
// replace : -1 with 0 and use &curNodeTitle[3]
//test with popup
if(curNodeTitle[0] == 0x0c)
{
index = strchr(curNodeTitle, ':');
if(index == 0) goto nocolon; //test for no label but color
--index;
--index;
--index;
*index = 0;
msgBox.setText(&curNodeTitle[3]);
clipboard->setText(&curNodeTitle[3]);
}
else
{
nocolon:
msgBox.setText(curNodeTitle);
clipboard->setText(curNodeTitle);
}
msgBox.exec();
}
}
else if ( event->type() == QEvent::MouseButtonRelease )
{
if ( !sticky )
qApp->restoreOverrideCursor();
}
// wheel
else if ( event->type() == QEvent::Wheel )
{
QWheelEvent *wevent = (QWheelEvent *) event;
if ( (qApp->keyboardModifiers() & Qt::ControlModifier) != 0 )
{
wevent->accept();
int numDegrees = wevent->delta() / 8;
int numSteps = numDegrees / 15;
if ( numSteps < 0)
{
numSteps = -numSteps;
for ( int x = 0; x < numSteps; x++ )
zoomOut();
}
else
{
for ( int x = 0; x < numSteps; x++ )
zoomIn();
}
return true;
}
else
{
bool ret = QMainWindow::eventFilter(obj, event);
QAbstractSlider *slider = (QAbstractSlider *) (wevent->orientation() == Qt::Vertical?
canvas->verticalScrollBar() :
canvas->horizontalScrollBar());
int ScrollPos = slider->sliderPosition();
bool reset_slider;
calc_scroll(QAbstractSlider::SliderMove + 100, ScrollPos, reset_slider);
slider->setSliderPosition(ScrollPos);
return ret;
}
}
// keyboard
else if ( event->type() == QEvent::KeyPress )
{
QKeyEvent *kevent = (QKeyEvent *) event;
int key = kevent->key();
KeyDown(key, kevent->modifiers());
if ( key == 0 )
{
event->accept();
return true;
}
}
}
return QMainWindow::eventFilter(obj, event);
}