void TUIToggleBitmapButton::setValue(int type, covise::TokenBuffer &tb)
{
    if (type == TABLET_BOOL)
    {
        char state;
        tb >> state;
        bool bState = (bool)state;
        QCheckBox *b = (QCheckBox *)widget;
        b->setChecked(bState);
        if (b->isChecked())
        {
            QPixmap pm(downName);

            if (pm.isNull())
                b->setText(downName);
            else
                b->setIcon(pm);
        }
        else
        {
            QPixmap pm(upName);
            if (pm.isNull())
                b->setText(upName);
            else
                b->setIcon(pm);
        }
    }
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)" ));
            }
        }
    }
void TUIToggleBitmapButton::valueChanged(bool)
{
    QCheckBox *b = (QCheckBox *)widget;

    covise::TokenBuffer tb;
    tb << ID;
    if (b->isChecked())
    {
        tb << TABLET_ACTIVATED;
        QPixmap pm(downName);

        if (pm.isNull())
            b->setText(downName);
        else
            b->setIcon(pm);
    }
    else
    {
        tb << TABLET_DISACTIVATED;
        QPixmap pm(upName);
        if (pm.isNull())
            b->setText(upName);
        else
            b->setIcon(pm);
    }
    TUIMainWindow::getInstance()->send(tb);
}
Exemple #4
0
VPiano::VPiano(QWidget *parent)
    : QWidget(parent)
{
    QVBoxLayout *layout = new QVBoxLayout;
    QCheckBox *chkFlats = new QCheckBox(this);
    QCheckBox *chkLabels = new QCheckBox(this);
    QCheckBox *chkRaw = new QCheckBox(this);
    QSlider *slider = new QSlider(Qt::Horizontal, this);
    chkFlats->setText("Use Flats");
    chkLabels->setText("Show Labels");
    chkRaw->setText("Raw Keyboard");
    slider->setRange(1, 127);
    slider->setValue(100);
    QHBoxLayout *hbox = new QHBoxLayout;
    hbox->setSpacing(10);
    hbox->addWidget(chkLabels);
    hbox->addWidget(chkFlats);
    hbox->addWidget(chkRaw);
    hbox->addWidget(new QLabel("Velocity", this));
    hbox->addWidget(slider);
    connect(chkFlats, SIGNAL(toggled(bool)), SLOT(useFlats(bool)));
    connect(chkLabels, SIGNAL(toggled(bool)), SLOT(showLabels(bool)));
    connect(chkRaw, SIGNAL(toggled(bool)), SLOT(rawKeyboard(bool)));
    connect(slider, SIGNAL(valueChanged(int)), SLOT(velocity(int)));
    layout->addLayout(hbox);

    m_piano = new PianoKeybd(this);  // base octave = 3, num. octaves = 5

    /* set a color for pressed keys (default is QPalette::Highlight) */
    m_piano->setKeyPressedColor(Qt::red);

    /* m_piano = new PianoKeybd(2, 7, this); // ctor. with base and num. octaves */
    /* m_piano->setRotation(270);   // vertical orientation */
    m_piano->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);

    // Option 1: use signals and slots to connect the note events and handler methods
    // connect(m_piano, SIGNAL(noteOn(int)), SLOT(noteOn(int)));
    // connect(m_piano, SIGNAL(noteOff(int)), SLOT(noteOff(int)));

    // Option 2: use a PianoHandler class to provide the handler methods
    m_piano->setPianoHandler(this);

    layout->addWidget(m_piano);
    layout->setSpacing(1);
    layout->setContentsMargins(2,2,2,2);
    setLayout(layout);
    m_time.start();
}
Exemple #5
0
void PringKvitok::SetDb(db *mdb)
{
    myDB = mdb;
     ui->comboBox_groups->addItem("Выбрать все", "s_all");
    ui->comboBox_groups->addItem("Снять все", "d_all");
    QSqlQueryModel *groups = myDB->Query("SELECT * FROM groups WHERE id > 2");
    for(int i = 0; i < groups->rowCount(); i++){
         ui->comboBox_groups->addItem(groups->record(i).value("name").toString(), groups->record(i).value("id").toString());
    }

    childsCheckBox_map.clear();
   QString sql = "SELECT t0.id, t0.group_id, t0.fio,  t1.name AS group_name, t0.ls FROM childs t0";
    sql += " LEFT OUTER  JOIN groups  t1 ON t0.group_id = t1.id";
    QSqlQueryModel *childs = myDB->Query(sql);
    for(int i = 0; i < childs->rowCount(); i++){
          QString childs_id = childs->record(i).value("id").toString();
          ui->tW->insertRow(ui->tW->rowCount());
          ui->tW->setItem(ui->tW->rowCount() - 1, 1,new QTableWidgetItem(childs->record(i).value("fio").toString()));
          ui->tW->setItem(ui->tW->rowCount() - 1, 2,new QTableWidgetItem(childs->record(i).value("group_name").toString()));
          ui->tW->setItem(ui->tW->rowCount() - 1, 3,new QTableWidgetItem(childs_id));
          ui->tW->setItem(ui->tW->rowCount() - 1, 4,new QTableWidgetItem(childs->record(i).value("group_id").toString()));
          ui->tW->setItem(ui->tW->rowCount() - 1, 5,new QTableWidgetItem(childs->record(i).value("ls").toString()));
          QCheckBox *cb = new QCheckBox();
          cb->setText(childs_id);
          connect(cb , SIGNAL( toggled(bool) ), this, SLOT( on_childs_toggled(bool)) );
          childsCheckBox_map[childs_id] = cb;
          ui->tW->setCellWidget(ui->tW->rowCount() - 1, 0, cb);

     }
    delete groups;
    delete childs;

}
void DrugEnginesPreferences::setDataToUi()
{
    // Get all IDrugEngine objects
    QList<DrugsDB::IDrugEngine *> engines = pluginManager()->getObjects<DrugsDB::IDrugEngine>();
    QGridLayout *scrollLayout = qobject_cast<QGridLayout*>(ui->scrollAreaWidgetContents->layout());
    scrollLayout->setSpacing(24);
    for(int i=0; i < engines.count(); ++i) {
        DrugsDB::IDrugEngine *engine = engines.at(i);
        // Create widget
//        QWidget *w = new QWidget(this);
//        QGridLayout *l = new QGridLayout(w);
//        w->setLayout(l);
//        l->setMargin(0);
        // with checkbox
        QCheckBox *box = new QCheckBox(this);
        box->setText(engine->shortName() + ", " + engine->name());
        box->setToolTip(engine->tooltip());
        box->setChecked(engine->isActive());
        box->setIcon(engine->icon());
        // and a small explanation
//        QTextBrowser *browser = new QTextBrowser(w);
//        browser->setText(engines.at(i));
        scrollLayout->addWidget(box, i, 0);
        connect(box, SIGNAL(clicked(bool)), engine, SLOT(setActive(bool)));
    }
    QSpacerItem *s = new QSpacerItem(20,20, QSizePolicy::Expanding, QSizePolicy::Expanding);
    scrollLayout->addItem(s, engines.count()+1, 0);
}
EditContactEntryDialog::EditContactEntryDialog(data::ptr<data::ContactEntry> contactEntry, QList<data::ptr<data::ContactGroup>> contactGroups, QWidget* parent) :
    QDialog(parent),
    ui(new Ui::EditContactEntryDialog),
    m_contactEntry(contactEntry),
    m_contactGroups(contactGroups)
{
    ui->setupUi(this);
    setAttribute(Qt::WA_DeleteOnClose);

    VERIFY(connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject())));
    VERIFY(connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(onSaveButtonClicked())));

    ui->nameEdit->setText(contactEntry->getName());
    ui->nicknameEdit->setText(contactEntry->getNickname());
    ui->fileAsEdit->setText(contactEntry->getFileAs());
    ui->companyEdit->setText(contactEntry->getOrgName());
    ui->jobTitleEdit->setText(contactEntry->getOrgTitle());

    for (auto contactGroup : contactGroups)
    {
        /*if (contactGroup->isSystemGroup())
        {
            continue;
        }*/
        QCheckBox* checkBox = new QCheckBox(ui->groupsGroupBox);
        checkBox->setText(contactGroup->getTitle());
        ui->groupsGroupBoxLayout->insertWidget(ui->groupsGroupBoxLayout->count() - 1, checkBox);
        checkBox->setChecked(contactEntry->getContactGroups().contains(contactGroup));
        m_checkBoxesToContactGroups.insert(checkBox, contactGroup);
    }

    initPropertiesTreeWidget();
}
void DbFieldWidget::slotAddColumns(QStringList columns){
    ui->firstBox->addItems(columns);
    ui->middleBox->addItems(columns);
    ui->lastBox->addItems(columns);
    ui->gradeBox->addItems(columns);
    ui->genderBox->addItems(columns);

    QVBoxLayout *layout = new QVBoxLayout();
    QWidget *holder = new QWidget(ui->questionScrollArea);
    holder->setLayout(layout);

    questionFields.resize(columns.size());

    for(int i = 0; i < columns.size(); ++i){
        QCheckBox *box = new QCheckBox(holder);
        box->setText(columns.at(i));
        questionFields[i] = box;

        layout->addWidget(box);
    }

    ui->questionScrollArea->setWidget(holder);

    dialog->setButtonState(DatabaseDialog::BUTTON_FINISH, true);
}
    toSGATracePrefs(toTool *tool, QWidget* parent = 0, const char* name = 0)
            : QGroupBox(parent), toSettingTab("trace.html"), Tool(tool)
    {
        if (name)
            setObjectName(name);

        QVBoxLayout *vbox = new QVBoxLayout;
        vbox->setSpacing(6);
        vbox->setContentsMargins(11, 11, 11, 11);

        setLayout(vbox);

        setTitle(qApp->translate("toSGATracePrefs", "SGA Trace"));

        AutoUpdate = new QCheckBox(this);
        AutoUpdate->setText(qApp->translate("toSGATracePrefs", "&Auto update"));
        AutoUpdate->setToolTip(qApp->translate("toSGATracePrefs",
                                               "Update automatically after change of schema."));
        vbox->addWidget(AutoUpdate);

        QSpacerItem *spacer = new QSpacerItem(
            20,
            20,
            QSizePolicy::Minimum,
            QSizePolicy::Expanding);
        vbox->addItem(spacer);

//         if (!Tool->config(CONF_AUTO_UPDATE, "Yes").isEmpty())
//             AutoUpdate->setChecked(true);
        AutoUpdate->setChecked(toConfigurationSingle::Instance().autoUpdate());
    }
