当前位置: 首页>>代码示例>>C++>>正文


C++ QAbstractSlider类代码示例

本文整理汇总了C++中QAbstractSlider的典型用法代码示例。如果您正苦于以下问题:C++ QAbstractSlider类的具体用法?C++ QAbstractSlider怎么用?C++ QAbstractSlider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了QAbstractSlider类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: connect

void vrpn_Qt::AddWidget(QWidget* widget) {
    // Ignore widgets called vrpn_Qt_ignore
    if (widget->objectName() == "vrpn_Qt_ignore") {
        return;
    }


    // Check if widget is derived from abstract button
    if (qobject_cast<QAbstractButton*>(widget)) {
        QAbstractButton* button = qobject_cast<QAbstractButton*>(widget);

        connect(button, SIGNAL(pressed()), this, SLOT(ButtonChanged()));
        connect(button, SIGNAL(released()), this, SLOT(ButtonChanged()));

        buttonWidgets.append(button);
        buttons[num_buttons] = button->isChecked();
        num_buttons++;
    }
    // Check if widget is derived from abstract slider
    else if (qobject_cast<QAbstractSlider*>(widget)) {
        QAbstractSlider* slider = qobject_cast<QAbstractSlider*>(widget);

        connect(slider, SIGNAL(valueChanged(int)), this, SLOT(AnalogChanged()));

        analogWidgets.append(slider);
        channel[num_channel] = slider->value();
        num_channel++;
    }
    // Check for double spin box
    else if (qobject_cast<QDoubleSpinBox*>(widget)) {
开发者ID:ASPePeX,项目名称:vrpn,代码行数:30,代码来源:vrpn_Qt.C

示例2: calc_scroll

//---------------------------------------------------------------------------
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);
}
开发者ID:darkaio,项目名称:AiOqwingraph,代码行数:9,代码来源:mainwindow.cpp

示例3: DEBUG_LOG

void StatsWatcher::registerSliderAction(int action)
{
    QAbstractSlider *slider = qobject_cast<QAbstractSlider*>(sender());
    if (!slider)
    {
        DEBUG_LOG("Aquest slot només s'hauria de connectar amb sliders. Retornem de la funció");
        return;
    }
    QString statMessage;
    switch (action)
    {
        case QAbstractSlider::SliderNoAction:
            statMessage = "No Action";
            break;

        case QAbstractSlider::SliderSingleStepAdd:
            statMessage = "+1 Pas";
            break;

        case QAbstractSlider::SliderSingleStepSub:
            statMessage = "-1 Pas";
            break;

        case QAbstractSlider::SliderPageStepAdd:
            statMessage = "+1 Page";
            break;

        case QAbstractSlider::SliderPageStepSub:
            statMessage = "-1 Page";
            break;

        case QAbstractSlider::SliderToMinimum:
            statMessage = "A mínim";
            break;

        case QAbstractSlider::SliderToMaximum:
            statMessage = "A màxim";
            break;

        case QAbstractSlider::SliderMove:
            // Només registrem quan s'ha fet un move amb rodeta
            if (!slider->isSliderDown())
            {
                statMessage = "Desplaçar amb rodeta";
            }
            break;

            // Cas especial. petit hack per connectar amb sliderReleased
        case 10:
            statMessage = "Desplaçar clickant";
            break;
    }

    if (!statMessage.isEmpty())
    {
        log(QString("[%1] S'ha fet l'acció [%2] sobre l'slider [%3]").arg(m_context).arg(statMessage).arg(sender()->objectName()));
    }
}
开发者ID:chinhtrandn,项目名称:starviewer,代码行数:58,代码来源:statswatcher.cpp

