Esempio n. 1
0
void AbstractProfilePolygonItem::setVerticalAxis(DiveCartesianAxis *vertical)
{
	vAxis = vertical;
	connect(vAxis, SIGNAL(sizeChanged()), this, SLOT(modelDataChanged()));
	connect(vAxis, SIGNAL(maxChanged()), this, SLOT(modelDataChanged()));
	modelDataChanged();
}
Esempio n. 2
0
void AbstractProfilePolygonItem::setModel(DivePlotDataModel *model)
{
	dataModel = model;
	connect(dataModel, SIGNAL(dataChanged(QModelIndex, QModelIndex)), this, SLOT(modelDataChanged(QModelIndex, QModelIndex)));
	connect(dataModel, SIGNAL(rowsAboutToBeRemoved(QModelIndex, int, int)), this, SLOT(modelDataRemoved(QModelIndex, int, int)));
	modelDataChanged();
}
Esempio n. 3
0
void TankItem::setData(DivePlotDataModel *model, struct plot_info *plotInfo, struct dive *d)
{
	free(pInfoEntry);
	// the plotInfo and dive structures passed in could become invalid before we stop using them,
	// so copy the data that we need
	int size = plotInfo->nr * sizeof(plotInfo->entry[0]);
	pInfoEntry = (struct plot_data *)malloc(size);
	pInfoNr = plotInfo->nr;
	memcpy(pInfoEntry, plotInfo->entry, size);
	copy_cylinders(d, &diveCylinderStore, false);
	dataModel = model;
	connect(dataModel, SIGNAL(dataChanged(QModelIndex, QModelIndex)), this, SLOT(modelDataChanged(QModelIndex, QModelIndex)), Qt::UniqueConnection);
	modelDataChanged();
}
Esempio n. 4
0
  void CnetEditorWidget::createPointTableView() {
    m_pointTableModel = new PointTableModel(m_pointModel);
    m_pointTableView = new TableView(m_pointTableModel, *m_settingsPath,
        "m_pointTableView");
    m_pointTableView->setWhatsThis("<html>Each row in the table is a control "
        "point.  Each column in the table is an attribute of a control "
        "point.<br/><br/>Cells that are gray are not editable.</html>");
    connect(m_pointTableView, SIGNAL(modelDataChanged()),
            this, SIGNAL(cnetModified()));

    connect(m_pointTreeView, SIGNAL(selectionChanged()),
            m_pointTableView, SLOT(handleModelSelectionChanged()));
    connect(m_pointTableView, SIGNAL(selectionChanged()),
            m_pointTreeView, SLOT(handleModelSelectionChanged()));

    connect(m_pointTableView,
            SIGNAL(rebuildModels(QList< CnetViz::AbstractTreeItem * >)),
            this,
            SLOT(rebuildModels(QList< CnetViz::AbstractTreeItem * >)));

    connect(m_pointTableView, SIGNAL(filterCountsChanged(int,int)),
            this, SLOT(handlePointTableFilterCountsChanged(int,int)));

    for (int i = 0; i < AbstractPointItem::COLS; i++) {
      QAction * act = new QAction(
          AbstractPointItem::getColumnName((AbstractPointItem::Column) i), this);
      act->setCheckable(true);
      connect(act, SIGNAL(toggled(bool)), this, SLOT(pointColToggled()));
      m_pointTableView->getHorizontalHeader()->addAction(act);
    }

    m_pointTableView->getHorizontalHeader()->setContextMenuPolicy(
        Qt::ActionsContextMenu);
  }