Exemple #10
0
void CellWidget::setCells(vector<CellTrack::Cell*> visable_cells, vector<CellTrack::Cell*> marked_cells)
{
	clearCells();
	m_cells = visable_cells;
	orderCells();
	int cell_num = m_cells.size();
	setLayoutItems(cell_num);
	set<CellTrack::Cell*> marked_cells_set(marked_cells.begin(), marked_cells.end());
	for(int i = 0; i < cell_num; i++)
	{
		CellTrack::Cell* cell = m_cells[i];
		QCheckBox* checker = m_checkers[i];
		QTextEdit* editor = m_editors[i];
		editor->setText(tr("<span style=\" color:#%1;\">%2</span>")
				.arg(getColorStr(cell->getColor()))
				.arg(cell->getSize()));
		checker->setText(tr("%1 : ").arg(cell->getTrack()->trackId() + 1));
		if(marked_cells_set.find(m_cells[i]) != marked_cells_set.end())
		{
			checker->setChecked(true);
		}
		else checker->setChecked(false);
		connect(checker,SIGNAL(stateChanged(int)), this, SLOT(onCellChecked(int)));
	}
}
VideoControl::VideoControl(Miro::Client & _client,
			   QWidget * _parent,
			   const char * _name)
  :  QDialog(_parent, _name)
{
  if ( !_name )
    setName( "QtVideoControl" );

  setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, sizePolicy().hasHeightForWidth() ) );
  QGridLayout * layout2 = new QGridLayout( this, 1, 1, 11, 6, "layout2"); 

  video_control_ = _client.resolveName<Video::CameraControl>(_name);
  Video::FeatureSetVector_var features;
  video_control_->getFeatureDescription(features);
  states_ = new FeatureState[features->length()];

  // create control widgets
  // connect them also
  QGridLayout * layout = new QGridLayout( 0, features->length(), 1, 0, 6, "layout");
  layout->setColStretch(1, 1);
  for (unsigned int i=0; i<features->length(); ++i) {
    
    if (features[i].hasAutoMode) {
      QCheckBox * checkBox = new QCheckBox( this, feature2Name(features[i].feature).c_str() );
      checkBox->setText("auto");
      layout->addWidget( checkBox, i, 0 );
      connect( checkBox, SIGNAL( stateChanged(int) ), this, SLOT( autoChange(int) ) );
    } else {
void CheckBoxListDelegate::setEditorData( QWidget *editor, const QModelIndex &index ) const
{
	//set editor data
	QCheckBox *myEditor = static_cast<QCheckBox*>(editor);
	myEditor->setText(index.data(Qt::DisplayRole).toString());
	myEditor->setChecked(index.data(Qt::UserRole).toBool());
}
/*
 * Alert box, with optional "don't show this message again" variable
 * and checkbox, and optional secondary text.
 */
void
simple_message_box(ESD_TYPE_E type, gboolean *notagain,
                   const char *secondary_msg, const char *msg_format, ...)
{
    if (notagain && *notagain) {
        return;
    }

    va_list ap;

    va_start(ap, msg_format);
    SimpleDialog sd(wsApp->mainWindow(), type, ESD_BTN_OK, msg_format, ap);
    va_end(ap);

    sd.setDetailedText(secondary_msg);

#if (QT_VERSION > QT_VERSION_CHECK(5, 2, 0))
    QCheckBox *cb = NULL;
    if (notagain) {
        cb = new QCheckBox();
        cb->setChecked(true);
        cb->setText(QObject::tr("Don't show this message again."));
        sd.setCheckBox(cb);
    }
#endif

    sd.exec();

#if (QT_VERSION > QT_VERSION_CHECK(5, 2, 0))
    if (notagain && cb) {
        *notagain = cb->isChecked();
    }
#endif
}
Exemple #14
0
void
WidgetVpzPropertyExpCond::refresh()
{
    // First, clear the current list content
    bool oldBlock = QListWidget::blockSignals(true);
    QListWidget::clear();
    QString dyn = mVpz->modelDynFromDoc(mModQuery);
    // TODO only way to see if it is an atomic model ??
    QDomNodeList conds = mVpz->condsListFromConds(mVpz->condsFromDoc());
    for (int i = 0; i < conds.length(); i++) {
        QDomNode cond = conds.at(i);
        QString condName = DomFunctions::attributeValue(cond, "name");
        QListWidgetItem* wi = new QListWidgetItem(this);
        QListWidget::addItem(wi);
        QCheckBox* cb = new QCheckBox(this);
        cb->setText(condName);
        if (mVpz->isAttachedCond(mModQuery, condName)) {
            cb->setCheckState(Qt::Checked);
        } else {
            cb->setCheckState(Qt::Unchecked);
        }
        QObject::connect(
          cb, SIGNAL(toggled(bool)), this, SLOT(onCheckboxToggle(bool)));
        QListWidget::setItemWidget(wi, cb);
    }
    QListWidget::blockSignals(oldBlock);
}
Exemple #15
0
void QwwTipWidgetPrivate::retranslateUi(){
    Q_Q(QwwTipWidget);
    m_check->setText(q->tr("Show tips on startup"));
    m_prev->setText(q->tr("&Prev"));
    m_next->setText(q->tr("&Next"));
    m_close->setText(q->tr("&Close"));
}
Exemple #16
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);
  }
}
Exemple #17
0
void Channels::showEvent(QShowEvent *event)
{
	pv::widgets::Popup::showEvent(event);

	const shared_ptr<sigrok::Device> device = session_.device()->device();
	assert(device);

	// Update group labels
	for (auto& entry : device->channel_groups()) {
		const shared_ptr<ChannelGroup> group = entry.second;

		try {
			QLabel* label = group_label_map_.at(group);
			label->setText(QString("<h3>%1</h3>").arg(group->name().c_str()));
		} catch (out_of_range&) {
			// Do nothing
		}
	}

	updating_channels_ = true;

	for (auto& entry : check_box_signal_map_) {
		QCheckBox *cb = entry.first;
		const shared_ptr<SignalBase> sig = entry.second;
		assert(sig);

		// Update the check box
		cb->setChecked(sig->enabled());
		cb->setText(sig->display_name());
	}

	updating_channels_ = false;
}
Exemple #18
0
QWidget *DayView::createConfigWidget( QWidget *owner ) {
    QGroupBox *GroupBox4 = new QGroupBox( owner, "GroupBox4" );
    GroupBox4->setTitle( tr( "Day" ) );
    GroupBox4->setColumnLayout(0, Qt::Vertical );
    GroupBox4->layout()->setSpacing( 0 );
    GroupBox4->layout()->setMargin( 0 );
    QVBoxLayout *GroupBox4Layout = new QVBoxLayout( GroupBox4->layout() );
    GroupBox4Layout->setAlignment( Qt::AlignTop );
    GroupBox4Layout->setSpacing( 6 );
    GroupBox4Layout->setMargin( 11 );

    QCheckBox *chkJumpToCurTime = new QCheckBox( GroupBox4, "chkJumpToCurTime" );
    chkJumpToCurTime->setText( tr( "Jump to current time" ) );
    GroupBox4Layout->addWidget( chkJumpToCurTime );

    QHBoxLayout *Layout5_2 = new QHBoxLayout;
    Layout5_2->setSpacing( 6 );
    Layout5_2->setMargin( 0 );

    QLabel *TextLabel1 = new QLabel( GroupBox4, "TextLabel1" );
    TextLabel1->setText( tr( "Row style:" ) );
    Layout5_2->addWidget( TextLabel1 );

    QComboBox *comboRowStyle = new QComboBox( FALSE, GroupBox4, "comboRowStyle" );
    comboRowStyle->insertItem( tr( "Default" ) );
    comboRowStyle->insertItem( tr( "Medium" ) );
    comboRowStyle->insertItem( tr( "Large" ) );
    Layout5_2->addWidget( comboRowStyle );
    GroupBox4Layout->addLayout( Layout5_2 );

    chkJumpToCurTime->setChecked( jumpToCurTime );
    comboRowStyle->setCurrentItem( rowStyle );

    return GroupBox4;
}
/*!
 * \brief Shows a notification about PGE Engine alpha-testing
 * \param parent Pointer to parent main window
 */
