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


C++ QComboBox::addItems方法代码示例

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


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

示例1: specBox

void DeviceWizardOptions::specBox()
{
    QGroupBox *gbSpecs = new QGroupBox();
    gbSpecs->setTitle("Specifications");
    QGridLayout *layout = new QGridLayout();
    gbSpecs->setLayout(layout);
    this->layout()->addWidget(gbSpecs);

    QLabel *channelLabel = new QLabel("Number of channels");
    layout->addWidget(channelLabel, 0, 0);
    QSpinBox *channels = new QSpinBox();
    channels->setMinimum(1);
    channels->setMaximum(2);
    channels->setValue(1);
    layout->addWidget(channels, 1, 0, 1, 3);

    QLabel *voltageLabel = new QLabel("Voltage Range");
    layout->addWidget(voltageLabel, 2, 0, 1, 2);
    QLabel *accLabel = new QLabel("Read back Accuracy");
    layout->addWidget(accLabel, 2, 2);

    QDoubleSpinBox *voltLow = new QDoubleSpinBox();
    voltLow->setMinimum(-50);
    voltLow->setMaximum(100);
    voltLow->setDecimals(1);
    voltLow->setSingleStep(0.1);
    voltLow->setValue(0.0);
    voltLow->setSuffix("V");
    layout->addWidget(voltLow, 3, 0);
    QDoubleSpinBox *voltHigh = new QDoubleSpinBox();
    voltHigh->setMinimum(0);
    voltHigh->setMaximum(100);
    voltHigh->setDecimals(1);
    voltHigh->setSingleStep(0.1);
    voltHigh->setValue(31.0);
    voltHigh->setSuffix("V");
    layout->addWidget(voltHigh, 3, 1);
    QComboBox *voltAccCombo = new QComboBox();
    voltAccCombo->addItems({"1V", "100mV", "10mV", "1mV"});
    voltAccCombo->setCurrentIndex(2);  // 10mV default
    layout->addWidget(voltAccCombo, 3, 2);

    QLabel *currentLabel = new QLabel("Current Range");
    layout->addWidget(currentLabel, 4, 0, 1, 2);
    QDoubleSpinBox *currentLow = new QDoubleSpinBox();
    currentLow->setMinimum(0);
    currentLow->setMaximum(10);
    currentLow->setDecimals(1);
    currentLow->setSingleStep(0.1);
    currentLow->setValue(0.0);
    currentLow->setSuffix("A");
    layout->addWidget(currentLow, 5, 0);
    QDoubleSpinBox *currentHigh = new QDoubleSpinBox();
    currentHigh->setMinimum(0);
    currentHigh->setMaximum(10);
    currentHigh->setDecimals(1);
    currentHigh->setSingleStep(0.1);
    currentHigh->setValue(5.1);
    currentHigh->setSuffix("A");
    layout->addWidget(currentHigh, 5, 1);
    QComboBox *currentAccCombo = new QComboBox();
    currentAccCombo->addItems({"1A", "100mA", "10mA", "1mA"});
    currentAccCombo->setCurrentIndex(3);  // 1mA default
    layout->addWidget(currentAccCombo, 5, 2);

    registerField("channel", channels);
    registerField("voltLow", voltLow, "value", "valueChanged");
    registerField("voltHigh", voltHigh, "value", "valueChanged");
    registerField("voltAcc", voltAccCombo);
    registerField("currentLow", currentLow, "value", "valueChanged");
    registerField("currentHigh", currentHigh, "value", "valueChanged");
    registerField("currentAcc", currentAccCombo);
}
开发者ID:crapp,项目名称:labpowerqt,代码行数:73,代码来源:devicewizardoptions.cpp

示例2: displayProperties