Esempio n. 5
0
void DiveProfileItem::settingsChanged()
{
	//TODO: Only modelDataChanged() here if we need to rebuild the graph ( for instance,
	// if the prefs.dcceiling are enabled, but prefs.redceiling is disabled
	// and only if it changed something. let's not waste cpu cycles repoloting something we don't need to.
	modelDataChanged();
}
Esempio n. 6
0
MainWindow::MainWindow()
{
	QAction *exitAct = new QAction(tr("E&xit"), this);
	exitAct->setShortcuts(QKeySequence::Quit);
	connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));

	QMenu *fileMenu = menuBar()->addMenu(tr("&File"));
	fileMenu->addSeparator();
	fileMenu->addAction(exitAct);

	columnsMenu = menuBar()->addMenu(tr("&Columns"));
	connect(columnsMenu, SIGNAL(aboutToShow()), this, SLOT(showColumnsMenu()));

	model = new PeerDrive::FolderModel(this);
	connect(model, SIGNAL(rowsInserted(QModelIndex,int,int)), this,
		SLOT(modelRowsInserted(QModelIndex,int,int)));
	connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this,
		SLOT(modelDataChanged(QModelIndex,QModelIndex)));
	connect(model, SIGNAL(modelReset()), this, SLOT(modelReset()));

	treeView = new QTreeView;
	treeView->setModel(model);
	treeView->sortByColumn(0, Qt::AscendingOrder);
	treeView->setSortingEnabled(true);
	connect(treeView, SIGNAL(activated(QModelIndex)), this,
		SLOT(itemActivated(QModelIndex)));

	setCentralWidget(treeView);
	setWindowTitle(QObject::tr("Simple Tree Model"));
	setUnifiedTitleAndToolBarOnMac(true);
}
Esempio n. 7
0
void TableView::refresh()
{
  modelDataChanged
    (model_->index(0, 0),
     model_->index(model_->columnCount() - 1, model_->rowCount() - 1));

  Panel::refresh();
}
Esempio n. 8
0
void YearlyStatisticsWidget::setModel(YearlyStatisticsModel *m)
{
	m_model = m;
	connect(m, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
			this, SLOT(modelDataChanged(QModelIndex,QModelIndex)));
	connect(m, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)),
			scene(), SLOT(clear()));
	connect(m, SIGNAL(rowsInserted(QModelIndex,int,int)),
			this, SLOT(modelRowsInserted(QModelIndex,int,int)));

	modelRowsInserted(QModelIndex(),0,m_model->rowCount()-1);
}
void HistoryGraph::setProject(ProjectPtr a_Project, HistoryModel * a_Model, QItemSelectionModel * a_Selection)
{
	m_Project = a_Project;
	m_Model = a_Model;
	m_Selection = a_Selection;

	// Set up UI update handlers:
	connect(a_Model,     SIGNAL(modelDataChanged()),                              this, SLOT(projectDataChanged()));
	connect(m_Selection, SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(selectionChanged()));

	projectDataChanged();
}
Esempio n. 10
0
void BasketModel::setPassword(QModelIndex idx, QString newPassword)
{
    if ( !idx.isValid() )
        return;

    if ( BasketBaseItem *item = static_cast<BasketBaseItem *>(idx.internalPointer()) ) {
        BasketUtils butil;
        item->setEncryptedPassword(butil.crypt(newPassword, hashPassword));
        emit dataChanged(index(idx.row(), 0, idx.parent()), index(idx.row(), 2, idx.parent()));
        emit modelDataChanged();
    }

}
Esempio n. 11
0
void QgsGraduatedSymbolRendererWidget::disconnectUpdateHandlers()
{
  disconnect( spinGraduatedClasses, SIGNAL( valueChanged( int ) ), this, SLOT( classifyGraduated() ) );
  disconnect( cboGraduatedMode, SIGNAL( currentIndexChanged( int ) ), this, SLOT( classifyGraduated() ) );
  disconnect( btnColorRamp, &QgsColorRampButton::colorRampChanged, this, &QgsGraduatedSymbolRendererWidget::reapplyColorRamp );
  disconnect( spinPrecision, SIGNAL( valueChanged( int ) ), this, SLOT( labelFormatChanged() ) );
  disconnect( cbxTrimTrailingZeroes, SIGNAL( toggled( bool ) ), this, SLOT( labelFormatChanged() ) );
  disconnect( txtLegendFormat, SIGNAL( textChanged( QString ) ), this, SLOT( labelFormatChanged() ) );
  disconnect( minSizeSpinBox, SIGNAL( valueChanged( double ) ), this, SLOT( reapplySizes() ) );
  disconnect( maxSizeSpinBox, SIGNAL( valueChanged( double ) ), this, SLOT( reapplySizes() ) );

  disconnect( mModel, SIGNAL( rowsMoved() ), this, SLOT( rowsMoved() ) );
  disconnect( mModel, SIGNAL( dataChanged( QModelIndex, QModelIndex ) ), this, SLOT( modelDataChanged() ) );
}
Esempio n. 12
0
bool BasketModel::changePassword(QString newPassword)
{
    beginResetModel();
    if ( hash().isEmpty() ) {
        hashPassword = newPassword;
        endResetModel();
        return true;
    }
    changeItemPassword(rootItem, newPassword);
    hashPassword = newPassword;
    endResetModel();

    emit modelDataChanged();

    return true;
}
void SchedulerDayModel::reloadData() {
	QList<QObject *> list;
	QList<QString> activeSchedulerJobInstances;
	for(int a = 0; a < d->model->rowCount(); ++a) {
		SchedulerJob *schedulerJob = qvariant_cast<SchedulerJob*>(d->model->index(a, 0).data());
		if (!schedulerJob) {
			continue;
		}
		QStringList weekdays = schedulerJob->weekdays().split(",");
		for(int b = 0; b < weekdays.size(); ++b) {
			SchedulerJobInstance *schedulerJobInstance = this->findSchedulerJobInstance(schedulerJob->schedulerJobId(), weekdays.at(b).toInt() - 1);
			if (!schedulerJobInstance) {
				schedulerJobInstance = new SchedulerJobInstance(this);
				schedulerJobInstance->setSchedulerJobId(schedulerJob->schedulerJobId());
				schedulerJobInstance->setWeekday(weekdays.at(b).toInt() - 1);
				list << schedulerJobInstance;
			}
			schedulerJobInstance->setDeviceId(schedulerJob->deviceId());
			schedulerJobInstance->setMethod(schedulerJob->method());
			schedulerJobInstance->setHour(schedulerJob->hour());
			schedulerJobInstance->setMinute(schedulerJob->minute());
			schedulerJobInstance->setOffset(schedulerJob->offset());
			schedulerJobInstance->setRandomInterval(schedulerJob->randomInterval());
			schedulerJobInstance->setRetries(schedulerJob->retries());
			schedulerJobInstance->setRetryInterval(schedulerJob->retryInterval());
			schedulerJobInstance->setType(schedulerJob->type());
			schedulerJobInstance->setRunTimeToday(schedulerJob->runTimeToday());
			schedulerJobInstance->setActive(schedulerJob->active());
			activeSchedulerJobInstances << QString::number(schedulerJobInstance->schedulerJobId()) + "_" + QString::number(schedulerJobInstance->weekday());
		}
	}
	if (list.size()) {
		//Appends all in one go
		this->append(list);
	}
	for(int j=0; j < activeSchedulerJobInstances.count(); ++j) {
		for(int i = 0; i < this->rowCount(); ++i) {
			SchedulerJobInstance *schedulerJobInstance = qobject_cast<SchedulerJobInstance *>(this->get(i).value<QObject *>());
			if (activeSchedulerJobInstances.indexOf(QString::number(schedulerJobInstance->schedulerJobId()) + "_" + QString::number(schedulerJobInstance->weekday())) == -1) {
				this->splice(i, 1);
			}
		}
	}
	emit modelDataChanged();

}
void QgsGraduatedSymbolRendererV2Widget::connectUpdateHandlers()
{
  connect( spinGraduatedClasses, SIGNAL( valueChanged( int ) ), this, SLOT( classifyGraduated() ) );
  connect( cboGraduatedMode, SIGNAL( currentIndexChanged( int ) ), this, SLOT( classifyGraduated() ) );
  connect( cboGraduatedColorRamp, SIGNAL( currentIndexChanged( int ) ), this, SLOT( reapplyColorRamp() ) );
  connect( cboGraduatedColorRamp, SIGNAL( sourceRampEdited() ), this, SLOT( reapplyColorRamp() ) );
  connect( mButtonEditRamp, SIGNAL( clicked() ), cboGraduatedColorRamp, SLOT( editSourceRamp() ) );
  connect( cbxInvertedColorRamp, SIGNAL( toggled( bool ) ), this, SLOT( reapplyColorRamp() ) );
  connect( spinPrecision, SIGNAL( valueChanged( int ) ), this, SLOT( labelFormatChanged() ) );
  connect( cbxTrimTrailingZeroes, SIGNAL( toggled( bool ) ), this, SLOT( labelFormatChanged() ) );
  connect( txtLegendFormat, SIGNAL( textChanged( QString ) ), this, SLOT( labelFormatChanged() ) );
  connect( minSizeSpinBox, SIGNAL( valueChanged( double ) ), this, SLOT( reapplySizes() ) );
  connect( maxSizeSpinBox, SIGNAL( valueChanged( double ) ), this, SLOT( reapplySizes() ) );

  connect( mModel, SIGNAL( rowsMoved() ), this, SLOT( rowsMoved() ) );
  connect( mModel, SIGNAL( dataChanged( QModelIndex, QModelIndex ) ), this, SLOT( modelDataChanged() ) );
}
Esempio n. 15
0
void UatDialog::setUat(epan_uat *uat)
{
    QString title(tr("Unknown User Accessible Table"));

    uat_ = uat;

    ui->pathLabel->clear();
    ui->pathLabel->setEnabled(false);
    help_button_->setEnabled(false);

    if (uat_) {
        if (uat_->name) {
            title = uat_->name;
        }

        QString abs_path = gchar_free_to_qstring(uat_get_actual_filename(uat_, FALSE));
        ui->pathLabel->setText(abs_path);
        ui->pathLabel->setUrl(QUrl::fromLocalFile(abs_path).toString());
        ui->pathLabel->setToolTip(tr("Open ") + uat->filename);
        ui->pathLabel->setEnabled(true);

        uat_model_ = new UatModel(NULL, uat);
        uat_delegate_ = new UatDelegate;
        ui->uatTreeView->setModel(uat_model_);
        ui->uatTreeView->setItemDelegate(uat_delegate_);

        connect(uat_model_, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
                this, SLOT(modelDataChanged(QModelIndex)));
        connect(ui->uatTreeView, SIGNAL(currentItemChanged(QModelIndex,QModelIndex)),
                this, SLOT(viewCurrentChanged(QModelIndex,QModelIndex)));
        ok_button_->setEnabled(!uat_model_->hasErrors());

        if (uat_->help && strlen(uat_->help) > 0) {
            help_button_->setEnabled(true);
        }

        connect(this, SIGNAL(rejected()), this, SLOT(rejectChanges()));
        connect(this, SIGNAL(accepted()), this, SLOT(acceptChanges()));
    }

    setWindowTitle(title);
}
Esempio n. 16
0
void UatDialog::addRecord(bool copy_from_current)
{
    if (!uat_) return;

    const QModelIndex &current = ui->uatTreeView->currentIndex();
    if (copy_from_current && !current.isValid()) return;

    // should not fail, but you never know.
    if (!uat_model_->insertRows(uat_model_->rowCount(), 1)) {
        qDebug() << "Failed to add a new record";
        return;
    }
    const QModelIndex &new_index = uat_model_->index(uat_model_->rowCount() - 1, 0);
    if (copy_from_current) {
        uat_model_->copyRow(new_index.row(), current.row());
    }
    // due to an EditTrigger, this will also start editing.
    ui->uatTreeView->setCurrentIndex(new_index);
    // trigger updating error messages and the OK button state.
    modelDataChanged(new_index);
}
Esempio n. 17
0
QtGroupingProxy::QtGroupingProxy( QAbstractItemModel *model, QModelIndex rootNode, int groupedColumn )
    : QAbstractProxyModel()
    , m_rootNode( rootNode )
    , m_groupedColumn( 0 )
{
    setSourceModel( model );

    // signal proxies
    connect( sourceModel(), SIGNAL(rowsInserted(QModelIndex,int,int) ),
             SLOT(modelRowsInserted(QModelIndex,int,int)) );
    connect( sourceModel(), SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)),
             SLOT(modelRowsAboutToBeInserted(QModelIndex,int,int)) );
    connect( sourceModel(), SIGNAL(rowsRemoved(QModelIndex,int,int)),
             SLOT(modelRowsRemoved(QModelIndex,int,int)) );
    connect( sourceModel(), SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)),
             SLOT(modelRowsAboutToBeRemoved(QModelIndex,int,int)) );

    connect( sourceModel(), SIGNAL(layoutChanged()), SLOT(buildTree()) );
    connect( sourceModel(), SIGNAL(dataChanged(QModelIndex,QModelIndex)),
             SLOT(modelDataChanged(QModelIndex,QModelIndex)) );

    if( groupedColumn != -1 )
        setGroupedColumn( groupedColumn );
}
Esempio n. 18
0
void AbstractProfilePolygonItem::setVerticalDataColumn(int column)
{
	vDataColumn = column;
	modelDataChanged();
}
Esempio n. 19
0
void TankItem::setHorizontalAxis(DiveCartesianAxis *horizontal)
{
	hAxis = horizontal;
	connect(hAxis, SIGNAL(sizeChanged()), this, SLOT(modelDataChanged()));
	modelDataChanged();
}
Esempio n. 20
0
ChordEdit::ChordEdit(Score* s, QWidget* parent)
   : QDialog(parent)
      {
      _harmony = 0;
      score    = s;

      setupUi(this);
      // note that rootGroup button identifiers map conveniently
      // onto all possible tpc2step return values: don't change
      rootGroup = new QButtonGroup(this);
      rootGroup->addButton(rootC,   0);
      rootGroup->addButton(rootD,   1);
      rootGroup->addButton(rootE,   2);
      rootGroup->addButton(rootF,   3);
      rootGroup->addButton(rootG,   4);
      rootGroup->addButton(rootA,   5);
      rootGroup->addButton(rootB,   6);

      // note that accidentalsGroup button identifiers map conveniently
      // onto all possible tpc2alter return values: don't change
      accidentalsGroup = new QButtonGroup(this);
      accidentalsGroup->addButton(accDFlat,  -2 + 3);
      accidentalsGroup->addButton(accFlat,   -1 + 3);
      accidentalsGroup->addButton(accNone,    0 + 3);
      accidentalsGroup->addButton(accSharp,   1 + 3);
      accidentalsGroup->addButton(accDSharp,  2 + 3);

      extensionGroup = new QButtonGroup(this);
      extensionGroup->addButton(extMaj,    2);
      extensionGroup->addButton(ext2,     15);
      extensionGroup->addButton(extMaj7,   6);
      extensionGroup->addButton(extMaj9,   7);
      extensionGroup->addButton(ext6,      5);
      extensionGroup->addButton(ext69,    14);

      extensionGroup->addButton(extm,     16);
      extensionGroup->addButton(extm7,    19);
      extensionGroup->addButton(extm6,    23);
      extensionGroup->addButton(extm9,    20);
      extensionGroup->addButton(extmMaj7, 18);
      extensionGroup->addButton(extm7b5,  32);
      extensionGroup->addButton(extdim,   33);
      extensionGroup->addButton(ext7,     64);
      extensionGroup->addButton(ext9,     70);
      extensionGroup->addButton(ext13,    65);
      extensionGroup->addButton(ext7b9,   76);
      extensionGroup->addButton(extsus,  184);
      extensionGroup->addButton(ext7Sus, 128);
      extensionGroup->addButton(extOther,  0);

      extOtherCombo->clear();
      ChordList* cl = score->style()->chordList();
      foreach (const ChordDescription* cd, *cl) {
            QString p;
            if (cd->names.isEmpty())
                  p = "?";
            else
                  p = cd->names.front();
            extOtherCombo->addItem(p, cd->id);
            }
      connect(rootGroup, SIGNAL(buttonClicked(int)), SLOT(chordChanged()));
      connect(extensionGroup, SIGNAL(buttonClicked(int)), SLOT(chordChanged()));
      connect(extOtherCombo, SIGNAL(currentIndexChanged(int)), SLOT(chordChanged()));
      connect(accidentalsGroup, SIGNAL(buttonClicked(int)), SLOT(chordChanged()));
      connect(bassNote, SIGNAL(currentIndexChanged(int)), SLOT(chordChanged()));
      connect(extOther, SIGNAL(toggled(bool)), SLOT(otherToggled(bool)));
      connect(addButton, SIGNAL(clicked()), SLOT(addButtonClicked()));
      connect(deleteButton, SIGNAL(clicked()), SLOT(deleteButtonClicked()));

      extOtherCombo->setEnabled(false);

      model = new QStandardItemModel(0, 3);
      model->setHeaderData(0, Qt::Horizontal, tr("Type"));
      model->setHeaderData(1, Qt::Horizontal, tr("Value"));
      model->setHeaderData(2, Qt::Horizontal, tr("Alter"));

      connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
                     SLOT(modelDataChanged(QModelIndex,QModelIndex)));

      degreeTable->setModel(model);
      delegate = new DegreeTabDelegate;
      degreeTable->setItemDelegate(delegate);
      degreeTable->setColumnWidth(0, 80);
      degreeTable->setColumnWidth(1, 71);
      degreeTable->setColumnWidth(2, 71);
      }
Esempio n. 21
0
void AbstractProfilePolygonItem::setHorizontalDataColumn(int column)
{
	hDataColumn = column;
	modelDataChanged();
}
Esempio n. 22
0
void AbstractProfilePolygonItem::setHorizontalAxis(DiveCartesianAxis *horizontal)
{
	hAxis = horizontal;
	connect(hAxis, SIGNAL(sizeChanged()), this, SLOT(modelDataChanged()));
	modelDataChanged();
}