示例4: file

    void SoundSettings::InitWindow()
    {
        boost::shared_ptr<UiServices::UiModule> ui_module = framework_->GetModuleManager()->GetModule<UiServices::UiModule>(Foundation::Module::MT_UiServices).lock();

        // If this occurs, we're most probably operating in headless mode.
        if (ui_module.get() == 0)
            return;

        QUiLoader loader;
        QFile file("./data/ui/soundsettings.ui");

        if (!file.exists())
        {
            OpenALAudioModule::LogError("Cannot find sound settings .ui file.");
            return;
        }

        settings_widget_ = loader.load(&file); 
        if (!settings_widget_)
            return;

        ui_module->GetInworldSceneController()->AddSettingsWidget(settings_widget_, "Sound");

        boost::shared_ptr<Foundation::SoundServiceInterface> soundsystem = framework_->GetServiceManager()->GetService<Foundation::SoundServiceInterface>(Foundation::Service::ST_Sound).lock();
        if (!soundsystem.get())
            return;     
        QAbstractSlider* slider = settings_widget_->findChild<QAbstractSlider*>("slider_master");
        if (slider)
        {
            slider->setValue(soundsystem->GetMasterGain() * 100);
            QObject::connect(slider, SIGNAL(valueChanged(int)), this, SLOT(MasterGainChanged(int)));
        }
        slider = settings_widget_->findChild<QAbstractSlider*>("slider_triggered");
        if (slider)
        {
            slider->setValue(soundsystem->GetSoundMasterGain(Foundation::SoundServiceInterface::Triggered) * 100);
            QObject::connect(slider, SIGNAL(valueChanged(int)), this, SLOT(TriggeredGainChanged(int)));
        }
        slider = settings_widget_->findChild<QAbstractSlider*>("slider_ambient");
        if (slider)
        {
            slider->setValue(soundsystem->GetSoundMasterGain(Foundation::SoundServiceInterface::Ambient) * 100);
            QObject::connect(slider, SIGNAL(valueChanged(int)), this, SLOT(AmbientGainChanged(int)));
        }
        slider = settings_widget_->findChild<QAbstractSlider*>("slider_voice");
        if (slider)
        {
            slider->setValue(soundsystem->GetSoundMasterGain(Foundation::SoundServiceInterface::Voice) * 100);
            QObject::connect(slider, SIGNAL(valueChanged(int)), this, SLOT(VoiceGainChanged(int)));
        }
    }
开发者ID:caocao,项目名称:naali,代码行数:51,代码来源:SoundSettings.cpp

示例5: triggerAction

int AbstractSlider::triggerAction(lua_State * L) // ( SliderAction action )
{
	QAbstractSlider* obj = ObjectHelper<QAbstractSlider>::check( L, 1);
	QAbstractSlider::SliderAction f;
	int fInt = Util::toInt( L, 2 );
	if( (fInt >= 0 && fInt <= 7) )
	{
		f = (QAbstractSlider::SliderAction) fInt;
		obj->triggerAction( f );
	}
	else
		Lua::Util::error( L, "expecting a valid QAbstractSlider::SliderAction" );
	return 0;
}
开发者ID:Wushaowei001,项目名称:NAF,代码行数:14,代码来源:QtlAbstractSlider.cpp

示例6: eventFilter

bool ScrollPanner::eventFilter(QObject *obj, QEvent *event)
{
    bool b = QObject::eventFilter(obj, event);

    if (event->type() == QEvent::Resize)
    {
        QAbstractSlider *sl = dynamic_cast<QAbstractSlider*>(obj);
        if (sl)
        {
            if (sl == m_sliderX)
            {
                setHorizontalViewSize(sl->pageStep());
            } else
            if (sl == m_sliderY)
            {
                setVerticalViewSize(sl->pageStep());
            }
        }
    }

    return b;
}
开发者ID:KDE,项目名称:knipptasch,代码行数:22,代码来源:scrollpanner.cpp

示例7: set_drawing_rectangle


//.........这里部分代码省略.........
        }
        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);
}
开发者ID:darkaio,项目名称:AiOqwingraph,代码行数:101,代码来源:mainwindow.cpp

示例8: switch