static void pge_engine_alphatestingNotify(MainWindow *parent)
{
    /************************Alpha-testing notify*****************************/
    QSettings cCounters(AppPathManager::settingsFile(), QSettings::IniFormat);
    cCounters.setIniCodec("UTF-8");
    cCounters.beginGroup("message-boxes");
    bool showNotice = cCounters.value("pge-engine-test-launch", true).toBool();
    if(showNotice)
    {
        QMessageBox msg(parent);
        msg.setWindowTitle(MainWindow::tr("PGE Engine testing"));
        msg.setWindowIcon(parent->windowIcon());
        QCheckBox box;
        box.setText(MainWindow::tr("Don't show this message again."));
        msg.setCheckBox(&box);
        msg.setText(MainWindow::tr("Hello! You are attempting to test a level in the PGE Engine.\n"
                                   "The PGE Engine is still at an early stage in development, and there "
                                   "are several features which are missing or do not work correctly. "
                                   "If you are making levels or episodes for the old SMBX Engine and you "
                                   "want to test them with a complete feature-set, please test them in "
                                   "SMBX directly. Use PGE Testing for cases when you want to test the "
                                   "PGE Engine itself or you want to test levels with PGE-specific features.")
                   );
        msg.setStandardButtons(QMessageBox::Ok);
        msg.setWindowModality(Qt::WindowModal);
        msg.exec();
        showNotice = !box.isChecked();
    }
    cCounters.setValue("pge-engine-test-launch", showNotice);
    cCounters.endGroup();
    /************************Alpha-testing notify*****************************/
}
/**
 * Add a site to the list.
 */