void RGBMatrixEditor::displayProperties(RGBScript *script)
{
    if (script == NULL)
        return;

    int gridRowIdx = 0;

    QList<RGBScriptProperty> properties = script->properties();
    if (properties.count() > 0)
        m_propertiesGroup->show();

    foreach(RGBScriptProperty prop, properties)
    {
        switch(prop.m_type)
        {
            case RGBScriptProperty::List:
            {
                QLabel *propLabel = new QLabel(prop.m_displayName);
                m_propertiesLayout->addWidget(propLabel, gridRowIdx, 0);
                QComboBox *propCombo = new QComboBox(this);
                propCombo->addItems(prop.m_listValues);
                propCombo->setProperty("pName", prop.m_name);
                connect(propCombo, SIGNAL(currentIndexChanged(QString)),
                        this, SLOT(slotPropertyComboChanged(QString)));
                m_propertiesLayout->addWidget(propCombo, gridRowIdx, 1);
                if (m_matrix != NULL)
                {
                    QString pValue = m_matrix->property(prop.m_name);
                    if (!pValue.isEmpty())
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
                        propCombo->setCurrentText(pValue);
#else
                        propCombo->setCurrentIndex(propCombo->findText(pValue));
#endif
                    else
                    {
                        pValue = script->property(prop.m_name);
                        if (!pValue.isEmpty())
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
                            propCombo->setCurrentText(pValue);
#else
                            propCombo->setCurrentIndex(propCombo->findText(pValue));
#endif
                    }
                }
                gridRowIdx++;
            }
            break;
            case RGBScriptProperty::Range:
            {
                QLabel *propLabel = new QLabel(prop.m_displayName);
                m_propertiesLayout->addWidget(propLabel, gridRowIdx, 0);
                QSpinBox *propSpin = new QSpinBox(this);
                propSpin->setRange(prop.m_rangeMinValue, prop.m_rangeMaxValue);
                propSpin->setProperty("pName", prop.m_name);
                connect(propSpin, SIGNAL(valueChanged(int)),
                        this, SLOT(slotPropertySpinChanged(int)));
                m_propertiesLayout->addWidget(propSpin, gridRowIdx, 1);
                if (m_matrix != NULL)
                {
                    QString pValue = m_matrix->property(prop.m_name);
                    if (!pValue.isEmpty())
                        propSpin->setValue(pValue.toInt());
                    else
                    {
                        pValue = script->property(prop.m_name);
                        if (!pValue.isEmpty())
                            propSpin->setValue(pValue.toInt());
                    }
                }
                gridRowIdx++;
            }
            break;
            default:
                qWarning() << "Type" << prop.m_type << "not handled yet";
            break;
        }
开发者ID:ChrisLaurie,项目名称:qlcplus,代码行数:77,代码来源:rgbmatrixeditor.cpp

示例3: comBox

void DeviceWizardOptions::comBox()
{
    QGroupBox *gbCom = new QGroupBox();
    gbCom->setTitle("Communication");
    gbCom->setLayout(new QVBoxLayout());
    this->layout()->addWidget(gbCom);

    this->comPort = new QComboBox();

    this->comPort->setToolTip(
        "Choose the port to which your device is connected");
    gbCom->layout()->addWidget(this->comPort);

    QGridLayout *baudFlowDBits = new QGridLayout();
    dynamic_cast<QVBoxLayout *>(gbCom->layout())->addLayout(baudFlowDBits);

    QLabel *baudLabel = new QLabel("Baud Rate");
    QComboBox *baudBox = new QComboBox();
    baudBox->addItems(
        {"1200", "2400", "4800", "9600", "19200", "38400", "57600", "115200"});
    baudBox->setCurrentText("9600");
    baudFlowDBits->addWidget(baudLabel, 0, 0);
    baudFlowDBits->addWidget(baudBox, 1, 0);

    QLabel *flowctlLabel = new QLabel("Flow Control");
    QComboBox *flowctlBox = new QComboBox();
    flowctlBox->addItems(
        {"No flow control", "Hardware flow control", "Software flow control"});
    flowctlBox->setCurrentIndex(0);
    baudFlowDBits->addWidget(flowctlLabel, 0, 1);
    baudFlowDBits->addWidget(flowctlBox, 1, 1);

    QLabel *dbitsLabel = new QLabel("Data Bits");
    QComboBox *dbitsBox = new QComboBox();
    dbitsBox->addItems({"5", "6", "7", "8"});
    dbitsBox->setCurrentText("8");
    baudFlowDBits->addWidget(dbitsLabel, 0, 2);
    baudFlowDBits->addWidget(dbitsBox, 1, 2);

    QLabel *parityLabel = new QLabel("Parity");
    QComboBox *parityBox = new QComboBox();
    parityBox->addItem("No Parity", 0);
    parityBox->addItem("Even Parity", 2);
    parityBox->addItem("Odd Parity", 3);
    parityBox->addItem("Space Parity", 4);
    parityBox->addItem("Mark Parity", 5);
    parityBox->setCurrentIndex(0);
    baudFlowDBits->addWidget(parityLabel, 2, 0);
    baudFlowDBits->addWidget(parityBox, 3, 0);

    QLabel *stopLabel = new QLabel("Stop Bits");
    QComboBox *stopBox = new QComboBox();
    stopBox->addItem("1", 1);
    stopBox->addItem("1.5", 3);
    stopBox->addItem("2", 2);
    stopBox->setCurrentIndex(0);
    baudFlowDBits->addWidget(stopLabel, 2, 1);
    baudFlowDBits->addWidget(stopBox, 3, 1);

    QLabel *pollingFreqLabel = new QLabel("Polling frequency");
    QComboBox *pollFreqBox = new QComboBox();
    pollFreqBox->setToolTip("Polling Frequency in Hertz");
    pollFreqBox->addItem("10 Hz", 100);
    pollFreqBox->addItem("5 Hz", 200);
    pollFreqBox->addItem("2 Hz", 500);
    pollFreqBox->addItem("1 Hz", 1000);
    pollFreqBox->addItem("0.5 Hz", 2000);
    pollFreqBox->addItem("0.2 Hz", 5000);
    pollFreqBox->addItem("0.1 Hz", 10000);
    pollFreqBox->setCurrentIndex(1);
    baudFlowDBits->addWidget(pollingFreqLabel, 4, 0);
    baudFlowDBits->addWidget(pollFreqBox, 5, 0);

    QLabel *sportTimeoutLabel = new QLabel("Serial port timeout");
    QSpinBox *sportTimeout = new QSpinBox();
    sportTimeout->setMinimum(1);
    sportTimeout->setMaximum(10000);
    sportTimeout->setSuffix("ms");
    sportTimeout->setValue(10);
    sportTimeout->setToolTip(
        "Time in Milliseconds the Serialport will wait \n"
        "for an answer from the device. Tuning this option \n"
        "might improve communication resulting in a higher \n"
        "polling frequency. If this value is to low you \n"
        "will encounter partial or complete data loss on \n"
        "the serial port connection.");
    baudFlowDBits->addWidget(sportTimeoutLabel, 4, 1);
    baudFlowDBits->addWidget(sportTimeout, 5, 1);

    // we need the comport string not index
    registerField("comPort", this->comPort, "currentText");
    registerField("baudBox", baudBox, "currentText");
    registerField("flowctlBox", flowctlBox);
    registerField("dbitsBox", dbitsBox, "currentText");
    registerField("parityBox", parityBox, "currentData");
    registerField("stopBox", stopBox, "currentData");
    registerField("pollFreqBox", pollFreqBox, "currentData");
    registerField("sportTimeout", sportTimeout);
}
开发者ID:crapp,项目名称:labpowerqt,代码行数:99,代码来源:devicewizardoptions.cpp

示例4: createEditor

QWidget* QmitkPropertyDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option
  , const QModelIndex &index) const
{
  QVariant data = index.data(Qt::EditRole);
  QVariant displayData = index.data(Qt::DisplayRole);
  QString name = index.model()->data(index.model()->index(index.row(), index.column()-1)).value<QString>();

  if(data.isValid())
  {

    QWidget* editorWidget = NULL;

    if(data.type() == QVariant::Color)
    {
      QPushButton* colorBtn = new QPushButton(parent);
      QColor color = data.value<QColor>();

      QColor result = QColorDialog::getColor(color);
      if(result.isValid())
      {
        QPalette palette = colorBtn->palette();
        palette.setColor(QPalette::Button, result);
        colorBtn->setPalette(palette);
        colorBtn->setStyleSheet(QString("background-color: %1;foreground-color: %1; border-style: none;").arg(result.name()));
        //colorBtn->setFlat(true);
      }
      // QColorDialog closed by 'Cancel' button, use the old property color
      else
      {
        QPalette palette = colorBtn->palette();
        palette.setColor(QPalette::Button, color);
        colorBtn->setPalette(palette);
        colorBtn->setStyleSheet(QString("background-color: %1;foreground-color: %1; border-style: none;").arg(color.name()));

      }

      connect(colorBtn, SIGNAL(pressed()), this, SLOT(commitAndCloseEditor()));

      editorWidget = colorBtn;
    }

/*
    else if(data.type() == QVariant::Bool)
    {
      QCheckBox *visibilityCheckBox = new QCheckBox(parent);
      connect(visibilityCheckBox, SIGNAL(editingFinished()),
        this, SLOT(commitAndCloseEditor()));

      return visibilityCheckBox;
    }*/


    else if(data.type() == QVariant::Int)
    {
      QSpinBox* spinBox = new QSpinBox(parent);
      spinBox->setSingleStep(1);
      spinBox->setMinimum(std::numeric_limits<int>::min());
      spinBox->setMaximum(std::numeric_limits<int>::max());
      editorWidget = spinBox;
    }
    // see qt documentation. cast is correct, it would be obsolete if we
    // store doubles
    else if(static_cast<QMetaType::Type>(data.type()) == QMetaType::Float)
    {
      QDoubleSpinBox* spinBox = new QDoubleSpinBox(parent);
      spinBox->setDecimals(2);
      spinBox->setSingleStep(0.1);
      if(name == "opacity")
      {
        spinBox->setMinimum(0.0);
        spinBox->setMaximum(1.0);
      }
      else
      {
        spinBox->setMinimum(std::numeric_limits<float>::min());
        spinBox->setMaximum(std::numeric_limits<float>::max());
      }

      editorWidget = spinBox;
    }

    else if(data.type() == QVariant::StringList)
    {
      QStringList entries = data.value<QStringList>();
      QComboBox* comboBox = new QComboBox(parent);
      comboBox->setEditable(false);
      comboBox->addItems(entries);

      editorWidget = comboBox;
    }


    else
    {
      editorWidget = QStyledItemDelegate::createEditor(parent, option, index);
    }

    if ( editorWidget )
    {
      // install event filter
//.........这里部分代码省略.........
开发者ID:beneon,项目名称:MITK,代码行数:101,代码来源:QmitkPropertyDelegate.cpp

示例5: switch

QWidget *GrainDelegate::createEditor(QWidget *parent,
                                     const QStyleOptionViewItem &/*option*/,
                                     const QModelIndex &index) const
{
    QComboBox *combo;
    QDoubleSpinBox *spin;
    QString suffix;

    // can only edit name on blank row
    if (index.row() >= index.model()->rowCount()) return 0;

    // different kind of editor for each column
    switch (index.column()) {
      case GrainModel::NAME:
          combo = new QComboBox(parent);
          combo->setEditable(true);
          combo->addItem(QString());
          combo->addItems(Data::instance()->grainsList());
          combo->installEventFilter(const_cast<GrainDelegate*>(this));
          return combo;

      case GrainModel::WEIGHT:
          spin = new QDoubleSpinBox(parent);
          spin->setDecimals(3);
          spin->setRange(0.00, 1000.00);
          spin->setSingleStep(0.25);
          spin->setAccelerated(true);
          suffix = " " + Data::instance()->defaultGrainUnit().symbol();
          spin->setSuffix(suffix);
          spin->installEventFilter(const_cast<GrainDelegate*>(this));
          return spin;

      case GrainModel::EXTRACT:
          spin = new QDoubleSpinBox(parent);
          spin->setDecimals(3);
          spin->setRange(1.000, 1.100);
          spin->setSingleStep(0.001);
          spin->setAccelerated(true);
          spin->installEventFilter(const_cast<GrainDelegate*>(this));
          return spin;

      case GrainModel::COLOR:
          spin = new QDoubleSpinBox(parent);
          spin->setDecimals(1);
          spin->setRange(0.0, 500.0);
          spin->setSingleStep(1.0);
          spin->setSuffix(Resource::DEGREE);
          spin->setAccelerated(true);
          spin->installEventFilter(const_cast<GrainDelegate*>(this));
          return spin;

      case GrainModel::TYPE:
          combo = new QComboBox(parent);
          combo->setEditable(false);
          combo->addItems(Grain::typeStringList());
          combo->installEventFilter(const_cast<GrainDelegate*>(this));
          return combo;

      case GrainModel::USE:
          combo = new QComboBox(parent);
          combo->setEditable(false);
          combo->addItems(Grain::useStringList());
          combo->installEventFilter(const_cast<GrainDelegate*>(this));
          return combo;

      default:
          return 0;
    }
}
开发者ID:Smerty,项目名称:qbrew,代码行数:69,代码来源:graindelegate.cpp

示例6: updateTable


//.........这里部分代码省略.........
      // add units column
      assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
      CCopasiDataModel* pDataModel = (*CCopasiRootContainer::getDatamodelList())[0];
      assert(pDataModel != NULL);
      pItem = new ColorTableItem(color, FROM_UTF8(" " + units.getDimensions()[i].getDisplayString(pDataModel)));
      setItem((int) rowCounter, 4, pItem);

      // add a line for a metabolite Parameter
      if ((usage == CFunctionParameter::SUBSTRATE)
          || (usage == CFunctionParameter::PRODUCT)
          || (usage == CFunctionParameter::MODIFIER))
        {
          // get the list of possible metabs (for the combo box)
          if (usage == CFunctionParameter::MODIFIER) //get all metabs; modifiers are never locked
            vectorOfStrings2QStringList(getListOfAllMetabNames(model, ri), qsl);
          else //only get the modifiers from the ChemEq
            {
              if (!ri.isLocked(i))
                vectorOfStrings2QStringList(ri.getListOfMetabs(usage), qsl);
            }

          metabNames = &(ri.getMappings(i));

          if (!ri.isVector(i))
            {
              if (ri.isLocked(i))
                {
                  pItem = new ColorTableItem(color, FROM_UTF8((*metabNames)[0]));
                  setItem((int) rowCounter, 3, pItem);
                }
              else
                {
                  QComboBox * pComboBox = new QComboBox();
                  pComboBox->addItems(qsl);
                  pComboBox->setBackgroundColor(color);
                  pComboBox->setCurrentText(FROM_UTF8(unQuote((*metabNames)[0])));

                  setCellWidget((int) rowCounter, 3, pComboBox);
                }
            }
          else
            {
              if (ri.isLocked(i))
                {
                  pItem = new ColorTableItem(color, "");
                  setItem((int) rowCounter, 3, pItem);
                }
              else // this should not happen
                {
                  QComboBox * pComboBox = new QComboBox();
                  pComboBox->addItems(qsl);
                  pComboBox->setBackgroundColor(color);
                  pComboBox->setCurrentText("add species");

                  setCellWidget((int) rowCounter, 3, pComboBox);
                }

              // add lines for vector parameters
              jmax = metabNames->size();
              setRowCount(rowCount() + (int) jmax);

              for (j = 0; j < jmax; ++j)
                {
                  ++rowCounter;
                  pItem = new ColorTableItem(color, FROM_UTF8((*metabNames)[j]));
                  setItem((int) rowCounter, 3, pItem);
开发者ID:ShuoLearner,项目名称:COPASI,代码行数:67,代码来源:CQParameterTable.cpp

示例7: setEditorData

void MotionTypeDelegate::setEditorData(QWidget *editor, const QModelIndex & index) const
{
    QComboBox * comboBox = static_cast<QComboBox*>(editor);
    comboBox->addItems(AbstractMotion::typeList());
    comboBox->setCurrentIndex(index.model()->data(index, Qt::EditRole).toInt());
}
开发者ID:arkottke,项目名称:strata,代码行数:6,代码来源:MotionTypeDelegate.cpp

示例8: createEditor

QWidget* SceneTableUi::createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const
{
   ObsAction* action = 0;
   if (ObsActions)
   {
      action = (*ObsActions)[index.row()+1];
   }

   int delay = 0;
   QString currentSceneOrTransition;
   switch (index.column())
   {
      case QTV_DELAY1:
         delay = action ? action->GetDelay1():0;
         break;
      case QTV_DELAY2:
         delay = action ? action->GetDelay2():0;
         break;
      case QTV_SCENE1:
         currentSceneOrTransition = action ? action->GetScene1Name():"";
         break;
      case QTV_SCENE2:
         currentSceneOrTransition = action ? action->GetScene2Name():"";
         break;
      case QTV_TRANSITION:
         currentSceneOrTransition = action ? action->GetTransitionName():"";
         break;
   }

   switch (index.column())
   {
      case QTV_ACTION:
      {
         return new QLabel(action ? action->actionName:"");
      }
      break;
      case QTV_DELAY1:
      case QTV_DELAY2:
      {
         QSpinBox *editor = new QSpinBox(parent);
         editor->setFrame(false);
         editor->setValue(delay);
         editor->setMinimum(0);
         editor->setMaximum(100);

         return editor;
      }
      break;
      case QTV_SCENE1:
      case QTV_SCENE2:
      case QTV_TRANSITION:
      {
         QComboBox* comboBox = new QComboBox(parent);
         comboBox->addItems(index.column() == QTV_TRANSITION?Transitions:Scenes);
         int index = comboBox->findText(currentSceneOrTransition);
         if ( index != -1 )
         {
            comboBox->setCurrentIndex(index);
         }
         return comboBox;
      }
      break;
   }
}
开发者ID:omishukov,项目名称:dsu_osis,代码行数:64,代码来源:scenetableui.cpp

示例9: initUi

//------------------------------------------------------------------------------
void Widget::initUi()
{
	QVBoxLayout* pMainLyt = new QVBoxLayout(this);
  pMainLyt->setMargin(5);
  pMainLyt->setSpacing(5);
  
  QHBoxLayout* pServerInfo = new QHBoxLayout(this);
  {
    QComboBox* pServerAddress = new QComboBox(this);
    pServerAddress->addItems(getLocalIpAddresses());
    mpPort = new QLineEdit("12345",this);
    mpProtocols = new QComboBox( this );
    mpProtocols->insertItem( tpRaw, "raw" );
    mpProtocols->insertItem( tpRealisim, "realisim" );
    
    connect(mpProtocols, SIGNAL(activated(int)),
    	this, SLOT(protocolChanged(int)) );
    
    pServerInfo->addWidget(pServerAddress);
    pServerInfo->addWidget(mpPort);
    pServerInfo->addWidget(mpProtocols);
  }
  
  QHBoxLayout* pButtonsLyt = new QHBoxLayout(this);
  {
    mpStartServer = new QPushButton("Start",this);
    mpStopServer = new QPushButton("Stop",this);
    mpStopServer->setDisabled(true);
    pButtonsLyt->addStretch(1);
    pButtonsLyt->addWidget(mpStartServer);
    pButtonsLyt->addWidget(mpStopServer);
    
    connect(mpStartServer, SIGNAL(clicked()), this, SLOT(startServer()));
    connect(mpStopServer, SIGNAL(clicked()), this, SLOT(stopServer()));
  }
  
  QHBoxLayout* pLyt1 = new QHBoxLayout();
  {
	  QLabel* pConnectedPeers = new QLabel("Connected Peers:", this);
  	mpNumberOfPeers = new QLabel( "0", this );
    
    pLyt1->addWidget( pConnectedPeers );
    pLyt1->addWidget( mpNumberOfPeers );
    pLyt1->addStretch( 1 );
  }
  
  mpConnectedPeers = new QTreeWidget(this);
  mpConnectedPeers->setColumnCount(4);
  QTreeWidgetItem* item = new QTreeWidgetItem();
  item->setText(0, "Id");
  item->setText(1, "Ip Address");
  item->setText(2, "state");
  item->setText(3, "transmission");
  mpConnectedPeers->setHeaderItem(item);
  connect( mpConnectedPeers, SIGNAL( itemClicked ( QTreeWidgetItem*, int ) ),
  	this, SLOT( peerItemClicked( QTreeWidgetItem*, int ) ) );
  
  //---générale
  QLabel* pLog = new QLabel("Log:", this);
  mpLog = new QTextEdit(this);
  
  //---assemblage dans le layout
  pMainLyt->addLayout(pServerInfo);
  pMainLyt->addLayout(pButtonsLyt);
  pMainLyt->addLayout(pLyt1);
  pMainLyt->addWidget(mpConnectedPeers);
  
  pMainLyt->addWidget(pLog);
  pMainLyt->addWidget(mpLog);
}
开发者ID:realisim,项目名称:realisim,代码行数:71,代码来源:Widget.cpp

示例10: updateTable


//.........这里部分代码省略.........
	QStringList propsText;
	for (i=0; i<ASCII_OPEN_DLG_TYPES_NUMBER; i++)
        propsText << QString(ASCII_OPEN_DLG_TYPES_NAMES[i]);

	//remove unnecessary columns
	while (columnsCount<m_columnsCount)
		tableWidget->removeColumn(--m_columnsCount);
	for (i=lineCount+1;i<=DISPLAYED_LINES;++i)
		tableWidget->removeRow(i);

    int columnWidth = (tableWidget->width()*9) / (columnsCount*10);
    columnWidth = std::max(columnWidth,80);

	//Icons
	const QIcon xIcon(QString::fromUtf8(":/CC/Types/images/types/x_coordinate.png"));
	const QIcon yIcon(QString::fromUtf8(":/CC/Types/images/types/y_coordinate.png"));
	const QIcon zIcon(QString::fromUtf8(":/CC/Types/images/types/z_coordinate.png"));
	const QIcon NormIcon(QString::fromUtf8(":/CC/Types/images/types/normal.png"));
	const QIcon RGBIcon(QString::fromUtf8(":/CC/Types/images/types/rgb_color.png"));
	const QIcon GreyIcon(QString::fromUtf8(":/CC/Types/images/types/gray_color.png"));
	const QIcon ScalarIcon(QString::fromUtf8(":/CC/Types/images/types/scalar_field.png"));
	const QIcon PositiveScalarIcon(QString::fromUtf8(":/CC/Types/images/types/positive_scalar_field.png"));

	unsigned assignedXYZ = 0;
	unsigned assignedNorm = 0;
	unsigned assignedRGB = 0;
	for (i=0;i<columnsCount;i++)
	{
		QComboBox* columnHeader = static_cast<QComboBox*>(tableWidget->cellWidget(0,i));
		QComboBox* _columnHeader = columnHeader;
		if (!columnHeader)
		{
			columnHeader = new QComboBox();
			columnHeader->addItems(propsText);
			columnHeader->setMaxVisibleItems(ASCII_OPEN_DLG_TYPES_NUMBER);
			columnHeader->setCurrentIndex(0);
			columnHeader->setItemIcon(ASCII_OPEN_DLG_X,xIcon);
			columnHeader->setItemIcon(ASCII_OPEN_DLG_Y,yIcon);
			columnHeader->setItemIcon(ASCII_OPEN_DLG_Z,zIcon);
			columnHeader->setItemIcon(ASCII_OPEN_DLG_NX,NormIcon);
			columnHeader->setItemIcon(ASCII_OPEN_DLG_NY,NormIcon);
			columnHeader->setItemIcon(ASCII_OPEN_DLG_NZ,NormIcon);
			columnHeader->setItemIcon(ASCII_OPEN_DLG_R,RGBIcon);
			columnHeader->setItemIcon(ASCII_OPEN_DLG_G,RGBIcon);
			columnHeader->setItemIcon(ASCII_OPEN_DLG_B,RGBIcon);
			columnHeader->setItemIcon(ASCII_OPEN_DLG_Grey,GreyIcon);
			columnHeader->setItemIcon(ASCII_OPEN_DLG_Scalar,ScalarIcon);
			columnHeader->setItemIcon(ASCII_OPEN_DLG_Positive_Scalar,PositiveScalarIcon);
			columnHeader->setItemIcon(ASCII_OPEN_DLG_RGB32i,RGBIcon);
			columnHeader->setItemIcon(ASCII_OPEN_DLG_RGB32f,RGBIcon);

			connect(columnHeader, SIGNAL(currentIndexChanged(int)), this, SLOT(columnsTypeHasChanged(int)));
		}

		if (valueIsNumber[i])
		{
			//first time? let's try to assign each column a type
			if ((m_invalidColumns || m_columnsCount==0) && columnsCount>1)
			{
				columnHeader->blockSignals(true);
				//by default, we assume that the first columns are always X,Y and Z
				if (assignedXYZ<3)
				{
					//in rare cases, the first column is an index
					if (assignedXYZ==0 && valueIsInteger[i] && (i+1<columnsCount) && !valueIsInteger[i+1])
					{
开发者ID:jkua,项目名称:cloudcompare,代码行数:67,代码来源:AsciiOpenDlg.cpp


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