bool QgsAttributeEditor::setValue( QWidget *editor, QgsVectorLayer *vl, int idx, const QVariant &value )
{
  if ( !editor )
    return false;

  QgsVectorLayer::EditType editType = vl->editType( idx );
  const QgsField &field = vl->pendingFields()[idx];
  QVariant::Type myFieldType = field.type();

  QSettings settings;
  QString nullValue = settings.value( "qgis/nullValue", "NULL" ).toString();

  switch ( editType )
  {
    case QgsVectorLayer::Classification:
    case QgsVectorLayer::UniqueValues:
    case QgsVectorLayer::Enumeration:
    case QgsVectorLayer::ValueMap:
    case QgsVectorLayer::ValueRelation:
    {
      QVariant v = value;
      QComboBox *cb = qobject_cast<QComboBox *>( editor );
      if ( !cb )
        return false;

      if ( v.isNull() )
      {
        v = nullValue;
      }

      int idx = cb->findData( v );
      if ( idx < 0 )
        return false;

      cb->setCurrentIndex( idx );
    }
    break;

    case QgsVectorLayer::DialRange:
    case QgsVectorLayer::SliderRange:
    case QgsVectorLayer::EditRange:
    {
      if ( myFieldType == QVariant::Int )
      {
        if ( editType == QgsVectorLayer::EditRange )
        {
          QSpinBox *sb = qobject_cast<QSpinBox *>( editor );
          if ( !sb )
            return false;
          sb->setValue( value.toInt() );
        }
        else
        {
          QAbstractSlider *sl = qobject_cast<QAbstractSlider *>( editor );
          if ( !sl )
            return false;
          sl->setValue( value.toInt() );
        }
        break;
      }
      else if ( myFieldType == QVariant::Double )
      {
        QDoubleSpinBox *dsb = qobject_cast<QDoubleSpinBox *>( editor );
        if ( !dsb )
          return false;
        dsb->setValue( value.toDouble() );
      }
    }

    case QgsVectorLayer::CheckBox:
    {
      QCheckBox *cb = qobject_cast<QCheckBox *>( editor );
      if ( cb )
      {
        QPair<QString, QString> states = vl->checkedState( idx );
        cb->setChecked( value == states.first );
        break;
      }
    }

    // fall-through

    case QgsVectorLayer::LineEdit:
    case QgsVectorLayer::UniqueValuesEditable:
    case QgsVectorLayer::Immutable:
    case QgsVectorLayer::UuidGenerator:
    default:
    {
      QLineEdit *le = qobject_cast<QLineEdit *>( editor );
      QTextEdit *te = qobject_cast<QTextEdit *>( editor );
      QPlainTextEdit *pte = qobject_cast<QPlainTextEdit *>( editor );
      if ( !le && !te && !pte )
        return false;

      QString text;
      if ( value.isNull() )
      {
        if ( myFieldType == QVariant::Int || myFieldType == QVariant::Double || myFieldType == QVariant::LongLong )
          text = "";
        else if ( editType == QgsVectorLayer::UuidGenerator )
//.........这里部分代码省略.........
开发者ID:hCivil,项目名称:Quantum-GIS,代码行数:101,代码来源:qgsattributeeditor.cpp

示例9: retrieveValue


//.........这里部分代码省略.........
  QListWidget *lw = qobject_cast<QListWidget *>( widget );
  if ( lw )
  {
    if ( editType == QgsVectorLayer::ValueRelation )
    {
      text = '{';
      for ( int i = 0, n = 0; i < lw->count(); i++ )
      {
        if ( lw->item( i )->checkState() == Qt::Checked )
        {
          if ( n > 0 )
          {
            text.append( ',' );
          }
          text.append( lw->item( i )->data( Qt::UserRole ).toString() );
          n++;
        }
      }
      text.append( '}' );
    }
    else
    {
      text = QString::null;
    }
    modified = true;
  }

  QSpinBox *sb = qobject_cast<QSpinBox *>( widget );
  if ( sb )
  {
    text = QString::number( sb->value() );
  }

  QAbstractSlider *slider = qobject_cast<QAbstractSlider *>( widget );
  if ( slider )
  {
    text = QString::number( slider->value() );
  }

  QDoubleSpinBox *dsb = qobject_cast<QDoubleSpinBox *>( widget );
  if ( dsb )
  {
    text = QString::number( dsb->value() );
  }

  QCheckBox *ckb = qobject_cast<QCheckBox *>( widget );
  if ( ckb )
  {
    QPair<QString, QString> states = vl->checkedState( idx );
    text = ckb->isChecked() ? states.first : states.second;
  }

  QCalendarWidget *cw = qobject_cast<QCalendarWidget *>( widget );
  if ( cw )
  {
    text = cw->selectedDate().toString();
  }

  le = widget->findChild<QLineEdit *>();
  if ( le )
  {
    text = le->text();
  }

  switch ( theField.type() )
  {
开发者ID:hCivil,项目名称:Quantum-GIS,代码行数:67,代码来源:qgsattributeeditor.cpp

示例10: setRange

int AbstractSlider::setRange(lua_State * L) // ( int min, int max )
{
	QAbstractSlider* obj = ObjectHelper<QAbstractSlider>::check( L, 1);
	obj->setRange( Util::toInt( L, 2), Util::toInt( L, 3) );
	return 0;
}
开发者ID:Wushaowei001,项目名称:NAF,代码行数:6,代码来源:QtlAbstractSlider.cpp


注:本文中的QAbstractSlider类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。