static PyObject *meth_QScrollerProperties_setScrollMetric(PyObject *sipSelf, PyObject *sipArgs)
{
    PyObject *sipParseErr = NULL;

    {
        QScrollerProperties::ScrollMetric a0;
        const QVariant* a1;
        int a1State = 0;
        QScrollerProperties *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "BEJ1", &sipSelf, sipType_QScrollerProperties, &sipCpp, sipType_QScrollerProperties_ScrollMetric, &a0, sipType_QVariant, &a1, &a1State))
        {
            sipCpp->setScrollMetric(a0,*a1);
            sipReleaseType(const_cast<QVariant *>(a1),sipType_QVariant,a1State);

            Py_INCREF(Py_None);
            return Py_None;
        }
    }

    /* Raise an exception if the arguments couldn't be parsed. */
    sipNoMethod(sipParseErr, sipName_QScrollerProperties, sipName_setScrollMetric, doc_QScrollerProperties_setScrollMetric);

    return NULL;
}
Esempio n. 2
0
MessageListView::MessageListView(QWidget *parent) :
    QTableView(parent)
{
    this->horizontalHeader()->hide();
    this->verticalHeader()->hide();
    this->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
    this->verticalHeader()->setDefaultSectionSize(60);
    this->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    this->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    this->setShowGrid(false);
    this->setSelectionMode(QAbstractItemView::NoSelection);
    /*
     * 添加滑屏操作
    */
    this->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);

    QScroller *scroller = QScroller::scroller(this->viewport());

    QScrollerProperties prop = scroller->scrollerProperties();

    prop.setScrollMetric(QScrollerProperties::AxisLockThreshold, 0.66);
    prop.setScrollMetric(QScrollerProperties::ScrollingCurve, QEasingCurve(QEasingCurve::OutExpo));
    prop.setScrollMetric(QScrollerProperties::DecelerationFactor, 0.05);
    prop.setScrollMetric(QScrollerProperties::MaximumVelocity, 0);
    prop.setScrollMetric(QScrollerProperties::OvershootDragResistanceFactor, 0.33);
    prop.setScrollMetric(QScrollerProperties::OvershootScrollDistanceFactor, 0.33);
    prop.setScrollMetric(QScrollerProperties::SnapPositionRatio, 0.93);
    prop.setScrollMetric(QScrollerProperties::DragStartDistance, 0.001);
    prop.setScrollMetric(QScrollerProperties::SnapPositionRatio,0.5);

    scroller->setScrollerProperties(prop);

    scroller->grabGesture(this, QScroller::TouchGesture);
    scroller->grabGesture(this, QScroller::LeftMouseButtonGesture);
}
Esempio n. 3
0
/**
 * @brief Class constructor
 * @param parent
 */
