Subversion Repositories svn1-original

Rev

Rev 145 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 145 Rev 161
Line 26... Line 26...
26
** RETURNS            :
26
** RETURNS            :
27
**
27
**
28
----------------------------------------------------------------------------*/
28
----------------------------------------------------------------------------*/
29
 
29
 
30
timeDelegate::timeDelegate(QObject *parent)
30
timeDelegate::timeDelegate(QObject *parent)
31
    : QItemDelegate(parent)
31
    : QStyledItemDelegate(parent)
32
{
32
{
33
}
33
}
34
 
34
 
35
/*----------------------------------------------------------------------------
35
/*----------------------------------------------------------------------------
36
** FUNCTION           : createEditor
36
** FUNCTION           : createEditor
Line 98... Line 98...
98
{
98
{
99
    QTimeEdit *timeEdit = static_cast<QTimeEdit*>(editor);
99
    QTimeEdit *timeEdit = static_cast<QTimeEdit*>(editor);
100
    timeEdit->interpretText();
100
    timeEdit->interpretText();
101
    QTime value = timeEdit->time();
101
    QTime value = timeEdit->time();
102
 
102
 
-
 
103
    //model->setData(index, "--:--:--", Qt::DisplayRole);
103
    model->setData(index, value, Qt::EditRole);
104
    model->setData(index, value, Qt::EditRole);
104
}
105
}
105
 
106
 
106
/*----------------------------------------------------------------------------
107
/*----------------------------------------------------------------------------
107
** FUNCTION           : updateEditorGeometry
108
** FUNCTION           : updateEditorGeometry
Line 121... Line 122...
121
    const QStyleOptionViewItem &option, const QModelIndex &/* index */) const
122
    const QStyleOptionViewItem &option, const QModelIndex &/* index */) const
122
{
123
{
123
    editor->setGeometry(option.rect);
124
    editor->setGeometry(option.rect);
124
}
125
}
125
 
126
 
-
 
127
/*----------------------------------------------------------------------------
-
 
128
** FUNCTION           : displayText
-
 
129
**
-
 
130
** DESCRIPTION        : Control the manner in which the text is displayed
-
 
131
**
-
 
132
**
-
 
133
** INPUTS             : value           - Data from the model
-
 
134
**                      locale          - Current local
-
 
135
**
-
 
136
** RETURNS            : Text to be displayed
-
 
137
**
-
 
138
----------------------------------------------------------------------------*/
-
 
139
 
-
 
140
 
-
 
141
QString timeDelegate::displayText ( const QVariant & value, const QLocale & locale ) const
-
 
142
{
-
 
143
    if ( value.toTime().isValid())
-
 
144
    {
-
 
145
        return (value.toTime().toString("hh:mm:ss"));
-
 
146
    }
-
 
147
    return (QString("--:--:--"));
-
 
148
}
-
 
149