Changeset 1236 for trunk/source/interfaces/basic/src
- Timestamp:
- Feb 8, 2010, 5:19:32 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/interfaces/basic/src/G4UIQt.cc
r1232 r1236 171 171 172 172 // Add a empty tabwidget 173 fTabWidget = new QTabWidget(myVSplitter); 173 fTabWidget = new G4QTabWidget(myVSplitter); 174 #if QT_VERSION >= 0x040500 175 fTabWidget->setTabsClosable (true); 176 #endif 177 178 #if QT_VERSION >= 0x040200 179 fTabWidget->setUsesScrollButtons (true); 180 #endif 174 181 175 182 QWidget* commandLineWidget = new QWidget(mainWidget); … … 280 287 281 288 connect(fCommandArea, SIGNAL(returnPressed()), SLOT(CommandEnteredCallback())); 282 289 connect(this, SIGNAL(refreshTab(const QString &)), SLOT(RefreshTabCallback(const QString&))); 283 290 if(UI!=NULL) UI->SetCoutDestination(this); // TO KEEP 284 291 … … 521 528 // then we have to force them on order to check the size 522 529 523 fTabWidget->insertTab(fTabWidget->count()-1,aWidget,name); 524 530 fTabWidget->insertTab(fTabWidget->count(),aWidget,name); 531 532 if (fTabWidget->count() == 1) { 533 connect(fTabWidget, SIGNAL(currentChanged ( int ) ), SLOT(UpdateTabWidget(int))); 534 // connect(fTabWidget, SIGNAL(resizeEvent ( QResizeEvent* ) ), SLOT(ResizeTabWidget( QResizeEvent*))); 535 } 525 536 // Set visible 526 537 #if QT_VERSION >= 0x040000 … … 574 585 #endif 575 586 if ( fTabWidget == NULL) { 576 fTabWidget = new QTabWidget; 577 } 578 579 QString text = fTabWidget->tabText (tabNumber); 580 if ( text != fCoutText) { 581 582 // Then we have to do /vis/viewer/select on the selelected tab 583 // And resize selected tab 584 fTabWidget->currentWidget()->resize(fTabWidget->currentWidget()->width(),fTabWidget->currentWidget()->height()); 585 586 QString paramSelect = QString("/vis/viewer/select ")+text; 587 QString paramFlush = QString("/vis/viewer/flush ")+text; 588 G4UImanager* UI = G4UImanager::GetUIpointer(); 589 if(UI!=NULL) { 590 UI->ApplyCommand(paramSelect.toStdString().c_str()); 591 UI->ApplyCommand(paramFlush.toStdString().c_str()); 592 } 593 fTabWidget->currentWidget()->repaint(); 594 } 595 if (fTabWidget->count() == 1) { 596 connect(fTabWidget, SIGNAL(currentChanged ( int ) ), SLOT(UpdateTabWidget(int))); 597 // connect(fTabWidget, SIGNAL(resizeEvent ( QResizeEvent* ) ), SLOT(ResizeTabWidget( QResizeEvent*))); 598 } 587 fTabWidget = new G4QTabWidget; 588 } 589 590 591 //Must be BEFORE repaint of OGL 592 #ifdef G4DEBUG_INTERFACES_BASIC 593 printf("G4UIQt::UpdateTabWidget CALL REPAINT tabGL\n"); 594 #endif 595 // QPaintEvent e(fTabWidget->currentWidget()->rect()); 596 // QApplication::sendEvent(fTabWidget->currentWidget(), &e); 597 598 #ifdef G4DEBUG_INTERFACES_BASIC 599 printf("G4UIQt::UpdateTabWidget CALL REPAINT tabWidget\n"); 600 #endif 601 // QPaintEvent e2(fTabWidget->rect()); 602 // QApplication::postEvent(fTabWidget, &e2); 603 604 // Emit signal in order to refresh glView after all paint tab 605 // signals have been send 606 // emit(refreshTab(fTabWidget->tabText (fTabWidget->currentIndex()))); 607 // fTabWidget->repaint(); 608 #ifdef G4DEBUG_INTERFACES_BASIC 609 printf("G4UIQt::UpdateTabWidget CALL REPAINT END\n"); 610 #endif 611 612 // QString text = fTabWidget->tabText (fTabWidget->currentIndex()); 613 // QString paramSelect = QString("/vis/viewer/select ")+text; 614 // // QString paramFlush = QString("/vis/viewer/flush ")+text; 615 // G4UImanager* UI = G4UImanager::GetUIpointer(); 616 // if(UI!=NULL) { 617 // UI->ApplyCommand(paramSelect.toStdString().c_str()); 618 // // UI->ApplyCommand(paramFlush.toStdString().c_str()); 619 // } 620 621 622 623 fTabWidget->setTabSelected(); 624 // Then we have to do /vis/viewer/select on the selelected tab 625 // And resize selected tab 626 // fTabWidget->currentWidget()->resize(fTabWidget->currentWidget()->width(),fTabWidget->currentWidget()->height()); 627 628 // ((QGLWIdget*)fTabWidget->currentWidget())->makeCurrent(); 629 630 // #ifdef G4DEBUG_INTERFACES_BASIC 631 // printf("G4UIQt::UpdateTabWidget REPAINT END\n"); 632 // #endif 633 // QCoreApplication::flush (); 634 #ifdef G4DEBUG_INTERFACES_BASIC 635 printf("G4UIQt::UpdateTabWidget END\n"); 636 #endif 599 637 } 600 638 … … 1833 1871 } 1834 1872 1835 #endif 1873 1874 1875 void G4UIQt::RefreshTabCallback ( 1876 const QString &text 1877 ) 1878 { 1879 #ifdef G4DEBUG_INTERFACES_BASIC 1880 printf("G4UIQt::RefreshTabCallback BEGIN +++++++++++++++++++++\n"); 1881 #endif 1882 QString paramSelect = QString("/vis/viewer/select ")+text; 1883 // QString paramFlush = QString("/vis/viewer/flush ")+text; 1884 G4UImanager* UI = G4UImanager::GetUIpointer(); 1885 if(UI!=NULL) { 1886 UI->ApplyCommand(paramSelect.toStdString().c_str()); 1887 // UI->ApplyCommand(paramFlush.toStdString().c_str()); 1888 } 1889 #ifdef G4DEBUG_INTERFACES_BASIC 1890 printf("G4UIQt::RefreshTabCallback BEGIN -+-+-+-+-+-+-+-+-+-+-+\n"); 1891 #endif 1892 } 1893 1894 G4QTabWidget::G4QTabWidget( 1895 QSplitter*& split 1896 ):QTabWidget(split) 1897 { 1898 } 1899 1900 G4QTabWidget::G4QTabWidget( 1901 ):QTabWidget() 1902 { 1903 } 1904 1905 1906 1907 void G4QTabWidget::paintEvent( 1908 QPaintEvent * event 1909 ) 1910 { 1911 QCoreApplication::sendPostedEvents () ; 1912 1913 if (currentWidget()) { 1914 #ifdef G4DEBUG_INTERFACES_BASIC 1915 printf("G4QTabWidget::paintEvent repaint type : %d -- rect %d %d region:%d %d page : %d %d ________________________ for = %d i= %d w: %d\n", event->type(),event->rect().height(),event->rect().width(),event->region().boundingRect().width(),event->region().boundingRect().height(),currentWidget()->width(),currentWidget()->height(),this,currentIndex(),currentWidget()); 1916 #endif 1917 1918 // QTabWidget::paintEvent(event); 1919 1920 if ( isTabSelected()) { 1921 #ifdef G4DEBUG_INTERFACES_BASIC 1922 printf("G4QTabWidget::paintEvent OK\n"); 1923 #endif 1924 QString text = tabText (currentIndex()); 1925 QString paramSelect = QString("/vis/viewer/select ")+text; 1926 // QString paramFlush = QString("/vis/viewer/flush ")+text; 1927 G4UImanager* UI = G4UImanager::GetUIpointer(); 1928 if(UI!=NULL) { 1929 UI->ApplyCommand(paramSelect.toStdString().c_str()); 1930 // UI->ApplyCommand(paramFlush.toStdString().c_str()); 1931 } 1932 1933 repaint(); 1934 unselectTab(); 1935 } 1936 } 1937 } 1938 1939 #endif
Note: See TracChangeset
for help on using the changeset viewer.