Example #1
1
void EasyViewWidget::refreshDisplay() {
    if(this->layout()) {
        qDeleteAll(Boxes);
        Boxes.clear();
        delete this->layout();
    }

    QVBoxLayout *layout = new QVBoxLayout;
    setLayout(layout);

    QComboBox* fileChoice = new QComboBox();

#if defined(_WIN32) && defined(WINAPI_FAMILY) && (WINAPI_FAMILY==WINAPI_FAMILY_APP) // Workaround render bug
    QString style = "QComboBox QAbstractItemView { border: 1px solid gray }";
    fileChoice->setStyleSheet(style);
#endif

    layout->addWidget(fileChoice);
    for (size_t Pos=0; Pos<C->Count_Get(); Pos++)
        fileChoice->addItem( wstring2QString(C->Get(Pos, Stream_General, 0, __T("CompleteName"))), (int)Pos);

    fileChoice->setCurrentIndex(FilePos);

    connect(fileChoice,SIGNAL(currentIndexChanged(int)),SLOT(changeFilePos(int)));

    QFrame *box;
    QGroupBox *subBox;
    for (size_t StreamPos=0; StreamPos<Stream_Max; StreamPos++) {
        bool addBox = false;
        box = new QFrame();
        QHBoxLayout* boxLayout = new QHBoxLayout();
        box->setLayout(boxLayout);
        for (size_t Pos=0; Pos<Boxes_Count_Get(StreamPos); Pos++) {
            subBox = createBox((stream_t)StreamPos,(int)Pos);
            if(subBox!=NULL) {
                boxLayout->addWidget(subBox);
                addBox = true;
            }
        }
        if(addBox) {
            layout->addWidget(box);
            Boxes.push_back(box);
        }

    }
    layout->addStretch();
}
Example #2
0
void ComboUsersDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
{
     Q_UNUSED(index);
     QComboBox * combo = static_cast<QComboBox*>(editor);
     QMapIterator<QString,QString> it(m_mapUsers);
     int row = 0;
     while (it.hasNext())
     {
         it.next();
         QString login = it.key();
         QString prat = it.value();
         combo->addItem(login);
         combo->setItemData(row,prat,Qt::ToolTipRole);
         ++row;
         }
}
Example #3
0
void MainWindow::updateObjectComboBox()
{
    QComboBox *comboBox = ui->objectSelectorComboBox;

    int previousIndex = comboBox->currentIndex();
    int previousSize = comboBox->count();

    comboBox->clear();
    for(int i = 0; i < levelObjects.count(); i++)
    {
        comboBox->addItem(QString(levelObjects.at(i).value("type").toString() + " - " + levelObjects.at(i).value("name").toString()));
    }

    if(previousSize == comboBox->count())
        comboBox->setCurrentIndex(previousIndex);
}
Example #4
0
// Create new combo widget
QtWidgetObject* AtenTreeGuiDialog::addCombo(TreeGuiWidget* widget, QString label)
{
	QtWidgetObject* qtwo = widgetObjects_.add();
	QComboBox* combo = new QComboBox(this);
	qtwo->set(widget, combo, label);
	// Add items to combo and set current index
	for (int n=0; n<widget->comboItems().count(); ++n) combo->addItem(widget->comboItems().at(n));
	combo->setCurrentIndex(widget->valueI() - 1);
	combo->setEnabled(widget->enabled());
	combo->setVisible(widget->visible());
	combo->setMinimumHeight(WIDGETHEIGHT);
	combo->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
	// Connect signal to master slot
	QObject::connect(combo, SIGNAL(currentIndexChanged(int)), this, SLOT(comboWidget_currentIndexChanged(int)));
	return qtwo;
}
Example #5
0
void RightWidget::constructPathGroup()
{
    QGroupBox *pathGroupBox = new QGroupBox("Compute a shortest path :");

    QComboBox *sourceComboBox = new QComboBox();
    for(int id:mcTalker->getNodeIDList())
    {
        sourceComboBox->addItem(
                             QString::number(id).append(" | ").append(
                             QString::fromStdString(
                             mcTalker->getNodeNameFromId(
                             id
                             ))));
    }
    sourceComboBox->setCurrentIndex(-1);

    connect(sourceComboBox,SIGNAL(currentIndexChanged(int)),
            this,SLOT(sendAResetElectionSig()));
    connect(sourceComboBox,SIGNAL(currentIndexChanged(int)),
            this,SLOT(assignReachableNode(int)));
    connect(sourceComboBox,SIGNAL(currentIndexChanged(int)),
            this,SLOT(assignSourceNodeId(int)));
    destComboBox = new QComboBox();

    connect(destComboBox,SIGNAL(currentIndexChanged(int)),
            this,SLOT(assignDestNodeId(int)));

    QGridLayout *groupBoxLayout = new QGridLayout();
    groupBoxLayout->addWidget(new QLabel("Start point :"),1,1,1,1);
    groupBoxLayout->addWidget(sourceComboBox,1,2,1,2);
    groupBoxLayout->addWidget(new QLabel("End point :"),2,1,1,1);
    groupBoxLayout->addWidget(destComboBox,2,2,1,2);

    computeButton=new QPushButton("Compute !\n(will do something only on reachable place)");
    computeButton->setEnabled(false);
    connect(sourceComboBox,SIGNAL(currentIndexChanged(int)),
            this,SLOT(deactivatePathButton()));
    connect(destComboBox,SIGNAL(currentIndexChanged(int)),
            this,SLOT(activatePathButton()));
    connect(computeButton,SIGNAL(clicked()),this,SLOT(startShortestPath()));
    connect(computeButton,SIGNAL(clicked()),this,SLOT(deactivatePathButton()));
    groupBoxLayout->addWidget(computeButton,3,1,1,3);

    pathGroupBox->setLayout(groupBoxLayout);

    layout->addWidget(pathGroupBox);
}
Example #6
0
int CComboBox::AddString(LPCTSTR lpszString)
{
	int index = CB_ERR;
	
	assert(m_hWnd);
	
	if (m_hWnd)
	{
        QComboBox *comboBox = (QComboBox *)m_hWnd;

        comboBox->addItem(QString::fromStdWString(lpszString));

        index = comboBox->count();
	}
	
	return index;
}
EpidemicCasesWidget::EpidemicCasesWidget(boost::shared_ptr<EpidemicDataSet> dataSet)
{
    setTitle("Cases");

    QVBoxLayout * layout = new QVBoxLayout();
    setLayout(layout);

    // add num cases widget
    numCasesSpinBox_.setMaximum(999999);
    numCasesSpinBox_.setSuffix(" cases");
    layout->addWidget(&numCasesSpinBox_);

    // add node choices widget
    layout->addWidget(&nodeComboBox_);

    std::vector<int> nodeIds = dataSet->getNodeIds();

    for(unsigned int i=0; i<nodeIds.size(); i++)
    {
        nodeComboBox_.addItem(dataSet->getNodeName(nodeIds[i]).c_str(), nodeIds[i]);
    }

    // add stratification choices
    std::vector<std::vector<std::string> > stratifications = EpidemicDataSet::getStratifications();

    for(unsigned int i=0; i<stratifications.size(); i++)
    {
        QComboBox * stratificationValueComboBox = new QComboBox(this);

        for(unsigned int j=0; j<stratifications[i].size(); j++)
        {
            stratificationValueComboBox->addItem(QString(stratifications[i][j].c_str()), j);
        }

        stratificationValueComboBoxes_.push_back(stratificationValueComboBox);

        layout->addWidget(stratificationValueComboBox);
    }

    // default to second age group (first stratification)
    stratificationValueComboBoxes_[0]->setCurrentIndex(1);

    // hide last stratification (vaccination status)
    // todo: could be handled better...
    stratificationValueComboBoxes_[stratificationValueComboBoxes_.size()-1]->hide();
}
Example #8
0
QWidget *IColDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem & /* option */, const QModelIndex &index) const
{
    if( index.column() == 0 ){
	QComboBox *comboBox = new QComboBox(parent);
	
	sSet colsSet=_msc->getColsSet( _type, _name, _p );
	
	for( sSet::const_iterator p=colsSet.begin(); p != colsSet.end(); p++ ){
	    comboBox->addItem((*p).c_str());
	}
	comboBox->setEditable(true);
	comboBox->setAutoCompletion(true);

	return comboBox;
    }
    return NULL;
}
Example #9
0
QWidget *TaskItemDelegate::createEditor(QWidget *parent,
                                          const QStyleOptionViewItem &/* option */,
                                          const QModelIndex & index ) const
{
    QComboBox *editor = new QComboBox(parent);
    int j = -1;
    int i=0;
    QString current = index.data().toString();
    foreach(const Task& t, *m_sak->tasks()) {
        editor->addItem(t.icon, t.title);
        if (t.title == current)
            j = i;
    }
    Q_ASSERT(j = -1);
    editor->setCurrentIndex(j);
    return editor;
}
Example #10
0
QWidget *ComboBoxDelegate::createEditor(QWidget *parent,
    const QStyleOptionViewItem & option ,
    const QModelIndex & index) const
{
    if (index.column()==0){
       QComboBox *editor = new QComboBox(parent); int ei = 0;
       QString s = index.model()->data(index, Qt::EditRole).toString();
       for(int j=1; j<=n_element; j++) {
          QString aux = QString("%1  %2 ").arg(j,3).arg(QString::fromStdString(element_data[j-1].symbol),2);
          editor->addItem(aux);
          if( s.toStdString() == element_data[j-1].symbol ) ei = j-1;
       }
       editor->setCurrentIndex(ei);
       return editor;
    }
    else return QItemDelegate::createEditor(parent,option,index);
}
Example #11
0
void TilesetItemBox::prepareTilesetGroup(const SimpleTilesetGroup &tilesetGroups)
{
    if(lockTilesetBox) return;

    QWidget *t = findTabWidget(tilesetGroups.groupCat);
    if(!t)
        t = makeCategory(tilesetGroups.groupCat);
    QComboBox *c = getGroupComboboxOfTab(t);
    if(!c)
        return;
    c->setInsertPolicy(QComboBox::InsertAlphabetically);
    if(!util::contains(c, tilesetGroups.groupName))
        c->addItem(tilesetGroups.groupName);
    c->model()->sort(0);
    c->setCurrentIndex(0);
    connect(c, SIGNAL(currentIndexChanged(int)), this, SLOT(on_tilesetGroup_currentIndexChanged(int)));
}
Example #12
0
QComboBox* StringHandler::getLinePatternComboBox()
{
  QComboBox *pLinePatternComboBox = new QComboBox;
  pLinePatternComboBox->setIconSize(QSize(58, 16));
  pLinePatternComboBox->addItem(QIcon(":/Resources/icons/line-none.svg"), getLinePatternString(LineNone));
  pLinePatternComboBox->addItem(QIcon(":/Resources/icons/line-solid.svg"), getLinePatternString(LineSolid));
  pLinePatternComboBox->addItem(QIcon(":/Resources/icons/line-dash.svg"), getLinePatternString(LineDash));
  pLinePatternComboBox->addItem(QIcon(":/Resources/icons/line-dot.svg"), getLinePatternString(LineDot));
  pLinePatternComboBox->addItem(QIcon(":/Resources/icons/line-dash-dot.svg"), getLinePatternString(LineDashDot));
  pLinePatternComboBox->addItem(QIcon(":/Resources/icons/line-dash-dot-dot.svg"), getLinePatternString(LineDashDotDot));
  return pLinePatternComboBox;
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void PhaseTypeSelectionWidget::updatePhaseComboBoxes()
{
  bool ok = false;
  // setup the list of choices for the widget
  PhaseTypeSelectionFilterParameter* phaseTypes = dynamic_cast<PhaseTypeSelectionFilterParameter*>(getFilterParameter());
  QString countProp = phaseTypes->getPhaseTypeCountProperty();
  int phaseCount = getFilter()->property(countProp.toLatin1().constData()).toInt(&ok);
  QString phaseDataProp = phaseTypes->getPhaseTypeDataProperty();

  UInt32Vector_t vectorWrapper = getFilter()->property(phaseDataProp.toLatin1().constData()).value<UInt32Vector_t>();
  QVector<quint32> dataFromFilter = vectorWrapper.d;
  if(phaseCount < 0 && dataFromFilter.size() < 10)   // there was an issue getting the phase Count from the Filter.
  {
    phaseCount = dataFromFilter.size(); // So lets just use the count from the actual phase data
  }

  // Get our list of predefined enumeration values
  QVector<unsigned int> phaseTypeEnums;
  PhaseType::getPhaseTypeEnums(phaseTypeEnums);

  phaseListWidget->clear();
  // Get our list of Phase Type Strings
  QStringList phaseListChoices = m_FilterParameter->getPhaseListChoices();

  for (int i = 1; i < phaseCount; i++)
  {
    QComboBox* cb = new QComboBox(NULL);
    for (int s = 0; s < phaseListChoices.size(); ++s)
    {
      cb->addItem((phaseListChoices[s]), phaseTypeEnums[s]);
      cb->setItemData(static_cast<int>(s), phaseTypeEnums[s], Qt::UserRole);
    }

    QListWidgetItem* item = new QListWidgetItem(phaseListWidget);
    phaseListWidget->addItem(item);
    phaseListWidget->setItemWidget(item, cb);

    if (i < dataFromFilter.size())
    {
      cb->setCurrentIndex(dataFromFilter[i]);
    }
    connect(cb, SIGNAL(currentIndexChanged(int)),
            this, SLOT(phaseTypeComboBoxChanged(int)) );
  }
}
void DesktopThemeDetails::replacementItemChanged()
{
    //Check items to see if theme has been customized
    m_themeCustomized = true;
    QHashIterator<QString, int> i(m_items);
    while (i.hasNext()) {
        i.next();
        QComboBox *itemComboBox = static_cast<QComboBox*>(m_themeItemList->cellWidget(i.value(), 1));
        int replacement = itemComboBox->currentIndex();
        if (replacement <= (m_themes.size() - 1)) {
            // Item replacement source is a theme
            m_itemThemeReplacements[i.value()] = itemComboBox->currentIndex();
        } else if (replacement > (m_themes.size() - 1)) {
            // Item replacement source is a file
            if (itemComboBox->currentText() == i18n("File...")) {
                //Get the filename for the replacement item
                QString translated_key = i18nc("plasma name", qPrintable( i.key() ) );
                QString fileReplacement = QFileDialog::getOpenFileName(this, i18n("Select File to Use for %1",translated_key));
                if (!fileReplacement.isEmpty()) {
                    m_itemFileReplacements[i.value()] = fileReplacement;
                    int index = itemComboBox->findText(fileReplacement);
                    if (index == -1) itemComboBox->addItem(fileReplacement);
                    disconnect(itemComboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &DesktopThemeDetails::replacementItemChanged);
                    itemComboBox->setCurrentIndex(itemComboBox->findText(fileReplacement));
                    connect(itemComboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &DesktopThemeDetails::replacementItemChanged);
                    m_itemThemeReplacements[i.value()] = -1; //source is not a theme
                    m_itemFileReplacements[i.value()] = itemComboBox->currentText();
                } else {
                    // Reset combobox to previous value if no file is selected
                    if (m_itemThemeReplacements[i.value()] != -1) {
                        itemComboBox->setCurrentIndex(m_itemThemeReplacements[i.value()]);
                    } else {
                        itemComboBox->setCurrentIndex(itemComboBox->findText(m_itemFileReplacements[i.value()]));
                    }
                    m_themeCustomized = false;
                }
            } else {
                m_itemThemeReplacements[i.value()] = -1; //source is not a theme
                m_itemFileReplacements[i.value()] = itemComboBox->currentText();
            }
        }
    }

    if (m_themeCustomized) emit changed();
}
QWidget* CameraParamsWidget::createEditorFor(const calibration::CameraParam& param)
{
	if(!param.choices.empty())
	{
		QComboBox* box = new QComboBox(m_w);
		for(uint i = 0; i < param.choices.size(); ++i)
		{
			box->addItem(
				param.choices[i].label.c_str(),
				param.choices[i].value
			);
			if(param.choices[i].value == param.value)
				box->setCurrentIndex(i);
		}

		box->setProperty("paramID", param.id);

		connect(box, SIGNAL(activated(int)), SLOT(updateComboBox()));

		return box;
	}

	if(param.minimum == 0 && param.maximum == 1)
	{
		QCheckBox* box = new QCheckBox(m_w);
		box->setChecked(param.value);

		box->setProperty("paramID", param.id);

		connect(box, SIGNAL(clicked(bool)), SLOT(updateCheckBox(bool)));

		return box;
	}

	QSlider* slider = new QSlider(Qt::Horizontal, m_w);
	slider->setMinimum(param.minimum);
	slider->setMaximum(param.maximum);
	slider->setValue(param.value);

	slider->setProperty("paramID", param.id);

	connect(slider, SIGNAL(valueChanged(int)), SLOT(updateSlider(int)));

	return slider;
}
QWidget *QgsComposerColumnAlignmentDelegate::createEditor( QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index ) const
{
  Q_UNUSED( option );
  Q_UNUSED( index );

  //create a combo box showing alignment options
  QComboBox *comboBox = new QComboBox( parent );

  comboBox->addItem( tr( "Top left" ), int( Qt::AlignTop | Qt::AlignLeft ) );
  comboBox->addItem( tr( "Top center" ), int( Qt::AlignTop | Qt::AlignHCenter ) );
  comboBox->addItem( tr( "Top right" ), int( Qt::AlignTop | Qt::AlignRight ) );
  comboBox->addItem( tr( "Middle left" ), int( Qt::AlignVCenter | Qt::AlignLeft ) );
  comboBox->addItem( tr( "Middle center" ), int( Qt::AlignVCenter | Qt::AlignHCenter ) );
  comboBox->addItem( tr( "Middle right" ), int( Qt::AlignVCenter | Qt::AlignRight ) );
  comboBox->addItem( tr( "Bottom left" ), int( Qt::AlignBottom | Qt::AlignLeft ) );
  comboBox->addItem( tr( "Bottom center" ), int( Qt::AlignBottom | Qt::AlignHCenter ) );
  comboBox->addItem( tr( "Bottom right" ), int( Qt::AlignBottom | Qt::AlignRight ) );

  Qt::AlignmentFlag alignment = ( Qt::AlignmentFlag )index.model()->data( index, Qt::EditRole ).toInt();
  comboBox->setCurrentIndex( comboBox->findData( alignment ) );

  return comboBox;
}
Example #17
0
    void UICanvasTestEdit::RefreshCanvases()
    {
        if (!editor_widget_)
            return;
                
        Foundation::ModuleSharedPtr ui_module = framework_->GetModuleManager()->GetModule("UiServices").lock();

        UiServices::UiModule *ui_services = dynamic_cast<UiServices::UiModule*>(ui_module.get());
        const QList<UiServices::UiProxyWidget *> proxy_widgets = ui_services->GetSceneManager()->GetAllProxyWidgets();
        
        QComboBox* combo = editor_widget_->findChild<QComboBox*>("combo_canvas");    
        if (!combo)
            return;
                
        combo->clear();
        foreach(UiServices::UiProxyWidget *proxy_widget, proxy_widgets)
            combo->addItem(proxy_widget->getWidgetProperties().getWidgetName());
    }
// PUBLIC METHODS
QWidget* ComboBoxItemDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const {

    // ComboBox ony in column 2
    if (index.column() != this->rowIndex) {
        return QStyledItemDelegate::createEditor(parent, option, index);
    }

    // Create the combobox and populate it
    QComboBox* cb = new QComboBox(parent);

    for(int i = 0; i < this->options.size(); i++) {

        cb->addItem(this->options[i]);

    }

    return cb;
}
void ViewController::fillPortsInfo()
{
    QComboBox* cb = parentWidget()->findChild<QComboBox*>("comboBox_comport");
    if(cb) {
        if(cb->count() == 1) {
            cb->clear();
            
            foreach (const QextPortInfo &info, QextSerialEnumerator::getPorts()) {
                QStringList list;
                list << info.portName
                << info.friendName
                << info.physName
                << (info.vendorID ? QString::number(info.vendorID, 16) : QString())
                << (info.productID ? QString::number(info.productID, 16) : QString());

                cb->addItem(list.first(), list);
            }
        }
Example #20
0
NewProjectDialog::NewProjectDialog(QWidget *parent)
    : QDialog(parent)
{
    QFormLayout *l = new QFormLayout;

    QValidator *validator = new QIntValidator(1, 65536, this);
    m_WidthEdit = new QLineEdit(this);
    m_WidthEdit->setText( "256" );
    m_WidthEdit->setValidator(validator);
    l->addRow("Width", m_WidthEdit);

    m_HeightEdit = new QLineEdit(this);
    m_HeightEdit->setValidator(validator);
    m_HeightEdit->setText( "256" );
    l->addRow("Height", m_HeightEdit);

    {
        QSpinBox* w = new QSpinBox(this);
        num_frames=1;
        w->setValue(num_frames);
        w->setRange(1,65536);
        connect(w, SIGNAL(valueChanged(int)), this, SLOT(framesChanged(int)));
        l->addRow("Frames", w);
    }

    {
        QComboBox* w = new QComboBox(this);
        m_Format = w;
        w->addItem("RGB",-1);
        w->addItem("2 colour palette",2);
        w->addItem("4 colour palette",4);
        w->addItem("8 colour palette",8);
        w->addItem("16 colour palette",16);
        w->addItem("32 colour palette",32);
        w->addItem("64 colour palette",64);
        w->addItem("128 colour palette",128);
        w->addItem("256 colour palette",256);
        num_colours = 32;
        pixel_format = FMT_I8;
        w->setCurrentIndex(5);
        connect(w,SIGNAL(currentIndexChanged(int)), this, SLOT(formatChanged(int)));
        l->addRow("Format", w);
    }

    QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
    connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));

    l->addRow(buttonBox);
    setLayout(l);
    setWindowTitle(tr("New Project"));
}
Example #21
0
QWidget *PluginConnDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
    Q_UNUSED(option)
    QComboBox* editor = new QComboBox(parent);
    QStringList data;
    if(index.column() == 0) // output plugin
    {
        data = _plugConfUI->getOutputPluginList("");
    }
    else    // input plugin
    {
        data = _plugConfUI->getInputPluginList("");

    }

    foreach(const QString& name, data)
    {
        editor->addItem(name);
    }
Example #22
0
bool QSoundProcessor::open_device_select_dialog()
{
    QDialog dialog;
    dialog.setFixedSize(320,120);
    dialog.setWindowTitle(tr("Audio device"));

    QVBoxLayout Lcenter;
        QHBoxLayout Lbuttons;
        QPushButton Baccept(tr("Accept"));
        Baccept.setToolTip(tr("Selected device will be used"));
        connect(&Baccept, &QPushButton::clicked, &dialog, &QDialog::accept);
        QPushButton Bcancel(tr("Cancel"));
        Bcancel.setToolTip(tr("Default device will be used"));
        connect(&Bcancel, &QPushButton::clicked, &dialog, &QDialog::reject);
        Lbuttons.addWidget(&Baccept);
        Lbuttons.addWidget(&Bcancel);

        QGroupBox GBselect(tr("Select audio capture device"));
        QVBoxLayout Llocal;
            QComboBox CBdevice;
            QList<QAudioDeviceInfo> devices = QAudioDeviceInfo::availableDevices(QAudio::AudioInput);
            for(int i = 0; i < devices.size(); ++i)
            {
                CBdevice.addItem(devices.at(i).deviceName(), qVariantFromValue(devices.at(i)));
            }
        Llocal.addWidget(&CBdevice);
        GBselect.setLayout(&Llocal);

    Lcenter.addWidget(&GBselect);
    Lcenter.addLayout(&Lbuttons);
    dialog.setLayout(&Lcenter);

    if(dialog.exec() == QDialog::Accepted)
    {
        m_device_info = CBdevice.currentData().value<QAudioDeviceInfo>();
        return true;
    }
    else
    {
        m_device_info = QAudioDeviceInfo::defaultInputDevice();
    }
    return false;
}
Example #23
0
FilteringView::FilteringView(QAbstractItemModel *model, QWidget *parent)
  : QWidget(parent)
{
  setWindowTitle(tr("Filter View"));
  proxyModel = new QSortFilterProxyModel(this);
  proxyModel->setSourceModel(model);

  QVBoxLayout *lay = new QVBoxLayout(this);
  QHBoxLayout *hlay = new QHBoxLayout;
  QLineEdit *edit = new QLineEdit;
  QComboBox *comboBox = new QComboBox;

  int modelIndex = model->columnCount(QModelIndex());
  for(int i=0; i < modelIndex; i++)
    comboBox->addItem(model->headerData(i, Qt::Horizontal, 
				Qt::DisplayRole).toString());


  hlay->addWidget(edit);
  hlay->addWidget(comboBox);

  QTreeView *view = new QTreeView;
  view->setModel(proxyModel);
  view->setAlternatingRowColors(true);

  // Make the header "clickable"
  view->header()->setClickable(true);
  // Sort Indicator festlegen
  view->header()->setSortIndicator(0, Qt::AscendingOrder);
  // Sort Indicator anzeigen
  view->header()->setSortIndicatorShown(true);
  // Initial sortieren 
  view->sortByColumn(0);

  lay->addLayout(hlay);
  lay->addWidget(view);

  connect(edit, SIGNAL(textChanged(const QString&)),
       proxyModel, SLOT(setFilterWildcard(const QString&)));

  connect(comboBox, SIGNAL(activated(int)), 
		  SLOT(setFilterKeyColumn(int)));
}
Example #24
0
QWidget* PreferencesDialog::initializeSpellCheckTab()
{
    QWidget* tab = new QWidget();

    QVBoxLayout* tabLayout = new QVBoxLayout();
    tab->setLayout(tabLayout);

    QCheckBox* spellcheckCheckBox = new QCheckBox(tr("Live spellcheck enabled"));
    spellcheckCheckBox->setCheckable(true);
    spellcheckCheckBox->setChecked(appSettings->getLiveSpellCheckEnabled());
    connect(spellcheckCheckBox, SIGNAL(toggled(bool)), appSettings, SLOT(setLiveSpellCheckEnabled(bool)));
    tabLayout->addWidget(spellcheckCheckBox);

    QGroupBox* languageGroupBox = new QGroupBox(tr("Language"));
    tabLayout->addWidget(languageGroupBox);

    QFormLayout* languageGroupLayout = new QFormLayout();
    languageGroupBox->setLayout(languageGroupLayout);

    QComboBox* dictionaryComboBox = new QComboBox();

    QStringList languages = DictionaryManager::instance().availableDictionaries();
    languages.sort();

    int currentDictionaryIndex = 0;

    for (int i = 0; i < languages.length(); i++)
    {
        QString language = languages[i];
        dictionaryComboBox->addItem(languageName(language), language);

        if (appSettings->getDictionaryLanguage() == language)
        {
            currentDictionaryIndex = i;
        }
    }

    dictionaryComboBox->setCurrentIndex(currentDictionaryIndex);
    connect(dictionaryComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onDictionaryChanged(int)));
    languageGroupLayout->addRow(tr("Dictionary"), dictionaryComboBox);

    return tab;
}
Example #25
0
void MainWindow::typeBoxChanged(int index)
{
	QComboBox * snd = static_cast<QComboBox *>(sender());
	int playerIndex = 0;
	for (NgPlayerEdit const & pe : ngPlayerEdits)
	{
		QComboBox * cb = pe.typeBox;
		if (cb == snd)
			break;
		++playerIndex;
	}

	Player *& p = selectedPlayers[playerIndex];
	if (index != 3)
	{
		if (p != this)
			delete p;
		snd->removeItem(3);
	}
	switch (index)
	{
		case 0:
			p = 0;
			break;
		case 1:
			p = this;
			break;
		case 2:
		{
			if (playerSelector->exec() == QDialog::Accepted)
			{
				p = playerSelector->createPlayer();
				snd->addItem(playerSelector->playerDisplayName());
				snd->setCurrentIndex(3);
			}
			else
			{
				p = 0;
				snd->setCurrentIndex(0);
			}
		}
	}
}
Example #26
0
QWidget *ControlGroupDelegate::createEditor(QWidget *parent,
        const QStyleOptionViewItem &/* option */,
        const QModelIndex &/* index */) const
{
    QComboBox *editor = new QComboBox(parent);
    editor->addItem(CONTROLGROUP_CHANNEL1_STRING);
    editor->addItem(CONTROLGROUP_CHANNEL2_STRING);
    editor->addItem(CONTROLGROUP_SAMPLER1_STRING);
    editor->addItem(CONTROLGROUP_SAMPLER2_STRING);
    editor->addItem(CONTROLGROUP_SAMPLER3_STRING);
    editor->addItem(CONTROLGROUP_SAMPLER4_STRING);
    editor->addItem(CONTROLGROUP_MASTER_STRING);
    editor->addItem(CONTROLGROUP_PLAYLIST_STRING);
    editor->addItem(CONTROLGROUP_FLANGER_STRING);
    editor->addItem(CONTROLGROUP_MICROPHONE_STRING);

    return editor;
}
void LocationDialog::populatePlanetList()
{
	Q_ASSERT(ui);
	Q_ASSERT(ui->planetNameComboBox);

	QComboBox* planets = ui->planetNameComboBox;
	SolarSystem* ssystem = GETSTELMODULE(SolarSystem);
	QStringList planetNames(ssystem->getAllPlanetEnglishNames());

	//Save the current selection to be restored later
	planets->blockSignals(true);
	int index = planets->currentIndex();
	QVariant selectedPlanetId = planets->itemData(index);
	planets->clear();
	//For each planet, display the localized name and store the original as user
	//data. Unfortunately, there's no other way to do this than with a cycle.
	foreach(const QString& name, planetNames)
	{
		planets->addItem(q_(name), name);
	}
QWidget* QtnPropertyDelegateQBrushStyle::createValueEditorImpl(QWidget* parent, const QRect& rect, QtnInplaceInfo* inplaceInfo)
{
    if (owner().isEditableByUser())
    {
        QComboBox* combo = new QtnPropertyBrushStyleComboBox(parent);
        combo->setLineEdit(nullptr);
        combo->setItemDelegate(new QtnPropertyBrushStyleItemDelegate());
        if (m_showAll)
        {
            for (auto bs = Qt::NoBrush; bs <= Qt::ConicalGradientPattern; bs = Qt::BrushStyle(bs + 1))
            {
                combo->addItem("", QVariant::fromValue(bs));
            }
            combo->addItem("", QVariant::fromValue(Qt::TexturePattern));
        }
        else
        {
            combo->addItem("", QVariant::fromValue(Qt::NoBrush));
            combo->addItem("", QVariant::fromValue(Qt::SolidPattern));
            combo->addItem("", QVariant::fromValue(Qt::HorPattern));
            combo->addItem("", QVariant::fromValue(Qt::VerPattern));
            combo->addItem("", QVariant::fromValue(Qt::CrossPattern));
            combo->addItem("", QVariant::fromValue(Qt::BDiagPattern));
            combo->addItem("", QVariant::fromValue(Qt::FDiagPattern));
            combo->addItem("", QVariant::fromValue(Qt::DiagCrossPattern));
        }

        combo->setGeometry(rect);

        new QtnPropertyBrushStyleComboBoxHandler(owner(), *combo);

        if (inplaceInfo)
            combo->showPopup();

        return combo;
    }

    return nullptr;
}
Example #29
0
QWidget* ComboBoxItemDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const
{
    // ComboBox ony in column 1
    if (index.column() != 0)
        return QStyledItemDelegate::createEditor(parent, option, index);

    // Create the combobox and populate it
    QComboBox* cb = new QComboBox(parent);

    cb->addItem(QString("IO10/5"), 1);
    cb->addItem(QString("TH"), 3);
    cb->addItem(QString("I12"), 4);
    cb->addItem(QString("I20"), 5);
    cb->addItem(QString("O10"), 6);
    cb->addItem(QString("CVM"), 7);
    cb->addItem(QString("ISC3"), 10);
    cb->addItem(QString("IO4/7"), 11);
    cb->addItem(QString("O8"), 12);
    cb->addItem(QString("GMR IO"), 14);

    return cb;
}
void EasyViewWidget::refreshDisplay() {
    if(this->layout()) {
        qDeleteAll(Boxes);
        Boxes.clear();
        delete this->layout();
    }

    QVBoxLayout *layout = new QVBoxLayout;
    setLayout(layout);

    QComboBox* fileChoice = new QComboBox();
    layout->addWidget(fileChoice);
    for (size_t Pos=0; Pos<C->Count_Get(); Pos++)
        fileChoice->addItem( wstring2QString(C->Get(Pos, Stream_General, 0, __T("CompleteName"))), (int)Pos);

    fileChoice->setCurrentIndex(FilePos);

    connect(fileChoice,SIGNAL(currentIndexChanged(int)),SLOT(changeFilePos(int)));

    QFrame *box;
    QGroupBox *subBox;
    for (size_t StreamPos=0; StreamPos<Stream_Max; StreamPos++) {
        bool addBox = false;
        box = new QFrame();
        QHBoxLayout* boxLayout = new QHBoxLayout();
        box->setLayout(boxLayout);
        for (size_t Pos=0; Pos<Boxes_Count_Get(StreamPos); Pos++) {
            subBox = createBox((stream_t)StreamPos,(int)Pos);
            if(subBox!=NULL) {
                boxLayout->addWidget(subBox);
                addBox = true;
            }
        }
        if(addBox) {
            layout->addWidget(box);
            Boxes.push_back(box);
        }

    }
    layout->addStretch();
}