Subversion Repositories svn1-original

Rev

Rev 314 | Rev 328 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 314 Rev 317
Line 19... Line 19...
19
**
19
**
20
----------------------------------------------------------------------------*/
20
----------------------------------------------------------------------------*/
21
 
21
 
22
qmTwiString::qmTwiString ( QString value, int usort  ) :  QTableWidgetItem(0)
22
qmTwiString::qmTwiString ( QString value, int usort  ) :  QTableWidgetItem(0)
23
{
23
{
24
    setData(0,value);
24
    setData(Qt::DisplayRole,value);
25
    setFlags(flags() & ~Qt::ItemIsEditable);
25
    setFlags(flags() & ~Qt::ItemIsEditable);
26
    sort = usort;
26
    sort = usort;
27
}
27
}
28
 
28
 
29
bool qmTwiString::operator< ( const QTableWidgetItem & other ) const
29
bool qmTwiString::operator< ( const QTableWidgetItem & other ) const
Line 32... Line 32...
32
        return true;
32
        return true;
33
 
33
 
34
    const qmTwiString *other_widget = dynamic_cast<const qmTwiString *>(&other); 
34
    const qmTwiString *other_widget = dynamic_cast<const qmTwiString *>(&other); 
35
    if (other_widget)
35
    if (other_widget)
36
    {
36
    {
37
        return this < other_widget;
37
        return data(Qt::DisplayRole).toString().toLower() < other_widget->data(Qt::DisplayRole).toString().toLower(); 
38
    }
38
    }
39
    return false;
39
    return false;
40
}
40
}
41
 
41
 
42
/*----------------------------------------------------------------------------
42
/*----------------------------------------------------------------------------
Line 122... Line 122...
122
** FUNCTION           : 
122
** FUNCTION           : 
123
**
123
**
124
** DESCRIPTION        :
124
** DESCRIPTION        :
125
----------------------------------------------------------------------------*/
125
----------------------------------------------------------------------------*/
126
 
126
 
127
qmTwiFlag::qmTwiFlag ( const QString txt, int checked  ) :  QTableWidgetItem(txt)
127
qmTwiFlag::qmTwiFlag ( const QString txt, bool checked, int usort  ) :  QTableWidgetItem(txt)
128
{
128
{
-
 
129
    sort = usort;
129
    setCheckState(checked ? Qt::Checked : Qt::Unchecked);
130
    setCheckState(checked ? Qt::Checked : Qt::Unchecked);
130
    setFlags(flags() & ~(Qt::ItemIsEditable | Qt::ItemIsUserCheckable));
131
    setFlags(flags() & ~(Qt::ItemIsEditable | Qt::ItemIsUserCheckable));
131
}
132
}
132
 
133
 
133
bool qmTwiFlag::operator< ( const QTableWidgetItem & other ) const
134
bool qmTwiFlag::operator< ( const QTableWidgetItem & other ) const
134
{
135
{
-
 
136
    if (sort)
-
 
137
        return true;
-
 
138
 
135
    const qmTwiFlag * other_widget = dynamic_cast<const qmTwiFlag*>(&other);
139
    const qmTwiFlag * other_widget = dynamic_cast<const qmTwiFlag*>(&other);
-
 
140
    if (other_widget)
-
 
141
    {
136
    return (other_widget->checkState() < checkState() );
142
        return (other_widget->checkState() < checkState()); 
-
 
143
    }
-
 
144
    else
-
 
145
    {
-
 
146
        return false;
-
 
147
    }
137
}
148
}
138
 
149
 
-
 
150
/*----------------------------------------------------------------------------
-
 
151
** FUNCTION           : 
-
 
152
**
-
 
153
** DESCRIPTION        :
-
 
154
----------------------------------------------------------------------------*/
-
 
155
 
-
 
156
qmTwiEditFlag::qmTwiEditFlag ( const QString txt, bool checked, int usort  ) :  QTableWidgetItem(txt)
-
 
157
{
-
 
158
    sort = usort;
-
 
159
    setCheckState(checked ? Qt::Checked : Qt::Unchecked);
-
 
160
    setFlags(flags() | (Qt::ItemIsEditable | Qt::ItemIsUserCheckable));
-
 
161
}
-
 
162
 
-
 
163
bool qmTwiEditFlag::operator< ( const QTableWidgetItem & other ) const
-
 
164
{
-
 
165
    if (sort)
-
 
166
        return true;
-
 
167
 
-
 
168
    const qmTwiEditFlag * other_widget = dynamic_cast<const qmTwiEditFlag*>(&other);
-
 
169
    if (other_widget)
-
 
170
    {
-
 
171
        return (other_widget->checkState() < checkState()); 
-
 
172
    }
-
 
173
    else
-
 
174
    {
-
 
175
        return false;
-
 
176
    }
-
 
177
}
-
 
178
 
-
 
179