本文整理汇总了C++中QAbstractScrollArea::setHorizontalScrollBarPolicy方法的典型用法代码示例。如果您正苦于以下问题:C++ QAbstractScrollArea::setHorizontalScrollBarPolicy方法的具体用法?C++ QAbstractScrollArea::setHorizontalScrollBarPolicy怎么用?C++ QAbstractScrollArea::setHorizontalScrollBarPolicy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QAbstractScrollArea
的用法示例。
在下文中一共展示了QAbstractScrollArea::setHorizontalScrollBarPolicy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QObject
MouseMachine::MouseMachine(QWidget* parent, MouseMachine::Options options)
: QObject(parent)
, theParent(parent)
, m_options(options)
, machine(0)
, trPressed2Idle(0)
, trPressed2Man(0)
, trManScrolling(0)
, trIdle2Pressed(0)
, trMan2Auto(0)
, trMan2Idle(0)
, trAuto2Idle(0)
, trAuto2Man(0)
, trDoubleclick(0)
{
#ifdef Q_OS_SYMBIAN
iTouchFeedback = MTouchFeedback::Instance();
#endif
speedTimer.setInterval(SPEED_INTERVAL);
connect(&speedTimer, SIGNAL(timeout()), SLOT(slotCalculateSpeed()));
dblclickTimer.setInterval(DBLCLICK_INTERVAL);
dblclickTimer.setSingleShot(true);
connect(&dblclickTimer, SIGNAL(timeout()), SLOT(slotSingleTap()));
scrollTimeline.setCurveShape(QTimeLine::EaseOutCurve);
scrollTimeline.setEasingCurve(QEasingCurve::OutQuad);
connect(&scrollTimeline, SIGNAL(valueChanged(qreal)), SLOT(slotAutoscroll(qreal)));
connect(&scrollTimeline, SIGNAL(finished()), SLOT(slotAutoscrollFinished()));
tapHoldTimer.setInterval(TAPHOLD_TIMEOUT);
tapHoldTimer.setSingleShot(true);
theTarget = theParent;
QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea*>(theParent);
if (scrollArea) {
scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
theTarget = scrollArea->viewport();
theTarget->installEventFilter(this);
}
theParent->installEventFilter(this);
buildMachine();
machine->start();
}
示例2: activateOn
void FlickCharm::activateOn(QWidget *widget)
{
QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea*>(widget);
if (scrollArea) {
scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
QWidget *viewport = scrollArea->viewport();
viewport->installEventFilter(this);
scrollArea->installEventFilter(this);
d->flickData.remove(viewport);
d->flickData[viewport] = new FlickData;
d->flickData[viewport]->widget = widget;
d->flickData[viewport]->state = FlickData::Steady;
return;
}
QWebView *webView = qobject_cast<QWebView*>(widget);
if (webView) {
QWebFrame *frame = webView->page()->mainFrame();
frame->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff);
frame->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff);
webView->installEventFilter(this);
d->flickData.remove(webView);
d->flickData[webView] = new FlickData;
d->flickData[webView]->widget = webView;
d->flickData[webView]->state = FlickData::Steady;
return;
}
qWarning() << "FlickCharm only works on QAbstractScrollArea (and derived classes)";
qWarning() << "or QWebView (and derived classes)";
}