void sourcesWindow::addCheckboxes()
{
	QSettings settings(savePath("settings.ini"), QSettings::IniFormat);
	QString t = settings.value("Sources/Types", "icon").toString();

	QStringList k = m_sites->keys();
	for (int i = 0; i < k.count(); i++)
	{
		QCheckBox *check = new QCheckBox();
			check->setChecked(m_selected[i]);
			check->setText(k.at(i));
			connect(check, SIGNAL(stateChanged(int)), this, SLOT(checkUpdate()));
			m_checks << check;
			ui->gridLayout->addWidget(check, i, 0);

		int n = 1;
		if (t != "hide")
		{
			if (t == "icon" || t == "both")
			{
				QLabel *image = new QLabel();
				image->setPixmap(QPixmap(savePath("sites/"+m_sites->value(k.at(i))->type()+"/icon.png")));
				ui->gridLayout->addWidget(image, i, n);
				m_labels << image;
				n++;
			}
			if (t == "text" || t == "both")
			{
				QLabel *type = new QLabel(m_sites->value(k.at(i))->value("Name"));
				ui->gridLayout->addWidget(type, i, n);
				m_labels << type;
				n++;
			}
		}

		QBouton *del = new QBouton(k.at(i));
			del->setText(tr("Options"));
			connect(del, SIGNAL(appui(QString)), this, SLOT(settingsSite(QString)));
			m_buttons << del;
			ui->gridLayout->addWidget(del, i, n);
	}

	/*int n =  0+(t == "icon" || t == "both")+(t == "text" || t == "both");
	for (int i = 0; i < m_checks.count(); i++)
	{
		ui->gridLayout->addWidget(m_checks.at(i), i, 0);
		m_checks.at(i)->show();
		if (!m_labels.isEmpty())
		{
			for (int r = 0; r < n; r++)
			{
				ui->gridLayout->addWidget(m_labels.at(i*n+r), i*n+r, 1);
				m_labels.at(i*n+r)->show();
			}
		}
		ui->gridLayout->addWidget(m_buttons.at(i), i, n+1);
		m_buttons.at(i)->show();
	}*/
}
Exemple #21
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;
}
Exemple #22
0
void Window::createDoubleSpinBoxes() {
  doubleSpinBoxesGroup = new QGroupBox(tr("Double precision spinboxes"));

  QLabel *precisionLabel = new QLabel(tr("Number of decimal places to show:"));
  QSpinBox *precisionSpinBox = new QSpinBox;
  precisionSpinBox->setRange(0, 100);
  precisionSpinBox->setValue(2);

  QLabel *doubleLabel =
      new QLabel(tr("Enter a value between %1 and %2:").arg(-20).arg(20));
  doubleSpinBox = new QDoubleSpinBox;
  doubleSpinBox->setRange(-20.0, 20.0);
  doubleSpinBox->setSingleStep(1.0);
  doubleSpinBox->setValue(0.0);

  QLabel *scaleLabel = new QLabel(
      tr("Enter a scale factor between %1 and %2:").arg(0).arg(1000.0));
  scaleSpinBox = new QDoubleSpinBox;
  scaleSpinBox->setRange(0.0, 1000.0);
  scaleSpinBox->setSingleStep(10.0);
  scaleSpinBox->setSuffix("%");
  scaleSpinBox->setSpecialValueText(tr("No scaling"));
  scaleSpinBox->setValue(100.0);

  QLabel *priceLabel =
      new QLabel(tr("Enter a price between %1 and %2:").arg(0).arg(1000));
  priceSpinBox = new QDoubleSpinBox;
  priceSpinBox->setRange(0.0, 1000.0);
  priceSpinBox->setSingleStep(1.0);
  priceSpinBox->setPrefix(tr("$"));
  priceSpinBox->setValue(99.99);
  connect(precisionSpinBox, SIGNAL(valueChanged(int)), this,
          SLOT(changePrecision(int)));

  groupSeparatorSpinBox_d = new QDoubleSpinBox;
  groupSeparatorSpinBox_d->setRange(-99999999, 99999999);
  groupSeparatorSpinBox_d->setDecimals(2);
  groupSeparatorSpinBox_d->setValue(1000.00);
  groupSeparatorSpinBox_d->setGroupSeparatorShown(true);
  QCheckBox *groupSeparatorChkBox = new QCheckBox;
  groupSeparatorChkBox->setText(tr("Show group separator"));
  groupSeparatorChkBox->setChecked(true);
  connect(groupSeparatorChkBox, &QCheckBox::toggled, groupSeparatorSpinBox_d,
          &QDoubleSpinBox::setGroupSeparatorShown);

  QVBoxLayout *spinBoxLayout = new QVBoxLayout;
  spinBoxLayout->addWidget(precisionLabel);
  spinBoxLayout->addWidget(precisionSpinBox);
  spinBoxLayout->addWidget(doubleLabel);
  spinBoxLayout->addWidget(doubleSpinBox);
  spinBoxLayout->addWidget(scaleLabel);
  spinBoxLayout->addWidget(scaleSpinBox);
  spinBoxLayout->addWidget(priceLabel);
  spinBoxLayout->addWidget(priceSpinBox);
  spinBoxLayout->addWidget(groupSeparatorChkBox);
  spinBoxLayout->addWidget(groupSeparatorSpinBox_d);
  doubleSpinBoxesGroup->setLayout(spinBoxLayout);
}
void NetworkManager::authentication(QNetworkReply* reply, QAuthenticator* auth)
{
    QDialog* dialog = new QDialog(p_QupZilla);
    dialog->setWindowTitle(tr("Authorization required"));

    QFormLayout* formLa = new QFormLayout(dialog);

    QLabel* label = new QLabel(dialog);
    QLabel* userLab = new QLabel(dialog);
    QLabel* passLab = new QLabel(dialog);
    userLab->setText(tr("Username: "******"Password: "******"Save username and password on this site"));
    pass->setEchoMode(QLineEdit::Password);

    QDialogButtonBox* box = new QDialogButtonBox(dialog);
    box->addButton(QDialogButtonBox::Ok);
    box->addButton(QDialogButtonBox::Cancel);
    connect(box, SIGNAL(rejected()), dialog, SLOT(reject()));
    connect(box, SIGNAL(accepted()), dialog, SLOT(accept()));

    label->setText(tr("A username and password are being requested by %1. "
                      "The site says: \"%2\"").arg(reply->url().toEncoded(), Qt::escape(auth->realm())));
    formLa->addRow(label);

    formLa->addRow(userLab, user);
    formLa->addRow(passLab, pass);
    formLa->addRow(save);

    formLa->addWidget(box);
    AutoFillModel* fill = mApp->autoFill();
    if (fill->isStored(reply->url())) {
        save->setChecked(true);
        user->setText(fill->getUsername(reply->url()));
        pass->setText(fill->getPassword(reply->url()));
    }
    emit wantsFocus(reply->url());

    //Do not save when private browsing is enabled
    if (mApp->webSettings()->testAttribute(QWebSettings::PrivateBrowsingEnabled)) {
        save->setVisible(false);
    }

    if (dialog->exec() != QDialog::Accepted) {
        return;
    }

    auth->setUser(user->text());
    auth->setPassword(pass->text());

    if (save->isChecked()) {
        fill->addEntry(reply->url(), user->text(), pass->text());
    }
}
void DataSelectionScreen::addItem(QString name)
{
	QCheckBox *box = new QCheckBox(this);
	ui.scrollAreaWidgetContents->layout()->addWidget(box);
	box->setText(name);
	connect(box,SIGNAL(clicked(bool)),this,SLOT(checkBoxClicked(bool)));
	box->show();
    m_itemList.append(box);
}
void SensorsDialog::setupCheckbox(int index, QString name, bool checked)
{
    QCheckBox *cb = getCheckboxPtr(index);

    if (cb != NULL) {
        cb->setText(name);
        cb->setChecked(checked);
    }
}
void TestQTestComplex::pl_checkbox_text()
{
    QCheckBox *cb = new QCheckBox();

    cb->setObjectName("cb");
    cb->setText("Let's cause a memory leak!");

    delete cb;
}
void SensorsDialog::disableCheckbox(int index)
{
    QCheckBox *cb = getCheckboxPtr(index);

    if (cb != NULL) {
        cb->setText("");
        cb->setEnabled(false);
        cb->setVisible(false);
    }
}
Exemple #28
0
QWidget* DSiNo::createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const
{
 QCheckBox *editor = new QCheckBox( parent );
 editor->setText( index.model()->headerData( index.column(), Qt::Horizontal ).toString() );
 editor->setTristate( false );
 editor->setPalette( option.palette );
 editor->setFont( option.font );
 editor->setBackgroundRole( QPalette::Background );
 return editor;
}
void oprof_start::setup_unit_masks(op_event_descr const & descr)
{
#define OP_MAX_HANDLED_UMS 16
	op_unit_mask const * um = descr.unit;

	hide_masks();

	if (!um || um->unit_type_mask == utm_mandatory)
		return;

	if (um->num > OP_MAX_HANDLED_UMS) {
		ostringstream error;

		error << "Number of unit masks (" << um->num << ") is greater than max allowed ("
		      << OP_MAX_HANDLED_UMS << ").";
		QMessageBox::warning(this, 0, error.str().c_str());
		return;
	}


	event_setting & cfg = event_cfgs[descr.name];

	unit_mask_group->setExclusive(um->unit_type_mask == utm_exclusive);

	for (size_t i = 0; i < OP_MAX_HANDLED_UMS; ++i) {
		QCheckBox * check = 0;
		switch (i) {
			case 0: check = check0; break;
			case 1: check = check1; break;
			case 2: check = check2; break;
			case 3: check = check3; break;
			case 4: check = check4; break;
			case 5: check = check5; break;
			case 6: check = check6; break;
			case 7: check = check7; break;
			case 8: check = check8; break;
			case 9: check = check9; break;
			case 10: check = check10; break;
			case 11: check = check11; break;
			case 12: check = check12; break;
			case 13: check = check13; break;
			case 14: check = check14; break;
			case 15: check = check15; break;
		}
		check->setText(um->um[i].desc);
		if (um->unit_type_mask == utm_exclusive)
			check->setChecked(cfg.umask == um->um[i].value);
		else
			check->setChecked(cfg.umask & um->um[i].value);

		check->show();
	}
	unit_mask_group->setMinimumSize(unit_mask_group->sizeHint());
	setup_config_tab->setMinimumSize(setup_config_tab->sizeHint());
}
void Qt4TargetSetupWidget::addBuildConfigurationInfo(const BuildConfigurationInfo &info, bool importing)
{
    if (importing) {
        if (!m_haveImported) {
            // disable everything on first import
            for (int i = 0; i < m_enabled.count(); ++i) {
                m_enabled[i] = false;
                m_checkboxes[i]->setChecked(false);
            }
            m_selected = 0;
        }

        m_haveImported = true;
    }
    int pos = m_pathChoosers.count();
    m_enabled.append(true);
    ++m_selected;

    m_infoList.append(info);

    QCheckBox *checkbox = new QCheckBox;
    checkbox->setText(Qt4BuildConfigurationFactory::buildConfigurationDisplayName(info));
    checkbox->setChecked(m_enabled.at(pos));
    checkbox->setAttribute(Qt::WA_LayoutUsesWidgetRect);
    m_newBuildsLayout->addWidget(checkbox, pos * 2, 0);

    Utils::PathChooser *pathChooser = new Utils::PathChooser();
    pathChooser->setExpectedKind(Utils::PathChooser::Directory);
    pathChooser->setPath(info.directory);
    QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(m_profile);
    if (!version)
        return;
    pathChooser->setReadOnly(!version->supportsShadowBuilds() || importing);
    m_newBuildsLayout->addWidget(pathChooser, pos * 2, 1);

    QLabel *reportIssuesLabel = new QLabel;
    reportIssuesLabel->setIndent(32);
    m_newBuildsLayout->addWidget(reportIssuesLabel, pos * 2 + 1, 0, 1, 2);
    reportIssuesLabel->setVisible(false);

    connect(checkbox, SIGNAL(toggled(bool)),
            this, SLOT(checkBoxToggled(bool)));

    connect(pathChooser, SIGNAL(changed(QString)),
            this, SLOT(pathChanged()));

    m_checkboxes.append(checkbox);
    m_pathChoosers.append(pathChooser);
    m_reportIssuesLabels.append(reportIssuesLabel);

    m_issues.append(false);
    reportIssues(pos);

    emit selectedToggled();
}