HelpDialog::HelpDialog(QWidget* parent) : QDialog(parent), ui(new Ui::HelpDialog){
    ui->setupUi(this);

    //enables figer scrolling for android
    #ifdef ANDROID
        QScroller::grabGesture(ui->scrollArea, QScroller::LeftMouseButtonGesture);
        QScrollerProperties sp;
        sp.setScrollMetric(QScrollerProperties::DragStartDistance, 0.001);
        sp.setScrollMetric(QScrollerProperties::FrameRate, QScrollerProperties::Fps60);
        sp.setScrollMetric(QScrollerProperties::MousePressEventDelay, 0.1);
        sp.setScrollMetric(QScrollerProperties::VerticalOvershootPolicy, QScrollerProperties::OvershootAlwaysOff);
        sp.setScrollMetric(QScrollerProperties::HorizontalOvershootPolicy, QScrollerProperties::OvershootAlwaysOff);
        sp.setScrollMetric(QScrollerProperties::OvershootDragDistanceFactor, 0.1);
        sp.setScrollMetric(QScrollerProperties::OvershootScrollDistanceFactor, 0.1);
        QScroller* qs = QScroller::scroller(ui->scrollArea);
        qs->setScrollerProperties(sp);
    #endif

    //loads help text from resources
    #ifdef ANDROID
        QFile file(":/strings/help_android");
        file.open(QIODevice::ReadOnly);
        ui->mainLabel->setText(file.readAll());
        file.close();
    #else
        QFile file(":/strings/help_pc");
        file.open(QIODevice::ReadOnly);
        ui->mainLabel->setText(file.readAll());
        file.close();
    #endif
}
NotifyView::NotifyView(QWidget *parent) : QListView(parent)
{
    setFrameStyle(QFrame::NoFrame);
    setMouseTracking(true);
    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setVerticalScrollMode(QListView::ScrollPerPixel);
    setSpacing(0);
    setContentsMargins(0, 0, 0, 0);
    setUpdatesEnabled(true);
    setStyleSheet("background-color: rgba(255, 255, 255, 7.65);");

    connect(this, &NotifyView::currentHoverChanged, this, &NotifyView::onCurrentHoverChanged);
    connect(this, &NotifyView::entered, this, &NotifyView::onItemEntered);

    QScroller::grabGesture(this, QScroller::LeftMouseButtonGesture);
    QScroller *scroller = QScroller::scroller(this);
    QScrollerProperties sp;
    sp.setScrollMetric(QScrollerProperties::VerticalOvershootPolicy, QScrollerProperties::OvershootAlwaysOff);
    scroller->setScrollerProperties(sp);
}
Esempio n. 5
0
void StreamsWidget::setupKineticScroller(QObject *target)
{
    QScrollerProperties sp;

    sp.setScrollMetric(QScrollerProperties::DragVelocitySmoothingFactor, 0.6);
    sp.setScrollMetric(QScrollerProperties::MinimumVelocity, 0.0);
    sp.setScrollMetric(QScrollerProperties::MaximumVelocity, 0.5);
    sp.setScrollMetric(QScrollerProperties::AcceleratingFlickMaximumTime, 0.4);
    sp.setScrollMetric(QScrollerProperties::AcceleratingFlickSpeedupFactor, 1.2);
    sp.setScrollMetric(QScrollerProperties::SnapPositionRatio, 0.2);
    sp.setScrollMetric(QScrollerProperties::MaximumClickThroughVelocity, 0);
    sp.setScrollMetric(QScrollerProperties::DragStartDistance, 0.001);
    sp.setScrollMetric(QScrollerProperties::MousePressEventDelay, 0.5);
    QScroller* scroller = QScroller::scroller(target);

    scroller->grabGesture(target, QScroller::LeftMouseButtonGesture);

    scroller->setScrollerProperties(sp);
}
QtViewportInteractionEngine::QtViewportInteractionEngine(const QQuickWebView* viewport, QQuickWebPage* content)
    : m_viewport(viewport)
    , m_content(content)
    , m_suspendCount(0)
    , m_scaleAnimation(new ScaleAnimation(this))
    , m_pinchStartScale(-1)
{
    reset();

    QScrollerProperties properties = scroller()->scrollerProperties();

    // The QtPanGestureRecognizer is responsible for recognizing the gesture
    // thus we need to disable the drag start distance.
    properties.setScrollMetric(QScrollerProperties::DragStartDistance, 0.0);

    // Set some default QScroller constrains to mimic the physics engine of the N9 browser.
    properties.setScrollMetric(QScrollerProperties::AxisLockThreshold, 0.66);
    properties.setScrollMetric(QScrollerProperties::ScrollingCurve, QEasingCurve(QEasingCurve::OutExpo));
    properties.setScrollMetric(QScrollerProperties::DecelerationFactor, 0.05);
    properties.setScrollMetric(QScrollerProperties::MaximumVelocity, 0.635);
    properties.setScrollMetric(QScrollerProperties::OvershootDragResistanceFactor, 0.33);
    properties.setScrollMetric(QScrollerProperties::OvershootScrollDistanceFactor, 0.33);

    scroller()->setScrollerProperties(properties);

    connect(m_content, SIGNAL(widthChanged()), this, SLOT(itemSizeChanged()), Qt::DirectConnection);
    connect(m_content, SIGNAL(heightChanged()), this, SLOT(itemSizeChanged()), Qt::DirectConnection);

    connect(m_scaleAnimation, SIGNAL(valueChanged(QVariant)),
            SLOT(scaleAnimationValueChanged(QVariant)), Qt::DirectConnection);
    connect(m_scaleAnimation, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)),
            SLOT(scaleAnimationStateChanged(QAbstractAnimation::State, QAbstractAnimation::State)), Qt::DirectConnection);

    connect(scroller(), SIGNAL(stateChanged(QScroller::State)),
            SLOT(scrollStateChanged(QScroller::State)), Qt::DirectConnection);
}
Esempio n. 7
0
CConfCore::CConfCore( const char *sDev, const char *sName, const char *sAon, int nMixPlata, int nMaxActivePorts, int nPartys,  QWidget *parent ) : QGroupBox(parent)
{
    m_pOwner = qobject_cast<CConfSMPClient*>(parent);
    if(!m_pOwner)
        QCoreApplication::exit(EXIT_FAILURE);

    QTextCodec *codec = QTextCodec::codecForName("Windows-1251");
    QString name = codec->toUnicode(sName);
    if(name.isEmpty())
        name = QString::number(m_pOwner->pOwner()->m_nVirtLink);

    QString title;
    title = name;
    title += '@';

    QString connected = m_pOwner->pOwner()->m_sHost;
    if(m_pOwner->pOwner()->m_nPort != 10011)
    {
        connected += ':';
        connected += QString::number(m_pOwner->pOwner()->m_nPort);
    }
    title += connected;
    title += " (";
    title += sDev;
    title += ')';

    setAlignment(Qt::AlignHCenter);
    setTitle(title);

    QString tooltip;
    tooltip += tr("Название");
    tooltip += ": ";
    tooltip += name;
    tooltip += '\n';

    tooltip += tr("Номер");
    tooltip += ": ";
    tooltip += sAon;
    tooltip += '\n';

    tooltip += tr("Подключен");
    tooltip += ": ";
    tooltip += connected;
    tooltip += '\n';

    tooltip += tr("Слот");
    tooltip += ": ";
    tooltip += QString::number(m_pOwner->pOwner()->m_nVirtLink - 768);
    tooltip += '\n';

    tooltip += tr("Плата");
    tooltip += ": ";
    tooltip += QString::number(nMixPlata);
    tooltip += '\n';

    tooltip += tr("Максимум активных");
    tooltip += ": ";
    tooltip += QString::number(nMaxActivePorts);

    setToolTip(tooltip);

    m_nMaxActivePorts = nMaxActivePorts;
#ifdef ANDROID
    FlowLayout* pLayout = new FlowLayout(6, 10, 7);
#else
    FlowLayout* pLayout = new FlowLayout(8, 8, 6);
#endif
    for(int i = 0; i < nPartys; i++)
    {
        CConfParty* party = new CConfParty(this);
        m_pPartys.push_back(party);
        pLayout->addWidget(party);
    }

    QVBoxLayout* pTopLayout = new QVBoxLayout;

    QScrollArea* scrl = new QScrollArea();
#ifdef ANDROID
    QScroller::grabGesture(scrl, QScroller::LeftMouseButtonGesture);
    QScroller* s = QScroller::scroller(scrl);
    QScrollerProperties p = s->scrollerProperties();
    p.setScrollMetric(QScrollerProperties::HorizontalOvershootPolicy, QScrollerProperties::OvershootAlwaysOff);
    p.setScrollMetric(QScrollerProperties::VerticalOvershootPolicy, QScrollerProperties::OvershootAlwaysOff);
    p.setScrollMetric(QScrollerProperties::OvershootDragDistanceFactor, 0);
    p.setScrollMetric(QScrollerProperties::OvershootScrollDistanceFactor, 0);

    //p.setScrollMetric(QScrollerProperties::OvershootDragResistanceFactor,  0.9);
    //p.setScrollMetric(QScrollerProperties::DragStartDistance,   0.001 );
    //p.setScrollMetric(QScrollerProperties::ScrollingCurve, QEasingCurve::Linear );
    //p.setScrollMetric(QScrollerProperties::AxisLockThreshold, 0.9);

    //Does this help?
    //p.setScrollMetric(QScrollerProperties::SnapTime, 1);
    //p.setScrollMetric(QScrollerProperties::SnapPositionRatio, 1);

    //p.setScrollMetric(QScrollerProperties::AcceleratingFlickSpeedupFactor, 2.5);
    //p.setScrollMetric(QScrollerProperties::AcceleratingFlickMaximumTime, 1.25);
    s->setScrollerProperties(p);
#endif
    QWidget* wgt = new QWidget();
    scrl->setWidget(wgt);
    scrl->setWidgetResizable(true);
    wgt->setLayout(pLayout);
    pTopLayout->addWidget(scrl);

    m_pBtnGather = new QPushButton(tr("Собрать всех"));
    m_pBtnGather->setIcon(m_pOwner->pOwner()->pix_gather);
    connect(m_pBtnGather, SIGNAL(clicked()), SLOT(slotGatherClicked()));
    m_pBtnGather->setToolTip(tr("Вызвать всех участников конференции"));

    m_pBtnDestroy = new QPushButton(tr("Отбить всех"));
    m_pBtnDestroy->setIcon(m_pOwner->pOwner()->pix_call_down);
    connect(m_pBtnDestroy, SIGNAL(clicked()), SLOT(slotDestroyClicked()));
    m_pBtnDestroy->setToolTip(tr("Отбить всех участников конференции"));

    m_pBtnReconnect = new QPushButton(tr("Обновить соединение"));
    m_pBtnReconnect->setIcon(m_pOwner->pOwner()->pix_connection);
    connect(m_pBtnReconnect, SIGNAL(clicked()), SLOT(slotReconnectClicked()));
    m_pBtnReconnect->setToolTip(tr("Обновить соединение с АТС"));

    QHBoxLayout* pLayoutH = new QHBoxLayout;
    pLayoutH->addWidget(m_pBtnGather);
    pLayoutH->addWidget(m_pBtnDestroy);
    pLayoutH->addWidget(m_pBtnReconnect);
    pTopLayout->addLayout(pLayoutH);
    pTopLayout->setMargin(4);
    setLayout(pTopLayout);
}