本文整理汇总了C++中slider函数的典型用法代码示例。如果您正苦于以下问题:C++ slider函数的具体用法?C++ slider怎么用?C++ slider使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了slider函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: option_menu_2
void option_menu_2(t_data *data, int selected_index,
t_bunny_position pos,
t_bunny_position size)
{
pos.y = data->rect_opt[2].pos.y + data->rect_opt[1].size.y + 20;
data->rect_opt[3] = label(data, false, size, pos);
pos.y = data->rect_opt[3].pos.y + data->rect_opt[1].size.y + 15;
if (selected_index == 2)
data->rect_opt[4] = slider(data, true, data->config->volume, pos);
else
data->rect_opt[4] = slider(data, false, data->config->volume, pos);
pos.y = data->rect_opt[4].pos.y + data->rect_opt[1].size.y + 20;
data->rect_opt[5] = label(data, false, size, pos);
pos.y = data->rect_opt[5].pos.y + data->rect_opt[1].size.y + 20;
if (selected_index == 3)
data->rect_opt[6] = slider(data, true, data->config->fov, pos);
else
data->rect_opt[6] = slider(data, false, data->config->fov, pos);
pos.y = data->rect_opt[6].pos.y + data->rect_opt[1].size.y + 20 ;
(selected_index == 4) ? (data->rect_opt[7] = label(data, true, size, pos)) :
(data->rect_opt[7] = label(data, false, size, pos));
pos.y = data->rect_opt[7].pos.y + data->rect_opt[1].size.y + 20;
(selected_index == 5) ? (data->rect_opt[8] = label(data, true, size, pos)) :
(data->rect_opt[8] = label(data, false, size, pos));
pos.y = data->rect_opt[8].pos.y + data->rect_opt[1].size.y + 20;
(selected_index == 6) ? (data->rect_opt[9] = label(data, true, size, pos)) :
(data->rect_opt[9] = label(data, false, size, pos));
}
示例2: QString
/*! \reimp */
QString QAccessibleSlider::text(Text t, int child) const
{
if (!slider()->isVisible())
return QString();
switch (t) {
case Value:
if (!child || child == 2)
return QString::number(slider()->value());
return QString();
case Name:
switch (child) {
case PageLeft:
return slider()->orientation() == Qt::Horizontal ?
QSlider::tr("Page left") : QSlider::tr("Page up");
case Position:
return QSlider::tr("Position");
case PageRight:
return slider()->orientation() == Qt::Horizontal ?
QSlider::tr("Page right") : QSlider::tr("Page down");
}
break;
default:
break;
}
return QAccessibleAbstractSlider::text(t, child);
}
示例3: QFontMetrics
void
OCRuler::updateGeometry()
{
QSize rsz = QFontMetrics(slider()->font()).size(SLIDER_TEXT_FLAGS, "09.,");
int gap = 2;
int min_sld = 2;
int sld = 16;
off_y = rsz.height() + gap;
QRect br = boundingRect();
if (br.height() < off_y + min_sld)
br.setHeight(off_y + min_sld);
if (br.width() < rsz.width())
br.setWidth(rsz.width());
if (slider()->orientation() == Vertical) {
if (sld > br.width())
sld = br.width();
off_x = (br.width() - sld) / 2;
slider()->setGeometry(br.x() + off_x, br.y() + off_y,
sld, br.height() - off_y);
} else {
if (sld > br.height() - off_y)
sld = br.height() - off_y;
off_x = 0;
slider()->setGeometry(br.x(), br.y() + off_y, br.width(), sld);
}
updateSize(br);
update();
}
示例4: slider
void
OCRuler::update()
{
if (slider() && slider()->value() != int(vcur))
slider()->setValue(int(vcur));
vslide = vcur;
OCDataWidget::update();
}
示例5: createEmptyDynamicsWorld
void ConstraintPhysicsSetup::initPhysics()
{
m_guiHelper->setUpAxis(1);
createEmptyDynamicsWorld();
m_guiHelper->createPhysicsDebugDrawer(m_dynamicsWorld);
int mode = btIDebugDraw::DBG_DrawWireframe + btIDebugDraw::DBG_DrawConstraints + btIDebugDraw::DBG_DrawConstraintLimits;
m_dynamicsWorld->getDebugDrawer()->setDebugMode(mode);
{
SliderParams slider("target vel", &targetVel);
slider.m_minVal = -4;
slider.m_maxVal = 4;
m_guiHelper->getParameterInterface()->registerSliderFloatParameter(slider);
}
{
SliderParams slider("max impulse", &maxImpulse);
slider.m_minVal = 0;
slider.m_maxVal = 1000;
m_guiHelper->getParameterInterface()->registerSliderFloatParameter(slider);
}
{
SliderParams slider("actual vel", &actualHingeVelocity);
slider.m_minVal = -4;
slider.m_maxVal = 4;
m_guiHelper->getParameterInterface()->registerSliderFloatParameter(slider);
}
val = 1.f;
{
SliderParams slider("angle", &val);
slider.m_minVal = -720;
slider.m_maxVal = 720;
m_guiHelper->getParameterInterface()->registerSliderFloatParameter(slider);
}
{ // create a door using hinge constraint attached to the world
btCollisionShape* pDoorShape = new btBoxShape(btVector3(2.0f, 5.0f, 0.2f));
m_collisionShapes.push_back(pDoorShape);
btTransform doorTrans;
doorTrans.setIdentity();
doorTrans.setOrigin(btVector3(-5.0f, -2.0f, 0.0f));
btRigidBody* pDoorBody = createRigidBody(1.0, doorTrans, pDoorShape);
pDoorBody->setActivationState(DISABLE_DEACTIVATION);
const btVector3 btPivotA(10.f + 2.1f, -2.0f, 0.0f); // right next to the door slightly outside
spDoorHinge = new btHingeAccumulatedAngleConstraint(*pDoorBody, btPivotA, btAxisA);
m_dynamicsWorld->addConstraint(spDoorHinge);
spDoorHinge->setDbgDrawSize(btScalar(5.f));
}
m_guiHelper->autogenerateGraphicsObjects(m_dynamicsWorld);
}
示例6:
void
OCRuler::drawShape(QPainter& p)
{
QString vs;
vs.sprintf("%.1f", vslide);
if (slider()) {
p.setFont(slider()->font());
p.setPen(slider()->paletteForegroundColor());
}
p.drawText(boundingRect(), SLIDER_TEXT_FLAGS, vs);
}
示例7: createUI
void createUI(NVGcontext *vg, float w, float h)
{
int col;
uiClear();
{
int root = uiItem();
// position root element
uiSetLayout(root,UI_LEFT|UI_TOP);
uiSetMargins(root,50,50,0,0);
uiSetSize(root,250,400);
}
col = column(0);
uiSetLayout(col, UI_TOP|UI_HFILL);
button(col, __LINE__, BND_ICONID(6,3), "Item 1", demohandler);
button(col, __LINE__, BND_ICONID(6,3), "Item 2", demohandler);
{
int h = hgroup(col);
radio(h, __LINE__, BND_ICONID(6,3), "Item 3.0", &enum1);
radio(h, __LINE__, BND_ICONID(0,10), NULL, &enum1);
radio(h, __LINE__, BND_ICONID(1,10), NULL, &enum1);
radio(h, __LINE__, BND_ICONID(6,3), "Item 3.3", &enum1);
}
{
int colr;
int rows = row(col);
int coll = vgroup(rows);
label(coll, -1, "Items 4.0:");
coll = vgroup(coll);
button(coll, __LINE__, BND_ICONID(6,3), "Item 4.0.0", demohandler);
button(coll, __LINE__, BND_ICONID(6,3), "Item 4.0.1", demohandler);
colr = vgroup(rows);
uiSetFrozen(colr, option1);
label(colr, -1, "Items 4.1:");
colr = vgroup(colr);
slider(colr, __LINE__, "Item 4.1.0", &progress1);
slider(colr,__LINE__, "Item 4.1.1", &progress2);
}
button(col, __LINE__, BND_ICONID(6,3), "Item 5", NULL);
check(col, __LINE__, "Frozen", &option1);
check(col, __LINE__, "Item 7", &option2);
check(col, __LINE__, "Item 8", &option3);
textbox(col, (UIhandle)textbuffer, textbuffer, 32);
uiLayout();
}
示例8: build_democontent
void build_democontent(int parent) {
// some persistent variables for demonstration
static float progress1 = 0.25f;
static float progress2 = 0.75f;
static int option1 = 1;
static int option2 = 0;
static int option3 = 0;
int col = column();
uiInsert(parent, col);
uiSetMargins(col, 10, 10, 10, 10);
uiSetLayout(col, UI_TOP|UI_HFILL);
column_append(col, button(BND_ICON_GHOST, "Item 1", demohandler));
if (option3)
column_append(col, button(BND_ICON_GHOST, "Item 2", demohandler));
{
int h = column_append(col, hbox());
hgroup_append(h, radio(BND_ICON_GHOST, "Item 3.0", &enum1));
if (option2)
uiSetMargins(hgroup_append_fixed(h, radio(BND_ICON_REC, NULL, &enum1)), -1,0,0,0);
uiSetMargins(hgroup_append_fixed(h, radio(BND_ICON_PLAY, NULL, &enum1)), -1,0,0,0);
uiSetMargins(hgroup_append(h, radio(BND_ICON_GHOST, "Item 3.3", &enum1)), -1,0,0,0);
}
{
int rows = column_append(col, row());
int coll = row_append(rows, vgroup());
vgroup_append(coll, label(-1, "Items 4.0:"));
coll = vgroup_append(coll, vbox());
vgroup_append(coll, button(BND_ICON_GHOST, "Item 4.0.0", demohandler));
uiSetMargins(vgroup_append(coll, button(BND_ICON_GHOST, "Item 4.0.1", demohandler)),0,-2,0,0);
int colr = row_append(rows, vgroup());
uiSetMargins(colr, 8, 0, 0, 0);
uiSetFrozen(colr, option1);
vgroup_append(colr, label(-1, "Items 4.1:"));
colr = vgroup_append(colr, vbox());
vgroup_append(colr, slider("Item 4.1.0", &progress1));
uiSetMargins(vgroup_append(colr, slider("Item 4.1.1", &progress2)),0,-2,0,0);
}
column_append(col, button(BND_ICON_GHOST, "Item 5", NULL));
static char textbuffer[1024] = "The quick brown fox.";
column_append(col, textbox(textbuffer, 1024));
column_append(col, check("Frozen", &option1));
column_append(col, check("Item 7", &option2));
column_append(col, check("Item 8", &option3));
}
示例9: dataDouble
void VariableResistor::dataChanged()
{
double new_minResistance = dataDouble( "minimum resistance" );
double new_maxResistance = dataDouble( "maximum resistance" );
if( new_minResistance != m_minResistance )
{
if( new_minResistance >= m_maxResistance )
{
m_minResistance = m_maxResistance;
property( "minimum resistance" )->setValue( m_minResistance );
} else m_minResistance = new_minResistance;
}
if( new_maxResistance != m_maxResistance )
{
if( new_maxResistance <= m_minResistance )
{
m_maxResistance = m_minResistance;
property( "maximum resistance" )->setValue( m_maxResistance );
} else m_maxResistance = new_maxResistance;
}
m_tickValue = ( m_maxResistance - m_minResistance ) / m_pSlider->maxValue();
// Calculate the resistance jump per tick of a 100 tick slider.
sliderValueChanged( "slider", slider("slider")->value() );
}
示例10: trace
/*airplane constructor reads conf file and intializes menu controls in mediator(mainwindow)*/
airplane::airplane(nmainwindow *m):w(NULL),mediator(m) {
trace("airplane::airplane")
timer=new QTimer(this);
connect(timer,SIGNAL(timeout()),this,SLOT(refreshmap()));
readfile(":/conf.txt");
cmenu=mediator->menuBar()->addMenu(tr("map"));
roadmapaction=new QAction(tr("ROADMAP"),cmenu);
satelliteaction=new QAction(tr("SATELLITE"),cmenu);
hybridaction=new QAction(tr("HYBRID"),cmenu);
terrainaction=new QAction(tr("TERRAIN"),cmenu);
ctrlmenu=mediator->menuBar()->addMenu(tr("ctrl"));
pauseaction=new QAction(tr("pause"),ctrlmenu);
slideraction=new QAction(tr("slider"),ctrlmenu);
snapshotaction=new QAction(tr("snapshot"),ctrlmenu);
aboutaction=new QAction(tr("about"),mediator->menuBar());
connect(roadmapaction,SIGNAL(triggered()),this,SLOT(roadmaptriggered()));
connect(satelliteaction,SIGNAL(triggered()),this,SLOT(satellitetriggered()));
connect(terrainaction,SIGNAL(triggered()),this,SLOT(terraintriggered()));
connect(hybridaction,SIGNAL(triggered()),this,SLOT(hybridtriggered()));
connect(pauseaction,SIGNAL(triggered()),this,SLOT(pausetriggered()));
connect(slideraction,SIGNAL(triggered()),this,SLOT(slider()));
connect(snapshotaction,SIGNAL(triggered()),this,SLOT(snapshottriggered()));
connect(aboutaction,SIGNAL(triggered()),this,SLOT(abouttriggered()));
cmenu->addAction(roadmapaction);
cmenu->addAction(satelliteaction);
cmenu->addAction(hybridaction);
cmenu->addAction(terrainaction);
ctrlmenu->addAction(pauseaction);
ctrlmenu->addAction(slideraction);
ctrlmenu->addSeparator();
ctrlmenu->addAction(snapshotaction);
mediator->menuBar()->addAction(aboutaction);
pzRot=plineindex=lineindex=0;
trace("~airplane::airplane")
}
示例11: dataDouble
void VariableCapacitor::dataChanged() {
double new_minCapacitance = dataDouble("minimum capacitance");
double new_maxCapacitance = dataDouble("maximum capacitance");
if (new_minCapacitance != m_minCapacitance) {
if (new_minCapacitance >= m_maxCapacitance) {
m_minCapacitance = m_maxCapacitance;
property("minimum capacitance")->setValue(m_minCapacitance);
} else m_minCapacitance = new_minCapacitance;
}
if (new_maxCapacitance != m_maxCapacitance) {
if (new_maxCapacitance <= m_minCapacitance) {
m_maxCapacitance = m_minCapacitance;
property("maximum capacitance")->setValue(m_maxCapacitance);
} else m_maxCapacitance = new_maxCapacitance;
}
/* Attempt at fixme.
m_currCapacitance = property( "currcapacitance" )->value().asDouble();
if(m_currCapacitance > m_maxCapacitance) m_currCapacitance = m_maxCapacitance;
else if(m_currCapacitance < m_minCapacitance) m_currCapacitance = m_minCapacitance;
*/
m_tickValue = (m_maxCapacitance - m_minCapacitance) / m_pSlider->maxValue();
property("currcapacitance")->setValue(m_currCapacitance);
// Calculate the capacitance jump per tick of a 100 tick slider.
sliderValueChanged("slider", slider("slider")->value());
}
示例12: updateConnectorPoints
void CNItem::restoreFromItemData( const ItemData &itemData )
{
Item::restoreFromItemData(itemData);
updateConnectorPoints(false);
{
const BoolMap::const_iterator end = itemData.buttonMap.end();
for ( BoolMap::const_iterator it = itemData.buttonMap.begin(); it != end; ++it )
{
Button *b = button(it.key());
if (b)
b->setState(it.data());
}
}
{
const IntMap::const_iterator end = itemData.sliderMap.end();
for ( IntMap::const_iterator it = itemData.sliderMap.begin(); it != end; ++it )
{
Slider *s = slider(it.key());
if (s)
s->setValue(it.data());
}
}
}
示例13: main
int main(int argc, char ** argv) {
window = new Fl_Single_Window(COLS*W,ROWS*H+90);
bt("@->");
bt("@>");
bt("@>>");
bt("@>|");
bt("@>[]");
bt("@|>");
bt("@<-");
bt("@<");
bt("@<<");
bt("@|<");
bt("@[]<");
bt("@<|");
bt("@<->");
bt("@-->");
bt("@+");
bt("@->|");
bt("@||");
bt("@arrow");
bt("@returnarrow");
bt("@square");
bt("@circle");
bt("@line");
bt("@menu");
bt("@UpArrow");
bt("@DnArrow");
Fl_Value_Slider slider(80,
window->h()-60,
window->w()-90,
16,
"Orientation");
slider.align(FL_ALIGN_LEFT);
slider.type(Fl_Slider::HORIZONTAL);
slider.range(0.0, 9.0);
slider.value(0.0);
slider.step(1);
slider.callback(slider_cb, &slider);
Fl_Value_Slider slider2(80,
window->h()-30,
window->w()-90,
16,
"Scale");
slider2.align(FL_ALIGN_LEFT);
slider2.type(Fl_Slider::HORIZONTAL);
slider2.range(-9.0, 9.0);
slider2.value(0.0);
slider2.step(1);
slider2.callback(slider_cb, &slider);
rot = &slider;
scale = &slider2;
window->resizable(window);
window->show(argc,argv);
return Fl::run();
}
示例14: createButton
void PhysicsClientExample::createButtons()
{
bool isTrigger = false;
if (m_guiHelper && m_guiHelper->getParameterInterface())
{
m_guiHelper->getParameterInterface()->removeAllParameters();
createButton("Load URDF",CMD_LOAD_URDF, isTrigger);
createButton("Step Sim",CMD_STEP_FORWARD_SIMULATION, isTrigger);
createButton("Send Bullet Stream",CMD_SEND_BULLET_DATA_STREAM, isTrigger);
createButton("Get State",CMD_REQUEST_ACTUAL_STATE, isTrigger);
createButton("Send Desired State",CMD_SEND_DESIRED_STATE, isTrigger);
createButton("Create Box Collider",CMD_CREATE_BOX_COLLISION_SHAPE,isTrigger);
createButton("Create Cylinder Body",CMD_CREATE_RIGID_BODY,isTrigger);
createButton("Reset Simulation",CMD_RESET_SIMULATION,isTrigger);
createButton("Initialize Pose",CMD_INIT_POSE, isTrigger);
createButton("Set gravity", CMD_SEND_PHYSICS_SIMULATION_PARAMETERS, isTrigger);
if (m_physicsClientHandle && m_selectedBody>=0)
{
int numJoints = b3GetNumJoints(m_physicsClientHandle,m_selectedBody);
for (int i=0;i<numJoints;i++)
{
b3JointInfo info;
b3GetJointInfo(m_physicsClientHandle,m_selectedBody,i,&info);
b3Printf("Joint %s at q-index %d and u-index %d\n",info.m_jointName,info.m_qIndex,info.m_uIndex);
if (info.m_flags & JOINT_HAS_MOTORIZED_POWER)
{
if (m_numMotors<MAX_NUM_MOTORS)
{
char motorName[1024];
sprintf(motorName,"%s q", info.m_jointName);
// MyMotorInfo2* motorInfo = &m_motorTargetVelocities[m_numMotors];
MyMotorInfo2* motorInfo = &m_motorTargetPositions[m_numMotors];
motorInfo->m_velTarget = 0.f;
motorInfo->m_posTarget = 0.f;
motorInfo->m_uIndex = info.m_uIndex;
motorInfo->m_qIndex = info.m_qIndex;
// SliderParams slider(motorName,&motorInfo->m_velTarget);
// slider.m_minVal=-4;
// slider.m_maxVal=4;
SliderParams slider(motorName,&motorInfo->m_posTarget);
slider.m_minVal=-4;
slider.m_maxVal=4;
if (m_guiHelper && m_guiHelper->getParameterInterface())
{
m_guiHelper->getParameterInterface()->registerSliderFloatParameter(slider);
}
m_numMotors++;
}
}
}
}
}
}
示例15: generateFrame
int generateFrame(char *frameName,
unsigned int frameNumber,
double gX,
double gY,
double gZ,
unsigned int speed,
double throttlePercentage,
double brakePercentage)
{
cairo_surface_t *surface;
cairo_t *cr;
char frameText[80];
surface = cairo_image_surface_create (
CAIRO_FORMAT_ARGB32, SIZEX, SIZEY);
cr = cairo_create (surface);
cairo_save (cr);
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
// set alpha to produce transparency
cairo_set_source_rgba (cr, 1, 1, 1, 0);
// cairo_set_source_rgba (cr, 0, 0, 0.2, 1);
cairo_paint (cr);
cairo_restore (cr);
cairo_move_to (cr, 17.5, 20);
cairo_set_source_rgb (cr, 1, 1, 1);
cairo_set_font_size(cr,20);
sprintf(frameText,"%05u",frameNumber);
cairo_show_text (cr, frameText);
// G bubble
renderGdot(cr,50,70,gX,gY,gZ);
// throttle
slider(cr,50,130,2,80,20,0.0,1.0,0.0,throttlePercentage);
// brake
slider(cr,50,160,2,80,20,1.0,0.0,0.0,brakePercentage);
// save and clean up
cairo_destroy (cr);
cairo_surface_write_to_png (surface, frameName);
cairo_surface_destroy (surface);
return 0;
}