Example #1
0
void AssociationsDialog::updateTable(int index)
{
	Table *t = findTable(index);
	if (!t)
		return;

	if (active_table != t){
		active_table = t;
		tableCaptionLabel->setText(t->objectName());
		table->clearContents();
		table->setRowCount(t->numCols());

		QStringList colNames = t->colNames();
		for (int i=0; i<table->rowCount(); i++ ){
			QTableWidgetItem *cell = new QTableWidgetItem(colNames[i].replace(",", "."));
			cell->setBackground (QBrush(Qt::lightGray));
			cell->setFlags (Qt::ItemIsEnabled);
			table->setItem(i, 0, cell);
			}

		for (int j=1; j < table->columnCount(); j++){
			for (int i=0; i < table->rowCount(); i++ )
				{
				QTableWidgetItem *cell = new QTableWidgetItem();
				cell->setBackground (QBrush(Qt::lightGray));
				table->setItem(i, j, cell);

				QCheckBox* cb = new QCheckBox(table);
				cb->installEventFilter(this);
				table->setCellWidget(i, j, cb);
				}
			}
		}
	updateColumnTypes();
}
Example #2
0
void FilterWindow::updateDefaultFiltersActivation(const QModelIndex & topLeft, const QModelIndex & bottomRight, const QVector<int> & roles)
{
    Q_UNUSED(topLeft);
    Q_UNUSED(bottomRight);
    Q_UNUSED(roles);

    QList<FilterData> allFilters = m_pFilterDataModel->data(m_pFilterDataModel->index(0,9), FilterDataModelRoles::GetAllFilters).value<QList<FilterData> >();

    if(m_lActivationCheckBoxList.size()==allFilters.size())
        return;

    while(!ui->m_layout_defaultFilterActivation->isEmpty())
        ui->m_layout_defaultFilterActivation->removeItem(ui->m_layout_defaultFilterActivation->itemAt(0));

    m_lActivationCheckBoxList.clear();

    for(int i = 0; i<allFilters.size(); i++) {
        //Check for user designed filter. This needs to be done because there only should be one filter in the model which holds the user designed filter.
        //Otherwise everytime a filter is designed a new filter would be added to this model -> too much storage consumption.
        if(allFilters.at(i).m_sName != "User Design") {
            QCheckBox *checkBox = new QCheckBox(allFilters.at(i).m_sName);
            connect(checkBox,&QCheckBox::toggled,
                        this,&FilterWindow::onChkBoxFilterActivation);

            checkBox->installEventFilter(this);

            m_lActivationCheckBoxList.append(checkBox);

            ui->m_layout_defaultFilterActivation->addWidget(checkBox);
        } else {
            QCheckBox *checkBox = new QCheckBox("Activate user designed filter");
            connect(checkBox,&QCheckBox::toggled,
                        this,&FilterWindow::onChkBoxFilterActivation);

            checkBox->installEventFilter(this);

            m_lActivationCheckBoxList.prepend(checkBox);

            ui->m_layout_designFilter->addWidget(checkBox,6,0,2,2);
        }
    }

    emit activationCheckBoxListChanged(m_lActivationCheckBoxList);
}
QWidget *DelegateInfoCheckBox::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
    if(index.column() == 0){
        return NULL;
    }

    QCheckBox *editor = new QCheckBox(parent);
    editor->installEventFilter(const_cast<DelegateInfoCheckBox*>(this));

//     return editor;
    return NULL;
}
Example #4
0
QCheckBox *OptionsPopup::createCheckboxForCommand(Id id)
{
    QAction *action = ActionManager::command(id)->action();
    QCheckBox *checkbox = new QCheckBox(action->text());
    checkbox->setToolTip(action->toolTip());
    checkbox->setChecked(action->isChecked());
    checkbox->setEnabled(action->isEnabled());
    checkbox->installEventFilter(this); // enter key handling
    QObject::connect(checkbox, &QCheckBox::clicked, action, &QAction::setChecked);
    QObject::connect(action, &QAction::changed, this, &OptionsPopup::actionChanged);
    m_checkboxMap.insert(action, checkbox);
    return checkbox;
}