Changeset 1251 for trunk/source/interfaces/basic/src
- Timestamp:
- May 7, 2010, 11:51:18 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/interfaces/basic/src/G4UIQt.cc
r1250 r1251 1034 1034 QString commandText = ""; 1035 1035 for (int a=0;a<treeSize;a++) { 1036 #ifdef G4DEBUG_INTERFACES_BASIC 1037 printf("G4UIQt::FillHelpTree for\n"); 1038 #endif 1036 1039 1037 // Creating new item 1038 newItem = NULL; 1040 1039 1041 1040 #if QT_VERSION < 0x040000 … … 1045 1044 #endif 1046 1045 1046 #ifdef G4DEBUG_INTERFACES_BASIC 1047 printf("G4UIQt::FillHelpTree for %s\n",commandText.toStdString().c_str()); 1048 #endif 1047 1049 // if already exist, don't create it ! 1048 1050 #if QT_VERSION < 0x040000 … … 1055 1057 } 1056 1058 #else 1057 for (int b=0;a<fHelpTreeWidget->topLevelItemCount();b++) { 1059 #ifdef G4DEBUG_INTERFACES_BASIC 1060 printf("G4UIQt::FillHelpTree topCount %d\n",fHelpTreeWidget->topLevelItemCount()); 1061 #endif 1062 for (int b=0;b<fHelpTreeWidget->topLevelItemCount();b++) { 1058 1063 if (!newItem) 1059 1064 newItem = FindTreeItem(fHelpTreeWidget->topLevelItem(b),commandText); … … 1063 1068 if (newItem == NULL) { 1064 1069 #ifdef G4DEBUG_INTERFACES_BASIC 1065 printf("G4UIQt::FillHelpTree check alreadypresent\n");1070 printf("G4UIQt::FillHelpTree NOT present\n"); 1066 1071 #endif 1067 1072 … … 1073 1078 newItem->setText(0,GetShortCommandPath(commandText)); 1074 1079 } 1080 #ifdef G4DEBUG_INTERFACES_BASIC 1081 else { 1082 printf("G4UIQt::FillHelpTree ALREADY present\n"); 1083 } 1084 #endif 1075 1085 1076 1086 // look for childs … … 1111 1121 // Get the Sub directories 1112 1122 for (int a=0;a<aCommandTree->GetTreeEntry();a++) { 1113 #ifdef G4DEBUG_INTERFACES_BASIC1114 printf("G4UIQt::CreateChildTree for\n");1115 #endif1116 1123 1117 1124 #if QT_VERSION < 0x040000 … … 1121 1128 #endif 1122 1129 1130 #ifdef G4DEBUG_INTERFACES_BASIC 1131 printf("G4UIQt::CreateChildTree for %s \n",commandText.toStdString().c_str()); 1132 #endif 1123 1133 // if already exist, don't create it ! 1124 1134 newItem = FindTreeItem(aParent,commandText); 1125 1135 if (newItem == NULL) { 1126 1136 #ifdef G4DEBUG_INTERFACES_BASIC 1127 printf("G4UIQt::CreateChildTree check alreadypresent\n");1137 printf("G4UIQt::CreateChildTree NOT present\n"); 1128 1138 #endif 1129 1139 #if QT_VERSION < 0x040000 … … 1134 1144 newItem->setText(0,GetShortCommandPath(commandText)); 1135 1145 } 1146 #ifdef G4DEBUG_INTERFACES_BASIC 1147 else { 1148 printf("G4UIQt::CreateChildTree ALREADY present\n"); 1149 } 1150 #endif 1136 1151 CreateChildTree(newItem,aCommandTree->GetTree(a+1)); 1137 1152 } … … 1145 1160 QStringList stringList; 1146 1161 #if QT_VERSION < 0x040000 1147 newItem = new QListViewItem(aParent); 1148 newItem->setText(0,GetShortCommandPath(QString((char*)(aCommandTree->GetCommand(a+1)->GetCommandPath()).data()).simplifyWhiteSpace())); 1149 newItem->setOpen(false); 1150 1151 #else 1152 newItem = new QTreeWidgetItem(aParent); 1153 newItem->setText(0,GetShortCommandPath(QString((char*)(aCommandTree->GetCommand(a+1)->GetCommandPath()).data()).trimmed())); 1162 commandText = QString((char*)(aCommandTree->GetCommand(a+1)->GetCommandPath()).data()).simplifyWhiteSpace(); 1163 #else 1164 commandText = QString((char*)(aCommandTree->GetCommand(a+1)->GetCommandPath()).data()).trimmed(); 1165 #endif 1166 1167 // if already exist, don't create it ! 1168 newItem = FindTreeItem(aParent,commandText); 1169 if (newItem == NULL) { 1170 #if QT_VERSION < 0x040000 1171 newItem = new QListViewItem(aParent); 1172 newItem->setText(0,GetShortCommandPath(commandText)); 1173 newItem->setOpen(false); 1174 1175 #else 1176 newItem = new QTreeWidgetItem(aParent); 1177 newItem->setText(0,GetShortCommandPath(commandText)); 1154 1178 #if QT_VERSION < 0x040202 1155 1156 #else 1157 newItem->setExpanded(false);1158 #endif 1159 #endif 1160 1179 fHelpTreeWidget->setItemExpanded(newItem,false); 1180 #else 1181 newItem->setExpanded(false); 1182 #endif 1183 #endif 1184 } 1161 1185 } 1162 1186 } … … 1179 1203 if (aParent == NULL) return NULL; 1180 1204 1181 if (GetLongCommandPath(aParent) == aCommand) 1205 // Suppress last "/" 1206 QString myCommand = aCommand; 1207 1208 if (myCommand.lastIndexOf("/") == (myCommand.size()-1)) { 1209 myCommand = myCommand.left(myCommand.size()-1); 1210 } 1211 1212 #ifdef G4DEBUG_INTERFACES_BASIC 1213 printf("G4UIQt::FindTreeItem check -%s=%s-\n",myCommand.toStdString().c_str(),GetLongCommandPath(aParent).toStdString().c_str()); 1214 #endif 1215 if (GetLongCommandPath(aParent) == myCommand) 1182 1216 return aParent; 1183 1217 … … 1187 1221 while (tmpItem != 0) { 1188 1222 if (!tmp) 1189 tmp = FindTreeItem(tmpItem, aCommand);1223 tmp = FindTreeItem(tmpItem,myCommand); 1190 1224 tmpItem = tmpItem->nextSibling(); 1191 1225 } … … 1194 1228 for (int a=0;a<aParent->childCount();a++) { 1195 1229 if (!tmp) 1196 tmp = FindTreeItem(aParent->child(a), aCommand);1230 tmp = FindTreeItem(aParent->child(a),myCommand); 1197 1231 } 1198 1232 #endif
Note: See TracChangeset
for help on using the changeset viewer.