void Event::setStartDate(const QDateTime &startDate)
{
    if (startDate != mStartDate) {
        mStartDate = startDate;
        emit startDateChanged(mStartDate);
    }
}
void ScheduleDialog::setDateRange( const QDate & start, const QDate & end )
{
	if( end < start ) return;
	startDateChanged( start );
	endDateChanged( end );
	mDateStartEdit->setDate( start );
	mDateEndEdit->setDate( end );
}
void NemoCalendarAgendaModel::setStartDate(const QDate &startDate)
{
    if (mStartDate == startDate)
        return;

    mStartDate = startDate;
    emit startDateChanged();
}
Exemple #4
0
EventEditor::EventEditor( const Event& event, QWidget* parent )
    : QDialog( parent )
    , m_ui( new Ui::EventEditor )
    , m_event( event )
{
    m_ui->setupUi( this );
    m_ui->dateEditEnd->calendarWidget()->setFirstDayOfWeek( Qt::Monday );
    m_ui->dateEditEnd->calendarWidget()->setVerticalHeaderFormat( QCalendarWidget::ISOWeekNumbers );
    m_ui->dateEditStart->calendarWidget()->setFirstDayOfWeek( Qt::Monday );
    m_ui->dateEditStart->calendarWidget()->setVerticalHeaderFormat( QCalendarWidget::ISOWeekNumbers );

    // Ctrl+Return for OK
    m_ui->buttonBox->button(QDialogButtonBox::Ok)->setShortcut(Qt::CTRL + Qt::Key_Return);

    // connect stuff:
    connect( m_ui->spinBoxHours, SIGNAL(valueChanged(int)),
             SLOT(durationHoursEdited(int)) );
    connect( m_ui->spinBoxMinutes, SIGNAL(valueChanged(int)),
             SLOT(durationMinutesEdited(int)) );
    connect( m_ui->dateEditStart, SIGNAL(dateChanged(QDate)),
             SLOT(startDateChanged(QDate)) );
    connect( m_ui->timeEditStart, SIGNAL(timeChanged(QTime)),
             SLOT(startTimeChanged(QTime)) );
    connect( m_ui->dateEditEnd, SIGNAL(dateChanged(QDate)),
             SLOT(endDateChanged(QDate)) );
    connect( m_ui->timeEditEnd, SIGNAL(timeChanged(QTime)),
             SLOT(endTimeChanged(QTime)) );
    connect( m_ui->pushButtonSelectTask, SIGNAL(clicked()),
             SLOT(selectTaskClicked()) );
    connect( m_ui->textEditComment, SIGNAL(textChanged()),
             SLOT(commentChanged()) );
    connect( m_ui->startToNowButton, SIGNAL(clicked()),
             SLOT(startToNowButtonClicked()) );
    connect( m_ui->endToNowButton, SIGNAL(clicked()),
             SLOT(endToNowButtonClicked()) );
    // what a fricking hack - but QDateTimeEdit does not seem to have
    // a simple function to toggle 12h and 24h mode:
    // yeah, I know, this will survive changes in the user prefs, but
    // only for this instance of the edit dialog
    QString originalDateTimeFormat = m_ui->timeEditStart->displayFormat();

    QString format = originalDateTimeFormat
                     .remove( QStringLiteral("ap") )
                     .remove( QStringLiteral("AP") )
                     .simplified();
    m_ui->timeEditStart->setDisplayFormat( format );
    m_ui->timeEditEnd->setDisplayFormat( format );

    // initialize to some sensible values, unless we got something valid passed in
    if ( !m_event.isValid() ) {
        QSettings settings;
        QDateTime start = settings.value( MetaKey_LastEventEditorDateTime, QDateTime::currentDateTime() ).toDateTime();
        m_event.setStartDateTime( start );
        m_event.setEndDateTime( start );
        m_endDateChanged = false;
    }
    updateValues( true );
}
void Calendar::setStartDate(const QDate &dateTime)
{
  if (m_startDate == dateTime) {
    return;
  }
  m_startDate = dateTime;
  updateData();
  emit startDateChanged();
}
DateFilterProxyModel::DateFilterProxyModel(int column, QObject *parent) :
    WidgetProxyModel(parent), column(column)
{
    widget = new DateFilterProxyModelWidget(0);

    connect(widget, SIGNAL(startDateChanged(QDate)),
            this, SLOT(setFilterMinimumDate(QDate)));
    connect(widget, SIGNAL(endDateChanged(QDate)),
            this, SLOT(setFilterMaximumDate(QDate)));

    widget->goToToday();
}
Exemple #7
0
toAWR::toAWR(/*toTool *tool,*/ QWidget *parent, toConnection &_connection)
    : toToolWidget(AWRTool, "simplequery.html", parent, _connection, "toAWR")
{
    QToolBar *toolbar = Utils::toAllocBar(this, tr("AWR Tool"));
    layout()->addWidget(toolbar);

    toolbar->addWidget(new QLabel("Inst:", toolbar));
    dbid = new toResultCombo(toolbar, "AWR toolbar");
    dbid->setSQL(toSQL::sql("toAWR:DBInstances", connection()));
    fsnap = new toResultCombo(toolbar, "AWR toolbar");
    fsnap->setSelectionPolicy(toResultCombo::LastButOne);
    fsnap->setSQL(SQLSnaps);
    tsnap = new toResultCombo(toolbar, "AWR toolbar");
    tsnap->setSelectionPolicy(toResultCombo::Last);
    tsnap->setSQL(SQLSnaps);

    startdate = new QDateTimeEdit(QDate::currentDate());
    startdate->setCalendarPopup(true);
    enddate = new QDateTimeEdit(QDate::currentDate());
    enddate->setCalendarPopup(true);

    connect(dbid, SIGNAL(activated(int)), this, SLOT(instanceChanged(int)));
    connect(dbid, SIGNAL(done()), this, SLOT(instanceRead()));
    connect(startdate, SIGNAL(dateChanged(QDate)), this, SLOT(startDateChanged(QDate)));
    connect(enddate, SIGNAL(dateChanged(QDate)), this, SLOT(endDateChanged(QDate)));

    toolbar->addWidget(dbid);
    toolbar->addWidget(startdate);
    toolbar->addWidget(fsnap);
    toolbar->addWidget(enddate);
    toolbar->addWidget(tsnap);

    try
    {
        dbid->refresh();
    }
    TOCATCH;

    toolbar->addAction(QIcon(QPixmap(const_cast<const char**>(execute_xpm))),
                       tr("Generate report"),
                       this,
                       SLOT(execute()));
    toolbar->addWidget(new Utils::toSpacer());

    QAction *executeAct = new QAction(QPixmap(execute_xpm), tr("Execute_ current statement"), this);
    executeAct->setShortcut(QKeySequence::Refresh);
    connect(executeAct, SIGNAL(triggered()), this, SLOT(refresh(void)));

    new toChangeConnection(toolbar);

    Tabs = new QTabWidget(this);
    layout()->addWidget(Tabs);
}
NemoCalendarAgendaModel::NemoCalendarAgendaModel(QObject *parent)
    : NemoCalendarAbstractModel(parent)
{
    mRoleNames[EventObjectRole] = "event";
    mRoleNames[SectionBucketRole] = "sectionBucket";
    mRoleNames[NotebookColorRole] = "notebookColor";

#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
    setRoleNames(mRoleNames);
#endif

    connect(this, SIGNAL(startDateChanged()), this, SLOT(load()));
    connect(NemoCalendarEventCache::instance(), SIGNAL(modelReset()), this, SLOT(load()));
}
Exemple #9
0
void QtDcm::initConnections()
{
    // Initialize connections
    QObject::connect ( treeWidgetPatients, SIGNAL ( currentItemChanged ( QTreeWidgetItem*, QTreeWidgetItem* ) ), this, SLOT ( patientItemSelected ( QTreeWidgetItem*, QTreeWidgetItem* ) ) );
    QObject::connect ( treeWidgetStudies, SIGNAL ( currentItemChanged ( QTreeWidgetItem*, QTreeWidgetItem* ) ), this, SLOT ( studyItemSelected ( QTreeWidgetItem*, QTreeWidgetItem* ) ) );
    QObject::connect ( treeWidgetSeries, SIGNAL ( currentItemChanged ( QTreeWidgetItem*, QTreeWidgetItem* ) ), this, SLOT ( serieItemSelected ( QTreeWidgetItem*, QTreeWidgetItem* ) ) );
    QObject::connect ( treeWidgetSeries, SIGNAL ( itemClicked ( QTreeWidgetItem*, int ) ), this, SLOT ( serieItemClicked ( QTreeWidgetItem*, int ) ) );
    QObject::connect ( nameEdit, SIGNAL ( textChanged ( QString ) ), this, SLOT ( patientNameTextChanged ( QString ) ) );
    QObject::connect ( serieDescriptionEdit, SIGNAL ( textChanged ( QString ) ), this, SLOT ( serieDescriptionTextChanged ( QString ) ) );
    QObject::connect ( studyDescriptionEdit, SIGNAL ( textChanged ( QString ) ), this, SLOT ( studyDescriptionTextChanged ( QString ) ) );
    QObject::connect ( searchButton, SIGNAL ( clicked() ), this, SLOT ( findSCU() ) );
    QObject::connect ( cdromButton, SIGNAL ( clicked() ), this, SLOT ( openDicomdir() ) );
    QObject::connect ( patientSexComboBox, SIGNAL ( currentIndexChanged ( int ) ), this, SLOT ( updateSex ( int ) ) );
    QObject::connect ( serieModalityComboBox, SIGNAL ( currentIndexChanged ( int ) ), this, SLOT ( updateModality ( int ) ) );
    QObject::connect ( pacsComboBox, SIGNAL ( currentIndexChanged ( int ) ), this, SLOT ( updatePACS ( int ) ) );
    QObject::connect ( startDateEdit, SIGNAL ( dateChanged ( QDate ) ), this, SLOT ( startDateChanged ( QDate ) ) );
    QObject::connect ( endDateEdit, SIGNAL ( dateChanged ( QDate ) ), this, SLOT ( endDateChanged ( QDate ) ) );
}
Exemple #10
0
void WoLineEdit::setId(int pId)
{
  bool found = FALSE;
  if (pId != -1)
  {
    XSqlQuery wo;
	if (_useQuery)
    {
      wo.prepare(_sql);
      wo.exec();
      found = (wo.findFirst("wo_id", pId) != -1);
    }
	else
	{
      wo.prepare( "SELECT formatWONumber(wo_id) AS wonumber,"
                  "       warehous_code, item_id, item_number, uom_name,"
                  "       item_descrip1, item_descrip2,"
                  "       wo_qtyord, wo_qtyrcv, wo_status,"
                  "       formatDate(wo_duedate) AS duedate,"
                  "       formatDate(wo_startdate) AS startdate,"
                  "       formatQtyPer(wo_qtyord) AS ordered,"
                  "       formatQtyPer(wo_qtyrcv) AS received, "
                  "       formatQtyPer(noNeg(wo_qtyord - wo_qtyrcv)) AS balance "
                  "FROM wo, itemsite, item, warehous, uom "
                  "WHERE ((wo_itemsite_id=itemsite_id)"
                  " AND (itemsite_item_id=item_id)"
                  " AND (item_inv_uom_id=uom_id)"
                  " AND (itemsite_warehous_id=warehous_id)"
                  " AND (wo_id=:wo_id));" );
      wo.bindValue(":wo_id", pId);
      wo.exec();
      found = (wo.first());
	}
	if (found)
    {
      _id    = pId;
      _valid = TRUE;

      setText(wo.value("wonumber").toString());

      emit newId(_id);
      emit newItemid(wo.value("item_id").toInt());
      emit warehouseChanged(wo.value("warehous_code").toString());
      emit itemNumberChanged(wo.value("item_number").toString());
      emit uomChanged(wo.value("uom_name").toString());
      emit itemDescrip1Changed(wo.value("item_descrip1").toString());
      emit itemDescrip2Changed(wo.value("item_descrip2").toString());
      emit startDateChanged(wo.value("startdate").toString());
      emit dueDateChanged(wo.value("duedate").toString());
      emit qtyOrderedChanged(wo.value("ordered").toString());
      emit qtyReceivedChanged(wo.value("received").toString());
      emit qtyBalanceChanged(wo.value("balance").toString());
      emit statusChanged(wo.value("wo_status").toString());
      emit valid(TRUE);

      _qtyOrdered  = wo.value("wo_qtyord").toDouble();
      _qtyReceived = wo.value("wo_qtyrcv").toDouble();

      _parsed = TRUE;

      return;
    }
  }

  _id    = -1;
  _valid = FALSE;

  setText("");

  emit newId(-1);
  emit newItemid(-1);
  emit warehouseChanged("");
  emit itemNumberChanged("");
  emit uomChanged("");
  emit itemDescrip1Changed("");
  emit itemDescrip2Changed("");
  emit startDateChanged("");
  emit dueDateChanged("");
  emit qtyOrderedChanged("");
  emit qtyReceivedChanged("");
  emit qtyBalanceChanged("");
  emit statusChanged("");
  emit valid(FALSE);
    
  _qtyOrdered  = 0;
  _qtyReceived = 0;

  _parsed = TRUE;
}
Exemple #11
0
void WoLineEdit::setId(int pId)
{
  bool found = FALSE;
  if (pId != -1)
  {
    XSqlQuery wo;
    if (_useQuery)
    {
      wo.prepare(_sql);
      wo.exec();
      found = (wo.findFirst("wo_id", pId) != -1);
    }
    else
    {
      wo.prepare( "SELECT formatWONumber(wo_id) AS wonumber,"
                  "       warehous_code, item_id, item_number, uom_name,"
                  "       item_descrip1, item_descrip2,"
                  "       abs(wo_qtyord) AS wo_qtyord,"
                  "       abs(wo_qtyrcv) AS wo_qtyrcv, "
                  "       CASE WHEN (wo_status = 'O') THEN :open "
                  "       WHEN (wo_status = 'E') THEN :exploded "
                  "       WHEN (wo_status = 'I') THEN :inprocess "
                  "       WHEN (wo_status = 'R') THEN :released "
                  "       WHEN (wo_status = 'C') THEN :closed "
                  "       ELSE :unknown END AS wo_status,"
                  "       wo_duedate,"
                  "       wo_startdate,"
                  "       noNeg(abs(wo_qtyord) - abs(wo_qtyrcv)) AS balance, "
                  "       CASE WHEN (wo_qtyord >= 0) THEN "
                  "         :assemble "
                  "       ELSE "
                  "         :disassemble "
                  "       END AS wo_method, "
                  "       CASE WHEN (wo_qtyord >= 0) THEN "
                  "         'A' "
                  "       ELSE "
                  "         'D' "
                  "       END AS method "
                  "FROM wo, itemsite, item, warehous, uom "
                  "WHERE ((wo_itemsite_id=itemsite_id)"
                  " AND (itemsite_item_id=item_id)"
                  " AND (item_inv_uom_id=uom_id)"
                  " AND (itemsite_warehous_id=warehous_id)"
                  " AND (wo_id=:wo_id));" );
      wo.bindValue(":wo_id", pId);
      wo.bindValue(":assemble", tr("Assembly"));
      wo.bindValue(":disassemble", tr("Disassembly"));
      wo.bindValue(":open", tr("Open"));
      wo.bindValue(":exploded", tr("Exploded"));
      wo.bindValue(":inprocess", tr("In Process"));
      wo.bindValue(":released", tr("Released"));
      wo.bindValue(":closed", tr("Closed"));
      wo.exec();
      found = (wo.first());
    }
    if (found)
    {
      _id    = pId;
      _valid = TRUE;

      setText(wo.value("wonumber").toString());

      _qtyOrdered  = wo.value("wo_qtyord").toDouble();
      _qtyReceived = wo.value("wo_qtyrcv").toDouble();
      _method = wo.value("method").toString();

      emit newId(_id);
      emit newItemid(wo.value("item_id").toInt());
      emit warehouseChanged(wo.value("warehous_code").toString());
      emit itemNumberChanged(wo.value("item_number").toString());
      emit uomChanged(wo.value("uom_name").toString());
      emit itemDescrip1Changed(wo.value("item_descrip1").toString());
      emit itemDescrip2Changed(wo.value("item_descrip2").toString());
      emit startDateChanged(wo.value("wo_startdate").toDate());
      emit dueDateChanged(wo.value("wo_duedate").toDate());
      emit qtyOrderedChanged(wo.value("wo_qtyord").toDouble());
      emit qtyReceivedChanged(wo.value("wo_qtyrcv").toDouble());
      emit qtyBalanceChanged(wo.value("balance").toDouble());
      emit statusChanged(wo.value("wo_status").toString());
      emit methodChanged(wo.value("wo_method").toString());
      emit valid(TRUE);
    }
  }
  else
  {
    _id    = -1;
    _valid = FALSE;

    setText("");

    emit newId(-1);
    emit newItemid(-1);
    emit warehouseChanged("");
    emit itemNumberChanged("");
    emit uomChanged("");
    emit itemDescrip1Changed("");
    emit itemDescrip2Changed("");
    emit startDateChanged(QDate());
    emit dueDateChanged(QDate());
    emit qtyOrderedChanged(0);
    emit qtyReceivedChanged(0);
    emit qtyBalanceChanged(0);
    emit statusChanged("");
    emit methodChanged("");
    emit valid(FALSE);
      
    _qtyOrdered  = 0;
    _qtyReceived = 0;
  }
  
  if (_mapper->model() &&
    _mapper->model()->data(_mapper->model()->index(_mapper->currentIndex(),_mapper->mappedSection(this))).toString() != text())
      _mapper->model()->setData(_mapper->model()->index(_mapper->currentIndex(),_mapper->mappedSection(this)), text());
  
  _parsed = TRUE;
}
Exemple #12
0
void TaskDialog::initProgressTab(QScrollArea *scrollArea)
{
    /* construct */
    QWidget *progressDetail = new QWidget(scrollArea);
    QFormLayout *fl = new QFormLayout;

    comboStatus = new QComboBox;
    comboStatus->addItem(tr("Not Started"));
    comboStatus->addItem(tr("In Progress"));
    comboStatus->addItem(tr("Completed"));
    comboStatus->addItem(tr("Waiting"));
    comboStatus->addItem(tr("Deferred"));

    spinComplete = new QSpinBox;
    spinComplete->setMinimum(0);
    spinComplete->setMaximum(100);
    spinComplete->setSuffix(tr("%"));

    startedCheck = new QGroupBox;
    startedCheck->setCheckable(true);
    startedCheck->setTitle(tr("Started:"));

    completedCheck = new QGroupBox;
    completedCheck->setCheckable(true);
    completedCheck->setTitle(tr("Completed:"));

    startedEdit = new QDateEdit;
    completedEdit = new QDateEdit;

    QVBoxLayout *vl = new QVBoxLayout();
    vl->addWidget(startedEdit);
    startedCheck->setLayout(vl);

    vl = new QVBoxLayout();
    vl->addWidget(completedEdit);
    completedCheck->setLayout(vl);

    fl->addRow(tr("Status"), comboStatus);
    fl->addRow(tr("Progress"), spinComplete);
    fl->addRow(startedCheck);
    fl->addRow(completedCheck);

    progressDetail->setLayout(fl);

    /* initialize */
    QDate current = QDate::currentDate();
    comboStatus->setCurrentIndex( todo.status() );

    spinComplete->setValue(todo.percentCompleted());

    if ( !todo.startedDate().isNull() ) {
        startedCheck->setChecked(true);
        startedEdit->setDate(todo.startedDate());
    } else {
        startedCheck->setChecked(false);
        startedEdit->setDate(current);
    }

    if ( todo.isCompleted() ) {
        completedCheck->setChecked(true);
        completedEdit->setDate(todo.completedDate());
    } else {
        completedCheck->setChecked(false);
        completedEdit->setDate(current);
    }

    /* connect */
    connect( startedEdit, SIGNAL(dateChanged(QDate)),
             this, SLOT(startDateChanged(QDate)) );
    connect( completedEdit, SIGNAL(dateChanged(QDate)),
             this, SLOT(endDateChanged(QDate)) );
    connect( comboStatus, SIGNAL(activated(int)),
            this, SLOT(statusChanged(int)) );
    connect( startedCheck, SIGNAL(toggled(bool)),
            this, SLOT(startDateChecked(bool)) );
    connect( completedCheck, SIGNAL(toggled(bool)),
            this, SLOT(endDateChecked(bool)) );
    connect( spinComplete, SIGNAL(valueChanged(int)),
            this, SLOT(percentChanged(int)) );

    scrollArea->setWidget(progressDetail);
    progressDetail->setFocusPolicy(Qt::NoFocus);
}
void QFacebookGraphCommonWorkModel::setStartDate(const QString &startDate) {
    if(m_startDate != startDate) {
        m_startDate = startDate;
        emit startDateChanged();
    }
}
Exemple #14
0
void WoLineEdit::silentSetId(const int pId)
{
  if (pId != -1)
  {
    XSqlQuery wo;

    wo.prepare(_query + _idClause +
               (_extraClause.isEmpty() || !_strict ? "" : " AND " + _extraClause) +
               QString(";"));
    wo.bindValue(":id", pId);
    wo.exec();
    if (wo.first())
    {
      if (_completer)
        static_cast<QSqlQueryModel* >(_completer->model())->setQuery(QSqlQuery());

      _id    = pId;
      _valid = TRUE;

      setText(wo.value("number").toString());

      _qtyOrdered  = wo.value("wo_qtyord").toDouble();
      _qtyReceived = wo.value("wo_qtyrcv").toDouble();
      _method = wo.value("method").toString();
      _currentWarehouseid = (wo.value("warehous_id").isNull())
                                      ? -1 : wo.value("warehous_id").toInt();

      emit newId(_id);
      emit newItemid(wo.value("item_id").toInt());
      emit warehouseChanged(wo.value("warehous_code").toString());
      emit itemNumberChanged(wo.value("item_number").toString());
      emit uomChanged(wo.value("uom_name").toString());
      emit itemDescrip1Changed(wo.value("item_descrip1").toString());
      emit itemDescrip2Changed(wo.value("item_descrip2").toString());
      emit startDateChanged(wo.value("wo_startdate").toDate());
      emit dueDateChanged(wo.value("wo_duedate").toDate());
      emit qtyOrderedChanged(wo.value("wo_qtyord").toDouble());
      emit qtyReceivedChanged(wo.value("wo_qtyrcv").toDouble());
      emit qtyBalanceChanged(wo.value("balance").toDouble());
      emit statusChanged(wo.value("wo_status").toString());
      emit methodChanged(wo.value("wo_method").toString());
      emit valid(TRUE);
    }
  }
  else
  {
    _id    = -1;
    _valid = FALSE;
    _currentWarehouseid = -1;

    XLineEdit::clear();

    emit newId(-1);
    emit newItemid(-1);
    emit warehouseChanged("");
    emit itemNumberChanged("");
    emit uomChanged("");
    emit itemDescrip1Changed("");
    emit itemDescrip2Changed("");
    emit startDateChanged(QDate());
    emit dueDateChanged(QDate());
    emit qtyOrderedChanged(0);
    emit qtyReceivedChanged(0);
    emit qtyBalanceChanged(0);
    emit statusChanged("");
    emit methodChanged("");
    emit valid(FALSE);
      
    _qtyOrdered  = 0;
    _qtyReceived = 0;
  }

  _parsed = TRUE;
  emit parsed();
}
void ConstraintModel::setStartDate(const TimeValue& start)
{
    m_startDate = start;
    emit startDateChanged(start);
}
void Calendar::previousMonth()
{
  m_startDate = m_startDate.addMonths(-1);
  updateData();
  emit startDateChanged();
}
void Calendar::previousYear()
{
  m_startDate = m_startDate.addYears(-1);
  updateData();
  emit startDateChanged();
}
void Calendar::nextYear()
{
  m_startDate = m_startDate.addYears(1);
  updateData();
  emit startDateChanged();
}
void Calendar::nextMonth()
{
  m_startDate = m_startDate.addMonths(1);
  updateData();
  emit startDateChanged();
}
//------------------------------------------------------------------------------
EstimateDetailsForm::EstimateDetailsForm(EstimateModel* model,
		QSharedPointer<BudgetingPeriod> period, QUndoStack* stack,
		QWidget* parent)
	: QWidget(parent), model(model), period(period), undoStack(stack)
{
	// Setup name field
	nameField = new LineEdit("", this);
	nameField->setEnabled(false);
	connect(nameField, SIGNAL(textEdited(QString)),
		this, SLOT(updateName(QString)));

	// Setup description field
	descriptionField = new LineEdit("", this);
	descriptionField->setEnabled(false);
	connect(descriptionField, SIGNAL(textEdited(QString)),
		this, SLOT(updateDescription(QString)));

	// Setup type field
	typeField = new QComboBox(this);
	typeField->addItem(tr("Expense"), Estimate::Expense);
	typeField->addItem(tr("Income"), Estimate::Income);
	typeField->addItem(tr("Transfer"), Estimate::Transfer);
	typeField->setEnabled(false);
	connect(typeField, SIGNAL(currentIndexChanged(int)),
		this, SLOT(updateType(int)));

	// Setup amount field
	amountField = new MoneyEdit(this);
	amountField->setEnabled(false);
	connect(amountField, SIGNAL(valueEdited(Money)),
		this, SLOT(updateAmount(Money)));

	// Setup due date field
	dueDateField = new QDateEdit(this);
	dueDateField->installEventFilter(new IgnoreUndoRedo(this, this));
	dueDateField->setCalendarPopup(true);
	dueDateField->setSpecialValueText(tr("None"));
	dueDateField->setEnabled(false);
	clearDueDate();
	connect(dueDateField, SIGNAL(dateChanged(QDate)),
		this, SLOT(updateDueDate(QDate)));

	// Setup clear-due date button
	clearDueDateButton = new QPushButton(tr("Clear"), this);
	clearDueDateButton->setEnabled(false);
	connect(clearDueDateButton, SIGNAL(clicked(bool)),
		this, SLOT(clearDueDate()));

	// Make sure we pick up changes to the budgeting period start date
	// (have to use Qt5 style connect because of namespaced type)
	connect(period.data(), &BudgetingPeriod::paramsChanged,
		this, &EstimateDetailsForm::startDateChanged);
	startDateChanged(); // initial populate

	// Put due date entry and clear button side-by-side
	QHBoxLayout* dueDateLayout = new QHBoxLayout;
	dueDateLayout->addWidget(dueDateField, 1);
	dueDateLayout->addWidget(clearDueDateButton);

	// Setup finished field
	finishedField = new QCheckBox(this);
	connect(finishedField, SIGNAL(toggled(bool)),
		this, SLOT(updateFinishedState(bool)));

	// Setup form layout
	QFormLayout* form = new QFormLayout;
	form->addRow(tr("Name"), nameField);
	form->addRow(tr("Description"), descriptionField);
	form->addRow(tr("Type"), typeField);
	form->addRow(tr("Amount"), amountField);
	form->addRow(tr("Due Date"), dueDateLayout);
	form->addRow(tr("Finished"), finishedField);

	// Add to widget
	setLayout(form);

	// Get updated data when the estimates change
	connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
		this, SLOT(dataChanged(QModelIndex,QModelIndex)));
}