Example #1
0
void
PluginsPage::initializePage()
{
#ifdef Q_OS_WIN32
    QList<IPluginInfo*> supportedPlugins = wizard()->pluginList()->supportedList();
    foreach( IPluginInfo* plugin, supportedPlugins )
    {
        QCheckBox* cb;
        m_pluginsLayout->addWidget( cb = new QCheckBox( plugin->name(), this ));
        connect( cb, SIGNAL(toggled(bool)), plugin, SLOT(install(bool)));
        connect( cb, SIGNAL(toggled(bool)), SLOT(checkPluginsSelected()));

        cb->setObjectName( plugin->id() );
        cb->setChecked( plugin->isAppInstalled() );
        cb->style()->polish( cb );

        if ( plugin->isInstalled() )
        {
            if ( plugin->version() > plugin->installedVersion() )
            {
                cb->setChecked( true );
                cb->setText( cb->text() + " " + tr( "(newer version)" ));
            }
            else
            {
                cb->setChecked( false );
                cb->setText( cb->text() + " " + tr( "(Plugin installed tick to reinstall)" ));
            }
        }
    }
Example #2
0
void Expectations::saveDatas()
{
    // Nom
    exp_->setName(name_->text());

    // Listes d'uvs
    exp_->clearUvs();

    for(int i = 0; i < unwantedUvsLayout_->count() - 1; i++)
    {
        QCheckBox* cb = dynamic_cast<QCheckBox*>(unwantedUvsLayout_->itemAt(i)->widget());
        if (cb->isChecked())
        {
            const Uv *uv = UTManager::instance().uvFromCode(cb->text());
            if(uv)
                exp_->addRejectedUv(uv);
        }
    }

    for(int i = 0; i < wantedUvsLayout_->count() - 1; i++)
    {

        QCheckBox* cb = dynamic_cast<QCheckBox*>(wantedUvsLayout_->itemAt(i)->widget());
        if (cb->isChecked())
        {
            const Uv *uv = UTManager::instance().uvFromCode(cb->text());
            if(uv)
                exp_->addRequiredUv(uv);
        }
    }
}
Example #3
0
void SearchDialog::toggleItems(bool enabled)
{
	QCheckBox *checkBox = qobject_cast<QCheckBox*>(sender());
	for (QListView *list : this->findChildren<QListView*>()) {
		QStandardItemModel *m = qobject_cast<QStandardItemModel*>(list->model());
		// Hiding / restoring items has to be done in 2-steps
		// First step is for finding items that are about to be moved
		// Second step is for iterating backward on marked items -> you cannot remove items on a single for loop
		if (enabled) {
			// Restore hidden items for every list
			QList<QStandardItem*> items = _hiddenItems.value(list);
			QList<int> indexes;
			for (int i = 0; i < items.size(); i++) {
				QStandardItem *item = items.at(i);
				// Extract only matching items
				if (item->data(AbstractSearchDialog::DT_Origin) == checkBox->text()) {
					indexes.prepend(i);
				}
			}

			// Moving back from hidden to visible
			for (int i = 0; i < indexes.size(); i++) {
				QStandardItem *item = items.takeAt(indexes.at(i));
				m->appendRow(item);
			}

			// Replace existing values with potentially empty list
			_hiddenItems.insert(list, items);
			m->sort(0);
		} else {
			// Hide items for every list
			QStandardItemModel *m = qobject_cast<QStandardItemModel*>(list->model());
			QList<QStandardItem*> items;
			QList<QPersistentModelIndex> indexes;
			for (int i = 0; i < m->rowCount(); i++) {
				QStandardItem *item = m->item(i, 0);
				if (item->data(AbstractSearchDialog::DT_Origin).toString() == checkBox->text()) {
					indexes << m->index(i, 0);
					// Default copy-constructor is protected!
					QStandardItem *copy = new QStandardItem(item->text());
					copy->setData(checkBox->text(), AbstractSearchDialog::DT_Origin);
					copy->setIcon(item->icon());
					items.append(copy);
				}
			}

			for (const QPersistentModelIndex &i : indexes) {
				m->removeRow(i.row());
			}

			// Finally, hide selected items
			if (!items.isEmpty()) {
				QList<QStandardItem*> hItems = _hiddenItems.value(list);
				hItems.append(items);
				_hiddenItems.insert(list, hItems);
			}
		}
	}
}
Example #4
0
void PringKvitok::on_toolButton_pdf_clicked()
{
#if !defined(QT_NO_PRINTER)

    QString pg;
    QMapIterator<QString, QCheckBox*> i(childsCheckBox_map);

    ui->progressBar->setVisible(true);
    int count = 0;
    int c = 0;
    while (i.hasNext()) {
        i.next();
         QCheckBox *cb = i.value();
         if (cb->checkState() == Qt::Checked){
             count++;
          }
    }

    ui->progressBar->setMaximum(count);
    QString page1;
    QString page2;
    while (i.hasPrevious()) {
        i.previous();
        QCheckBox *cb = i.value();

         if (cb->checkState() == Qt::Checked){
             if (ui->checkBox_twokv->checkState() == Qt::Checked){
             if (page1 == "") page1 = prepareKvit(cb->text());
             else {
                page2 = prepareKvit(cb->text());
                pg += TwoKvitOnePage(page1, page2);
                page1 = "";
                page2 = "";
             }
          } else pg += prepareKvit(cb->text());
          ui->progressBar->setValue(c++);
        }

    }
    if (ui->checkBox_twokv->checkState() == Qt::Checked && page1 != "" && page2 == "") pg += page1;
     QTextDocument textDocument;

     textDocument.setHtml(pg);
     QPrinter printer(QPrinter::HighResolution);

     printer.setOutputFormat(QPrinter::PdfFormat);
     printer.setOutputFileName( "print.pdf");

     printer.setOrientation(QPrinter::Portrait);
     printer.setPaperName("A4");


     printer.setPageMargins(1, 1, 1, 1,  QPrinter::Millimeter );
     textDocument.print(&printer);
     ui->progressBar->setValue(c++);
     ui->progressBar->setVisible(false);
 #endif
}
Example #5
0
void PringKvitok::on_toolButton_print_clicked()
{
#if !defined(QT_NO_PRINTER)

    QPrinter printer(QPrinter::HighResolution);
    QPrintDialog *dlg = new QPrintDialog(&printer, this);

   dlg->setWindowTitle(tr("Настройки принтера"));
   if (dlg->exec() == QDialog::Accepted){
       QString pg;
       QMapIterator<QString, QCheckBox*> i(childsCheckBox_map);
       ui->progressBar->setVisible(true);
       int count = 0;
       int c = 0;
       while (i.hasNext()) {
           i.next();
            QCheckBox *cb = i.value();
            if (cb->checkState() == Qt::Checked){
                count++;
             }
       }

       ui->progressBar->setMaximum(count);
       QString page1;
       QString page2;
       while (i.hasPrevious()) {
           i.previous();
           QCheckBox *cb = i.value();

            if (cb->checkState() == Qt::Checked){
                if (ui->checkBox_twokv->checkState() == Qt::Checked){
                if (page1 == "") page1 = prepareKvit(cb->text());
                else {
                   page2 = prepareKvit(cb->text());
                   pg += TwoKvitOnePage(page1, page2);
                   page1 = "";
                   page2 = "";
                }
             } else pg += prepareKvit(cb->text());
             ui->progressBar->setValue(c++);
           }

       }
       if (ui->checkBox_twokv->checkState() == Qt::Checked && page1 != "" && page2 == "") pg += page1;
        QTextDocument textDocument;

        textDocument.setHtml(pg);
         QPrinter printer(QPrinter::HighResolution);
         printer.setOrientation(QPrinter::Portrait);
         printer.setPaperName("A4");
         printer.setPageMargins(0.3, 0.3, 0.3, 0.3, QPrinter::Unit() );
         if (ui->checkBox_duplex->checkState() == Qt::Checked)printer.setDuplex(QPrinter::DuplexAuto);
         textDocument.print(&printer);
          ui->progressBar->setVisible(false);
   }
   delete dlg;
 #endif
}
Example #6
0
void Tag_modif::saveAndQuit() {
    NM::TagManager *tm = NM::TagManager::getInstance();
    QLayoutItem *child;
    while( (child = ui->group_tags->layout()->takeAt(0)) )  {
        QCheckBox *ch = dynamic_cast<QCheckBox*>(child->widget());
        if (ch->isChecked()) {
            tm->addLink(ch->text(), note);
        } else {
            tm->removeLink(ch->text(), note);
        }
    }

    this->close();
}
Example #7
0
void BrowseWidget::parseGenrePanel(const QString &id, QNetworkReply *reply) {
  Q_UNUSED(id);

  auto api = API::sharedAPI()->sharedAniListAPI();
  auto request_url = reply->request().url().toDisplayString();

  if (request_url.startsWith(api->API_GENRES.toDisplayString())) {
    auto data = reply->readAll();
    auto array = QJsonDocument::fromJson(data).array();
    auto width = 0;
    auto metric = this->fontMetrics();

    for (auto value : array) {
      auto object = value.toObject();
      QCheckBox *chk = new QCheckBox(this);

      chk->setText(object.value("genre").toString());
      chk->setTristate();

      width = qMax(width, metric.width(chk->text()));

      m_ui->genre_list->addWidget(chk);
    }

    m_ui->genre_area->setMinimumWidth(width * 2);
  }
}
void DataSelectionScreen::checkBoxClicked(bool checked)
{
	QCheckBox *check = qobject_cast<QCheckBox*>(sender());
	if (!check)
	{
		return;
	}
	if (checked)
	{
		emit itemEnabled(check->text());
	}
	else
	{
		emit itemDisabled(check->text());
	}
}
void CQExperimentSelection::slotBtnOK()
{
  mpBox->clear();

  QCheckBox * pCheckBox;
  bool AllChecked = true;
  bool NoneChecked = true;
  unsigned C_INT32 i, imax = mpTable->numRows();

  for (i = 0; i < imax; i++)
    {
      pCheckBox = static_cast<QCheckBox *>(mpTable->cellWidget(i, 0));

      if (pCheckBox->isChecked())
        {
          mpBox->insertItem(pCheckBox->text());
          NoneChecked = false;
        }
      else
        AllChecked = false;
    }

  if (AllChecked || NoneChecked)
    mpBox->clear();

  accept();
}
Example #10
0
QCheckBox* LayoutManager::copyCheckBox(QObject* obj) {
    QCheckBox *oldCheckBox = qobject_cast<QCheckBox*>(obj);
    QCheckBox *newCheckBox = new QCheckBox();

    newCheckBox->setText(oldCheckBox->text());
    newCheckBox->setObjectName(oldCheckBox->objectName() + " " + QString::number(keyLayouts.size()));
    return newCheckBox;
}
Example #11
0
void CheckBoxListDelegate::setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const
{
   // Get the editor.
   QCheckBox* myEditor = static_cast<QCheckBox*>(editor);

   // Set model data.
   model->setData(index, myEditor->text(), Qt::EditRole);
   model->setData(index, myEditor->isChecked(), Qt::UserRole);
}
void NoiseReductionOptionsWidget::filterGroupChanged(QList<QCheckBox*> list)
{
    m_qFilterListCheckBox.clear();

    qDebug() << "list.size(): " << list.size();

    for(int u = 0; u < list.size(); u++) {
        QCheckBox* tempCheckBox = new QCheckBox(list[u]->text());
        tempCheckBox->setChecked(list[u]->isChecked());

        connect(tempCheckBox, &QCheckBox::toggled,
                list[u], &QCheckBox::setChecked);

        if(tempCheckBox->text() == "Activate user designed filter")
            connect(tempCheckBox, &QCheckBox::toggled,
                    this, &NoiseReductionOptionsWidget::onUserFilterToggled);

        connect(list[u], &QCheckBox::toggled,
                tempCheckBox, &QCheckBox::setChecked);

        m_qFilterListCheckBox.append(tempCheckBox);
    }

    //Delete all widgets in the filter layout
    //QGridLayout* topLayout = static_cast<QGridLayout*>(ui->m_groupBox_temporalFiltering->layout());
    //if(!topLayout) {
       QGridLayout* topLayout = new QGridLayout();
    //}

//    QLayoutItem *child;
//    while((child = topLayout->takeAt(0)) != 0) {
//        delete child->widget();
//        delete child;
//    }

    //Add filters
    int u = 0;

    qDebug() << "m_qFilterListCheckBox.size(): " << m_qFilterListCheckBox.size();

    for(u; u < m_qFilterListCheckBox.size(); ++u) {
        topLayout->addWidget(m_qFilterListCheckBox[u], u, 0);
    }

    //Add push button for filter options
    m_pShowFilterOptions = new QPushButton();
//        m_pShowFilterOptions->setText("Open Filter options");
    m_pShowFilterOptions->setText("Filter options");
    m_pShowFilterOptions->setCheckable(false);
    connect(m_pShowFilterOptions, &QPushButton::clicked,
            this, &NoiseReductionOptionsWidget::onShowFilterOptions);

    topLayout->addWidget(m_pShowFilterOptions, u+1, 0);

    //Find Filter tab and add current layout
    ui->m_groupBox_temporalFiltering->setLayout(topLayout);
}
Example #13
0
void ToolBox::instrument_Clicked(bool value){
    QObject *sender = QObject::sender();

    QCheckBox *cb = qobject_cast<QCheckBox *>(sender);
    QString name = cb->text();

    if(value)UWCore::getInstance()->getPluginManager()->getInstrument(name)->hidePlugin();
    else UWCore::getInstance()->getPluginManager()->getInstrument(name)->showPlugin();
}
void ChooseSetsPage::checkBoxChanged(int state)
{
    QCheckBox *checkBox = qobject_cast<QCheckBox *>(sender());
    QList<SetToDownload> &sets = wizard()->importer->getSets();
    for (int i = 0; i < sets.size(); ++i)
        if (sets[i].getLongName() == checkBox->text()) {
            sets[i].setImport(state);
            break;
        }
}
Example #15
0
void
WidgetVpzPropertyExpCond::onCheckboxToggle(bool checked)
{
    // Get the QCheckbox that emit signal
    QObject* sender = QObject::sender();
    QCheckBox* cb = qobject_cast<QCheckBox*>(sender);

    // Sanity check ... if no model set or checkbox not found
    if ((mVpz == 0) || (cb == 0))
        return;

    // Search the vleExpCond associated with the checkbox
    // bool oldBlock = mVpz->blockSignals(true);
    if (checked) {
        mVpz->attachCondToAtomicModel(mModQuery, cb->text());
    } else {
        mVpz->detachCondToAtomicModel(mModQuery, cb->text());
    }
    // mVpz->blockSignals(oldBlock);
}
QVector<QString> ChooseProgramList::getSelectedPrograms() const
{
  QVector<QString> result;
  QCheckBox *checkBox;
  foreach (checkBox, checkBoxes)
  {
    if (checkBox->isChecked())
      result.push_back(checkBox->text());
  }
  return result;
}
Example #17
0
void CheckBoxListDelegate::setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index ) const
{
	//get the value from the editor (CheckBox)
	QCheckBox *myEditor = static_cast<QCheckBox*>(editor);
	bool value = myEditor->isChecked();

	//set model data
	QMap<int,QVariant> data;
	data.insert(Qt::DisplayRole,myEditor->text());
	data.insert(Qt::UserRole,value);
	model->setItemData(index,data);
}
Example #18
0
void MainWindow::on_deleteButton_clicked()
{   int rCount = ui->tableWidget->rowCount();
    UserInterface ui1;
    for (int i =1;i<rCount-1;i++)
    {
        QCheckBox* cBox = qobject_cast<QCheckBox*> (ui->tableWidget->cellWidget(i,1));
        if(!cBox)
            continue;
        if(cBox->isChecked())
            ui1.deleteFile(cBox->text().toStdString());
    }
    on_scanButton_clicked();
}
void AddUserDialog::CheckNActivatedUser()
{
    vNActivateUsrReq.clear();
    int len=ui->listWidgetForbidUser->count();
    QListWidgetItem* curItem;
    QCheckBox* checkbox;
    for(int i=0;i<len;++i){
        curItem=ui->listWidgetForbidUser->item(i);
        checkbox=(QCheckBox*)ui->listWidgetForbidUser->itemWidget(curItem);
        if(checkbox->isChecked())
            this->vNActivateUsrReq.push_back(checkbox->text().toStdString());
    }
    std::cout << "vNActivateUsrReq" << vNActivateUsrReq[0] << std::endl;
}
Example #20
0
void SettingsDialog::changeAssociation(bool enabled)
{
    QCheckBox *cb = dynamic_cast<QCheckBox*>(sender());
    if(cb == NULL) return;

    QString ext(cb->text());
    if(FileAssoc::isSupportAssociation()){
        if(enabled){
            FileAssoc::setAssociation(ext);
        }else{
            FileAssoc::clearAssociation(ext);
        }
    }
}
Example #21
0
void MainWindow::logSourceChange( QWidget* pWidget )
{
    QCheckBox* checkbox = qobject_cast<QCheckBox*>( pWidget );
    QAbstractItemModel* model = mUI.logListWidget->model();
    QModelIndexList list = model->match( model->index( 0, 0 ), Qt::UserRole + 1, 
        checkbox->text(), -1 );

    for( QModelIndexList::iterator i = list.begin();i != list.end(); ++i )
    {
        model->setData( *i, checkbox->isChecked(), Qt::UserRole + 3 );
        MainWindow::checkLogItem( *i );
    }

    if( !list.empty() ) mUI.logListWidget->scrollToBottom();
}
Example #22
0
void SettingsDialog::changeAssociation(bool enabled)
{
    QCheckBox *cb = dynamic_cast<QCheckBox*>(sender());
    if(cb == NULL) return;

    QString ext(cb->text());
    if(enabled){
        OSRelated::setAssociation(ext);
    }else{
        OSRelated::clearAssociation(ext);
    }
    OSRelated::refreshExplorer();

    reviewCheckAllButtonState();
}
Example #23
0
OptionDialog::~OptionDialog ()
{
#ifdef Q_WS_MAEMO_5
    settings.setValue("orientation", orient->currentText());
#endif
    settings.setValue("headerOrder", availableHeaders);
    QStringList h;
    foreach (QObject* child, children())
    {
        QCheckBox* cb = qobject_cast<QCheckBox*>(child);
        if (cb && cb->isChecked ())
        {
            h << cb->text ();
        }
    }
Example #24
0
void DbFieldWidget::saveData(){
    dialog->dbSetup.setFirstName(ui->firstBox->currentIndex() == 0 ? "" : ui->firstBox->currentText());
    dialog->dbSetup.setMiddleName(ui->middleBox->currentIndex() == 0 ? "" : ui->middleBox->currentText());
    dialog->dbSetup.setLastName(ui->lastBox->currentIndex() == 0 ? "" : ui->lastBox->currentText());
    dialog->dbSetup.setGrade(ui->gradeBox->currentIndex() == 0 ? "" : ui->gradeBox->currentText());
    dialog->dbSetup.setGender(ui->genderBox->currentText());

    dialog->dbSetup.clearQuestions();

    for(auto i = questionFields.begin(); i != questionFields.end(); ++i){
        QCheckBox *box = *i;

        if(box->isChecked()){
            dialog->dbSetup.addQuestion(box->text());
        }
    }
}
//------
// run()
//------
void CloseGeometryDialog::run()
{
  static log4cplus::Logger logger =
      log4cplus::Logger::getInstance("CloseGeometryDialog.run");

  using namespace SM_DECOMPOSE_NAMESPACE;

  for (int i = 0; i < _boxes.size(); ++i) {
    QCheckBox* box = _boxes[i];
    if (box->checkState() == Qt::Checked) {
      const string name = box->text().toStdString();
      cvcapp.listPropertyRemove("thumbnail.geometries", name);
      cvcapp.listPropertyRemove("zoomed.geometries", name);
      cvcapp.data(name, boost::any());
    }
  }
}
void LanguageChooser::checkBoxToggled()
{
    QCheckBox *checkBox = qobject_cast<QCheckBox *>(sender());
    MainWindow *window = mainWindowForCheckBoxMap[checkBox];
    if (!window) {
        QTranslator translator;
        translator.load(qmFileForCheckBoxMap[checkBox]);
        qApp->installTranslator(&translator);

        window = new MainWindow;
        window->setPalette(colorForLanguage(checkBox->text()));

        window->installEventFilter(this);
        mainWindowForCheckBoxMap.insert(checkBox, window);
    }
    window->setVisible(checkBox->isChecked());
}
Example #27
0
void SettingsDialog::reviewFileAssociation()
{
    int size = gridLayout->count();
    QCheckBox *cb;
    for(int i = 0; i < size; ++i){
        if (willExit)
            break;

        cb = dynamic_cast<QCheckBox*>(gridLayout->itemAt(i)->widget());
        if (cb) {
            //! before connect(). otherwise it will launch the function changeAssociation(bool).
            cb->setChecked(OSRelated::checkAssociation(cb->text()));
            connect(cb, SIGNAL(toggled(bool)), SLOT(changeAssociation(bool)));
        }
    }

    reviewCheckAllButtonState();
}
Example #28
0
/**
 * Returns xte checked pulse devicename
 */
QString QvkPulse::getPulseDeviceName( int value, QFrame *Pulseframe )
{
  QList<QCheckBox *> listQFrame = Pulseframe->findChildren<QCheckBox *>();
  QCheckBox *inBox;
  int x = 1;
  QString name;
  
  for ( int i = 0; i < listQFrame.count(); i++ )
  {
    inBox = listQFrame.at( i );
    if ( inBox->checkState() == Qt::Checked  )
    {
      if  ( x == value )
        name = inBox->text();
      x++;
    }
  }
  return name;
}
//void MainWindow::checkbox_clicked(QString joint_name)
void MainWindow::torque_checkbox_clicked(QWidget *widget)
{
  QCheckBox* checkBox = qobject_cast<QCheckBox*>(widget);
  if (!checkBox)  // this is just a safety check
    return;

  std::string joint_name = checkBox->text().toStdString();
  bool _is_on = checkBox->isChecked();

  QList<QAbstractSpinBox *> spinbox_list = joint_spinbox_map_[joint_name];

  for (int ix = 0; ix < spinbox_list.size(); ix++)
  {
    spinbox_list[ix]->setEnabled(_is_on);
  }

  publish_torque_msgs(joint_name, _is_on);

}
	void ItemHandlerCheckbox::Handle (const QDomElement& item,
			QWidget *pwidget)
	{
		QGridLayout *lay = qobject_cast<QGridLayout*> (pwidget->layout ());
		QCheckBox *box = new QCheckBox (XSD_->GetLabel (item));
		XSD_->SetTooltip (box, item);
		box->setObjectName (item.attribute ("property"));

		const QVariant& value = XSD_->GetValue (item);

		box->setCheckState (value.toBool () ? Qt::Checked : Qt::Unchecked);
		connect (box,
				SIGNAL (stateChanged (int)),
				this,
				SLOT (updatePreferences ()));

		box->setProperty ("ItemHandler", QVariant::fromValue<QObject*> (this));
		box->setProperty ("SearchTerms", QStringList (box->text ()));

		lay->addWidget (box, lay->rowCount (), 0, 1, 2, Qt::AlignTop);
	}