示例#1
0
int QSqlQuery_boundValue(lua_State* const state)
{
    auto self = lua::get<QSqlQuery*>(state, 1);
    if (lua_type(state, 2) == LUA_TNUMBER) {
        // QVariant boundValue(int pos) const
        lua::push(state, self->boundValue(lua::get<int>(state, 2)));
    } else {
        // QVariant boundValue(const QString & placeholder) const
        lua::push(state, self->boundValue(lua::get<QString>(state, 2)));
    }
    return 1;
}
示例#2
0
/**
 * Qt needs to be patched in order to contain virtual method:
 * virtual void QAbstractSlider::setValue(int), otherwise
 * all our magic is powerless.
 */
void SmoothScrollBar::setValue(int val)
{
	// immediately set value in case the scrollbar is already
	// at maximum and we are reducing the maximum value,
	// as in case of widget resize
	int bound = boundValue(val);
	if (bound != val || isSliderDown() || !enableSmoothScrolling_) {
		timeLine_->stop();
		QScrollBar::setValue(bound);
		return;
	}

	if (value() == bound)
		return;

	timeLine_->setFrameRange(value(), val);
	if (timeLine_->state() != QTimeLine::Running)
		timeLine_->start();
}