Esempio n. 1
0
 def data(self, qtindex, role=Qt.DisplayRole):
     """
     Returns the data stored under the given role
     for the item referred to by the qtindex.
     """
     if not qtindex.isValid():
         return QVariantHack()
     # Specify CheckState Role:
     flags = self.flags(qtindex)
     if role == Qt.CheckStateRole:
         if flags & Qt.ItemIsUserCheckable:
             data = self.index2Pref(qtindex).qt_get_data(qtindex.column())
             return Qt.Checked if data else Qt.Unchecked
     if role != Qt.DisplayRole and role != Qt.EditRole:
         return QVariantHack()
     nodePref = self.index2Pref(qtindex)
     data = nodePref.qt_get_data(qtindex.column())
     if isinstance(data, float):
         var = qtype.locale_float(data, 6)
     else:
         var = data
     return str(var)
Esempio n. 2
0
 def data(self, qtindex, role=Qt.DisplayRole):
     """
     Returns the data stored under the given role
     for the item referred to by the qtindex.
     """
     if not qtindex.isValid():
         return QVariantHack()
     # Specify CheckState Role:
     flags = self.flags(qtindex)
     if role == Qt.CheckStateRole:
         if flags & Qt.ItemIsUserCheckable:
             data = self.index2Pref(qtindex).qt_get_data(qtindex.column())
             return Qt.Checked if data else Qt.Unchecked
     if role != Qt.DisplayRole and role != Qt.EditRole:
         return QVariantHack()
     nodePref = self.index2Pref(qtindex)
     data = nodePref.qt_get_data(qtindex.column())
     if isinstance(data, float):
         var = qtype.locale_float(data, 6)
     else:
         var = data
     return str(var)
Esempio n. 3
0
 def data(self, qtindex, role=Qt.DisplayRole):
     """ Returns the data stored under the given role
     for the item referred to by the qtindex. """
     if not qtindex.isValid():
         return QVariantHack()
     # Specify CheckState Role:
     flags = self.flags(qtindex)
     if role == Qt.CheckStateRole:
         if flags & Qt.ItemIsUserCheckable:
             data = self.index2Pref(qtindex).qt_get_data(qtindex.column())
             return Qt.Checked if data else Qt.Unchecked
     if role != Qt.DisplayRole and role != Qt.EditRole:
         return QVariantHack()
     nodePref = self.index2Pref(qtindex)
     data = nodePref.qt_get_data(qtindex.column())
     #print('--- data() ---')
     #print('role = %r' % role)
     #print('data = %r' % data)
     #print('type(data) = %r' % type(data))
     # <SIP.API_MODE(1)>
     #var = QVariantHack(data)
     #if isinstance(data, float):
     #    var = QVariantHack(QString.number(data, format='g', precision=6))
     #if isinstance(data, bool):
     #    var = QVariantHack(data).toString()
     #if isinstance(data, int):
     #    var = QVariantHack(data).toString()
     # </SIP.API_MODE(1)>
     # <SIP.API_MODE(2)>
     if isinstance(data, float):
         var = qtype.locale_float(data, 6)
     else:
         var = data
     # </SIP.API_MODE(2)>
     #print('var= %r' % var)
     #print('type(var)= %r' % type(var))
     return str(var)
Esempio n. 4
0
 def data(self, qtindex, role=Qt.DisplayRole):
     """ Returns the data stored under the given role
     for the item referred to by the qtindex. """
     if not qtindex.isValid():
         return QVariantHack()
     # Specify CheckState Role:
     flags = self.flags(qtindex)
     if role == Qt.CheckStateRole:
         if flags & Qt.ItemIsUserCheckable:
             data = self.index2Pref(qtindex).qt_get_data(qtindex.column())
             return Qt.Checked if data else Qt.Unchecked
     if role != Qt.DisplayRole and role != Qt.EditRole:
         return QVariantHack()
     nodePref = self.index2Pref(qtindex)
     data = nodePref.qt_get_data(qtindex.column())
     #print('--- data() ---')
     #print('role = %r' % role)
     #print('data = %r' % data)
     #print('type(data) = %r' % type(data))
     # <SIP.API_MODE(1)>
     #var = QVariantHack(data)
     #if isinstance(data, float):
     #    var = QVariantHack(QString.number(data, format='g', precision=6))
     #if isinstance(data, bool):
     #    var = QVariantHack(data).toString()
     #if isinstance(data, int):
     #    var = QVariantHack(data).toString()
     # </SIP.API_MODE(1)>
     # <SIP.API_MODE(2)>
     if isinstance(data, float):
         var = qtype.locale_float(data, 6)
     else:
         var = data
     # </SIP.API_MODE(2)>
     #print('var= %r' % var)
     #print('type(var)= %r' % type(var))
     return str(var)