Exemple #1
0
void BCMLabel::applyProperties(LabelProperties& props) 
{
    applyWidgetProperties(props);
    
	maxTextLines = props.maxTextLines;

    String labelText = getText();
    String tooltip   = getText();
    
    mapsToParameter = false;
    
    if (getName().equalsIgnoreCase("configurationfilepath"))
        labelText = scopeSyncGUI.getScopeSync().getConfigurationFile().getFullPathName();
    else if (getName().equalsIgnoreCase("configurationname"))
        labelText = scopeSyncGUI.getScopeSync().getConfigurationName(true);
    else
    {
        setupMapping(Ids::label, getName(), props.mappingParentType, props.mappingParent);

        if (mapsToParameter)
        {
            String shortDescription;
            String fullDescription;
            
            parameter->getDescriptions(shortDescription, fullDescription);
            tooltip = fullDescription;
            
            if (props.parameterTextDisplay == LabelProperties::parameterName)
                labelText = parameter->getName();
            else if (props.parameterTextDisplay == LabelProperties::shortDescription)
                labelText = shortDescription;
            else if (props.parameterTextDisplay == LabelProperties::fullDescription)
                labelText = fullDescription;
            else if (props.parameterTextDisplay == LabelProperties::scopeCode)
                labelText = parameter->getScopeCode();
        }
    }

    // Only relevant if label is editable. Not currently supported
    setEditable(false, false, false);
      
    setText(labelText, dontSendNotification);
    setTooltip(tooltip);
    
    setFont(Font(props.fontHeight, props.fontStyleFlags));
    setJustificationType(Justification(props.justificationFlags));
}
TaskDialog::TaskDialog(TaskListModel *pModel, QWidget *parent) :
  QDialog(parent),
  ui(new Ui::TaskDialog),
  m_pTaskListModel(pModel),
  m_pDataWidgetMapper(new QDataWidgetMapper(this))
{
  ui->setupUi(this);

  m_pDataWidgetMapper->setModel(pModel);
  setupMapping();
  connect(m_pDataWidgetMapper, SIGNAL(currentIndexChanged(int)),
          this, SLOT(submitAndUpdateButtons(int)));

    /** @todo Converting the combo box to a time and vice versa.
    QTime timeBeforeAlarm;
    bool bOk = false;
    if (timeText.contains(tr("Minute"))) {
      timeText = timeText.remove(tr("Minutes"), Qt::CaseInsensitive);
      // could be only "Minute";
      timeText = timeText.remove(tr("Minute"), Qt::CaseInsensitive);

      timeText  = timeText.trimmed();
      timeBeforeAlarm = QTime(0, timeText.toInt(&bOk));
    }
    else if(timeText.contains(tr("Hour"))) {
      timeText = timeText.remove(tr("Hours"), Qt::CaseInsensitive);
      // could be only "Hour"
      timeText = timeText.remove(tr("Hour"), Qt::CaseInsensitive);

      timeText  = timeText.trimmed();
      timeBeforeAlarm = QTime(timeText.toInt(&bOk), 0);
    }
    else {
      qFatal("could not parse time string");
    }

    Q_ASSERT(bOk);

*/
}