Changeset 719 for trunk/geant4
- Timestamp:
- Feb 7, 2008, 7:19:06 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/geant4/interfaces/basic/src/G4UIQt.cc
r704 r719 26 26 // 27 27 // $Id: G4UIQt.cc,v 1.15 2008/01/30 11:16:17 lgarnier Exp $ 28 // GEANT4 tag $Name: $28 // GEANT4 tag $Name: HEAD $ 29 29 // 30 30 // L. Garnier 31 31 32 //#define GEANT4_QT_DEBUG32 #define GEANT4_QT_DEBUG 33 33 34 34 #ifdef G4UI_BUILD_QT_SESSION … … 547 547 #if QT_VERSION < 0x040000 548 548 helpLayout->add(helpLine); 549 connect( helpLine, SIGNAL( returnPressed () ), this, SLOT( lookForHelpStringCallback() ) ); 549 550 #else 550 551 helpLayout->addWidget(helpLine); 551 #endif552 552 connect( helpLine, SIGNAL( editingFinished () ), this, SLOT( lookForHelpStringCallback() ) ); 553 #endif 553 554 554 555 // the help tree … … 578 579 #else 579 580 vLayout->addWidget(helpWidget); 580 vLayout->add (splitter,1);581 vLayout->addWidget(splitter,1); 581 582 vLayout->addWidget(exitButton); 582 583 #endif … … 1354 1355 // clear old help tree 1355 1356 fHelpTreeWidget->clear(); 1357 #if QT_VERSION < 0x040200 1358 fHelpTreeWidget->removeColumn(1); 1359 fHelpTreeWidget->removeColumn(0); 1360 #endif 1356 1361 CreateHelpTree(); 1357 1362 return; 1358 1363 } 1364 1365 #ifdef GEANT4_QT_DEBUG 1366 printf("G4UIQt::lookForHelpStringCallback\n"); 1367 #endif 1359 1368 1360 1369 // the help tree … … 1367 1376 // clear old help tree 1368 1377 fHelpTreeWidget->clear(); 1378 #if QT_VERSION < 0x040200 1379 fHelpTreeWidget->removeColumn(1); 1380 fHelpTreeWidget->removeColumn(0); 1381 #endif 1369 1382 1370 1383 // look for new items 1371 1384 1372 1385 int tmp = 0; 1386 #if QT_VERSION < 0x040000 1387 int multFactor = 1000; // factor special for having double keys in Qt3 1388 int doubleKeyAdd = 0; // decay for doubleKeys in Qt3 1389 #endif 1390 1373 1391 QMap<int,QString> commandResultMap; 1374 1392 QMap<int,QString> commandChildResultMap; 1375 1393 1376 1394 for (int a=0;a<treeSize;a++) { 1377 #ifdef GEANT4_QT_DEBUG1378 printf("Command %s\n",(char*)(treeTop->GetTree(a+1)->GetPathName()).data());1379 #endif1380 1395 G4UIcommand* command = treeTop->FindPath(treeTop->GetTree(a+1)->GetPathName().data()); 1396 #if QT_VERSION > 0x040000 1381 1397 tmp = GetCommandList (command).count(helpLine->text(),Qt::CaseInsensitive); 1398 #else 1399 tmp = GetCommandList (command).contains(helpLine->text(),false); 1400 #endif 1382 1401 if (tmp >0) { 1402 #if QT_VERSION > 0x040000 1383 1403 commandResultMap.insertMulti(tmp,QString((char*)(treeTop->GetTree(a+1)->GetPathName()).data())); 1384 #ifdef GEANT4_QT_DEBUG 1385 printf("Command %s match %d times \n",(char*)(treeTop->GetTree(a+1)->GetPathName()).data(),tmp); 1404 #else // tricky thing for Qt3... 1405 doubleKeyAdd = 0; 1406 while (commandResultMap.find( tmp*multFactor+doubleKeyAdd) != commandResultMap.end()) { 1407 doubleKeyAdd ++; 1408 } 1409 commandResultMap.insert( tmp*multFactor+doubleKeyAdd,QString((char*)(treeTop->GetTree(a+1)->GetPathName()).data()) ); 1386 1410 #endif 1387 1411 } … … 1390 1414 // insert new childs 1391 1415 if (!commandChildResultMap.empty()) { 1416 #if QT_VERSION > 0x040000 1392 1417 QMap<int,QString>::const_iterator i = commandChildResultMap.constBegin(); 1393 1418 while (i != commandChildResultMap.constEnd()) { 1394 1419 commandResultMap.insertMulti(i.key(),i.value()); 1420 #else // tricky thing for Qt3... 1421 QMap<int,QString>::const_iterator i = commandChildResultMap.begin(); 1422 while (i != commandChildResultMap.end()) { 1423 doubleKeyAdd = 0; 1424 while (commandResultMap.find( i.key()*multFactor+doubleKeyAdd) != commandResultMap.end()) { 1425 doubleKeyAdd ++; 1426 } 1427 commandResultMap.insert(i.key()*multFactor+doubleKeyAdd,i.data()); 1428 #endif 1395 1429 i++; 1396 1430 } … … 1424 1458 } 1425 1459 1460 #if QT_VERSION > 0x040000 1426 1461 QMap<int,QString>::const_iterator i = commandResultMap.constEnd(); 1462 #else 1463 QMap<int,QString>::const_iterator i = commandResultMap.end(); 1464 #endif 1427 1465 i--; 1428 1466 // 10 maximum progress values … … 1438 1476 bool end = false; 1439 1477 while (!end) { 1478 #if QT_VERSION > 0x040000 1440 1479 if (i == commandResultMap.constBegin()) { 1480 #else 1481 if (i == commandResultMap.begin()) { 1482 #endif 1441 1483 end = true; 1442 1484 } … … 1446 1488 #if QT_VERSION < 0x040000 1447 1489 newItem = new QListViewItem(fHelpTreeWidget); 1448 newItem->setText(0,i.value().simplifyWhiteSpace()); 1449 newItem->setText(1,progressStr); 1490 newItem->setText(0,i.data().simplifyWhiteSpace()); 1450 1491 #else 1451 1492 newItem = new QTreeWidgetItem(fHelpTreeWidget); 1452 1493 newItem->setText(0,i.value().trimmed()); 1494 #endif 1453 1495 newItem->setText(1,progressStr); 1454 #endif1455 1496 1456 1497 #if QT_VERSION >= 0x040200 … … 1463 1504 #if QT_VERSION < 0x040000 1464 1505 fHelpTreeWidget->setColumnWidthMode (1,QListView::Maximum); 1506 fHelpTreeWidget->setSorting(1,false); 1465 1507 #else 1466 1508 fHelpTreeWidget->resizeColumnToContents (0); 1509 fHelpTreeWidget->sortItems(1,Qt::DescendingOrder); 1467 1510 // fHelpTreeWidget->setColumnWidth(1,10);//resizeColumnToContents (1); 1468 1511 #endif … … 1480 1523 if (aCommandTree == NULL) return commandResultMap; 1481 1524 1525 #if QT_VERSION < 0x040000 1526 int multFactor = 1000; // factor special for having double keys in Qt3 1527 int doubleKeyAdd = 0; // decay for doubleKeys in Qt3 1528 #endif 1529 1482 1530 // Get the Sub directories 1483 1531 int tmp = 0; … … 1486 1534 for (int a=0;a<aCommandTree->GetTreeEntry();a++) { 1487 1535 const G4UIcommand* command = aCommandTree->GetGuidance(); 1536 #if QT_VERSION > 0x040000 1488 1537 tmp = GetCommandList (command).count(text,Qt::CaseInsensitive); 1538 #else 1539 tmp = GetCommandList (command).contains(text,false); 1540 #endif 1489 1541 if (tmp >0) { 1542 #if QT_VERSION > 0x040000 1490 1543 commandResultMap.insertMulti(tmp,QString((char*)(aCommandTree->GetTree(a+1)->GetPathName()).data())); 1544 #else // tricky thing for Qt3... 1545 doubleKeyAdd = 0; 1546 while (commandResultMap.find( tmp*multFactor+doubleKeyAdd) != commandResultMap.end()) { 1547 doubleKeyAdd ++; 1548 } 1549 commandResultMap.insert(tmp*multFactor+doubleKeyAdd,QString((char*)(aCommandTree->GetTree(a+1)->GetPathName()).data())); 1550 #endif 1491 1551 } 1492 1552 // look for childs … … 1495 1555 if (!commandChildResultMap.empty()) { 1496 1556 // insert new childs 1557 #if QT_VERSION > 0x040000 1497 1558 QMap<int,QString>::const_iterator i = commandChildResultMap.constBegin(); 1498 1559 while (i != commandChildResultMap.constEnd()) { 1499 1560 commandResultMap.insertMulti(i.key(),i.value()); 1561 #else // tricky thing for Qt3... 1562 QMap<int,QString>::const_iterator i = commandChildResultMap.begin(); 1563 while (i != commandChildResultMap.end()) { 1564 doubleKeyAdd = 0; 1565 while (commandResultMap.find( i.key()*multFactor+doubleKeyAdd) != commandResultMap.end()) { 1566 doubleKeyAdd ++; 1567 } 1568 commandResultMap.insert(i.key()*multFactor+doubleKeyAdd,i.data()); 1569 #endif 1500 1570 i++; 1501 1571 } … … 1507 1577 for (int a=0;a<aCommandTree->GetCommandEntry();a++) { 1508 1578 const G4UIcommand* command = aCommandTree->GetCommand(a+1); 1579 #if QT_VERSION > 0x040000 1580 tmp = GetCommandList (command).count(text,Qt::CaseInsensitive); 1581 #else 1582 tmp = GetCommandList (command).contains(text,false); 1583 #endif 1584 if (tmp >0) { 1585 #if QT_VERSION > 0x040000 1586 commandResultMap.insertMulti(tmp,QString((char*)(aCommandTree->GetCommand(a+1)->GetCommandPath()).data())); 1587 #else // tricky thing for Qt3... 1588 doubleKeyAdd = 0; 1589 while (commandResultMap.find( tmp*multFactor+doubleKeyAdd) != commandResultMap.end()) { 1590 doubleKeyAdd ++; 1591 } 1592 commandResultMap.insert(tmp*multFactor+doubleKeyAdd,QString((char*)(aCommandTree->GetCommand(a+1)->GetCommandPath()).data())); 1593 #endif 1509 1594 #ifdef GEANT4_QT_DEBUG 1510 // printf("%s \n",GetCommandList (command).toStdString().c_str());1511 #endif1512 tmp = GetCommandList (command).count(text,Qt::CaseInsensitive);1513 if (tmp >0) {1514 commandResultMap.insertMulti(tmp,QString((char*)(aCommandTree->GetCommand(a+1)->GetCommandPath()).data()));1515 #ifdef GEANT4_QT_DEBUG1516 1595 #endif 1517 1596 }
Note: See TracChangeset
for help on using the changeset viewer.