From 076669ca6f411aa3e4b1fc11cd362394d3157a71 Mon Sep 17 00:00:00 2001 From: crcrewso Date: Tue, 14 Feb 2017 11:05:25 -0600 Subject: [PATCH] Update to GUI codes to compile using QT5 libraries Egs_view, egs_configuration, egs_gui, and egs_inprz now compile and run according to the official QT4 to QT5 migration documentation This code has been tested under the Ubuntu distributed libraries in 14.04 and 16.04, it has not been tested against static libraries. I do not use egs_inprz or egs_view much, it would be very much appreciated if another user could do some GUI testing please. I believe this commit to have very few bugs but I cannot be diligent enough to say it's bug free. . --- HEN_HOUSE/egs++/view/clippingplanes.cpp | 2 +- HEN_HOUSE/egs++/view/main.cpp | 3 ++- HEN_HOUSE/egs++/view/view.pro | 2 ++ .../gui/egs_configure/egs_beam_install.pro | 3 ++- HEN_HOUSE/gui/egs_configure/egs_wizard.cpp | 2 +- HEN_HOUSE/gui/egs_configure/egs_wizard.h | 6 ++--- HEN_HOUSE/gui/egs_gui/egs_compile_page.cpp | 4 +-- HEN_HOUSE/gui/egs_gui/egs_compile_page.h | 4 +-- .../gui/egs_gui/egs_configuration_page.cpp | 4 +-- .../gui/egs_gui/egs_configuration_page.h | 4 +-- HEN_HOUSE/gui/egs_gui/egs_gui.pro | 2 ++ HEN_HOUSE/gui/egs_gui/egs_gui_widget.cpp | 4 +-- HEN_HOUSE/gui/egs_gui/egs_gui_widget.h | 4 +-- HEN_HOUSE/gui/egs_gui/egs_run_page.cpp | 4 +-- HEN_HOUSE/gui/egs_gui/egs_run_page.h | 4 +-- HEN_HOUSE/gui/egs_gui/main.cpp | 2 +- HEN_HOUSE/gui/egs_gui/main_widget.cpp | 2 +- HEN_HOUSE/gui/egs_gui/main_widget.h | 2 +- HEN_HOUSE/gui/egs_gui/pegs_page.cpp | 3 ++- HEN_HOUSE/gui/egs_inprz/egs_inprz.pro | 5 ++++ .../gui/egs_inprz/include/executiondlgImpl.h | 2 +- HEN_HOUSE/gui/egs_inprz/include/inputRZImpl.h | 2 +- HEN_HOUSE/gui/egs_inprz/include/tools.h | 2 +- HEN_HOUSE/gui/egs_inprz/src/eventfilter.cpp | 2 +- .../gui/egs_inprz/src/executiondlgImpl.cpp | 2 +- HEN_HOUSE/gui/egs_inprz/src/inputRZForm.cpp | 26 +++++++++---------- HEN_HOUSE/gui/egs_inprz/src/inputRZImpl.cpp | 22 +++++++++------- HEN_HOUSE/gui/egs_inprz/src/mainRZ.cpp | 2 +- 28 files changed, 70 insertions(+), 56 deletions(-) diff --git a/HEN_HOUSE/egs++/view/clippingplanes.cpp b/HEN_HOUSE/egs++/view/clippingplanes.cpp index 85798a0e0..ce748692e 100644 --- a/HEN_HOUSE/egs++/view/clippingplanes.cpp +++ b/HEN_HOUSE/egs++/view/clippingplanes.cpp @@ -43,7 +43,7 @@ ClippingPlanesWidget::ClippingPlanesWidget(QWidget *parent, const char *name) : QWidget(parent) { setObjectName(name); setupUi(this); - planeTable->horizontalHeader()->setResizeMode(QHeaderView::Stretch); + planeTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); } ClippingPlanesWidget::~ClippingPlanesWidget() { diff --git a/HEN_HOUSE/egs++/view/main.cpp b/HEN_HOUSE/egs++/view/main.cpp index e5db1310a..7d5808775 100644 --- a/HEN_HOUSE/egs++/view/main.cpp +++ b/HEN_HOUSE/egs++/view/main.cpp @@ -29,7 +29,8 @@ */ -#include +#include +#include #include #include #include diff --git a/HEN_HOUSE/egs++/view/view.pro b/HEN_HOUSE/egs++/view/view.pro index afa5c8b15..a2276d952 100644 --- a/HEN_HOUSE/egs++/view/view.pro +++ b/HEN_HOUSE/egs++/view/view.pro @@ -32,6 +32,8 @@ LANGUAGE = C++ INCLUDEPATH += . .. ../../lib/$$my_machine +QT += widgets + HEADERS += egs_visualizer.h image_window.h egs_light.h \ clippingplanes.h viewcontrol.h geometryview.ui.h \ saveimage.h egs_user_color.h egs_track_view.h \ diff --git a/HEN_HOUSE/gui/egs_configure/egs_beam_install.pro b/HEN_HOUSE/gui/egs_configure/egs_beam_install.pro index a82022918..c3a99b1b8 100644 --- a/HEN_HOUSE/gui/egs_configure/egs_beam_install.pro +++ b/HEN_HOUSE/gui/egs_configure/egs_beam_install.pro @@ -66,7 +66,7 @@ win32 { unix { CONFIG += qt thread warn_on debug_and_release $$my_build - #LIBS += -lz #Needed if not using Qt own zlib + LIBS += -lz #Needed if not using Qt own zlib, in QT5 using Qtzlibh is not recommended according to documentation #message("CONFIG = $$CONFIG") contains( CONFIG, shared ):message( "Dynamic build..." ) contains( CONFIG, static ){ @@ -91,3 +91,4 @@ RESOURCES = egs_beam_install.qrc # resource collection file to store images in t TEMPLATE = app LANGUAGE = C++ QT += xml +QT += widgets diff --git a/HEN_HOUSE/gui/egs_configure/egs_wizard.cpp b/HEN_HOUSE/gui/egs_configure/egs_wizard.cpp index 8a46fbaf3..da01ab85f 100644 --- a/HEN_HOUSE/gui/egs_configure/egs_wizard.cpp +++ b/HEN_HOUSE/gui/egs_configure/egs_wizard.cpp @@ -45,7 +45,7 @@ using namespace std; -EGS_Wizard::EGS_Wizard(QWidget *parent, Qt::WFlags f) +EGS_Wizard::EGS_Wizard(QWidget *parent, Qt::WindowFlags f) : QWizard(parent,f), the_year("0000?"),version("0?"), custom(false) diff --git a/HEN_HOUSE/gui/egs_configure/egs_wizard.h b/HEN_HOUSE/gui/egs_configure/egs_wizard.h index add89825f..4cb928f2c 100644 --- a/HEN_HOUSE/gui/egs_configure/egs_wizard.h +++ b/HEN_HOUSE/gui/egs_configure/egs_wizard.h @@ -32,7 +32,7 @@ #ifndef EGS_WIZARD_H #define EGS_WIZARD_H -#include +#include #include #include #include @@ -56,7 +56,7 @@ class EGS_Wizard : public QWizard enum { Page_Intro, Page_Location, Page_Compiler, Page_Licence, Page_Install, Page_Conclusion }; - EGS_Wizard(QWidget * parent = 0, Qt::WFlags f = 0); + EGS_Wizard(QWidget * parent = 0, Qt::WindowFlags f = 0); ~EGS_Wizard(){} public slots: @@ -95,4 +95,4 @@ void processCustomButtonClick(int id); }; -#endif \ No newline at end of file +#endif diff --git a/HEN_HOUSE/gui/egs_gui/egs_compile_page.cpp b/HEN_HOUSE/gui/egs_gui/egs_compile_page.cpp index dfb2b67b9..ecc1e9825 100644 --- a/HEN_HOUSE/gui/egs_gui/egs_compile_page.cpp +++ b/HEN_HOUSE/gui/egs_gui/egs_compile_page.cpp @@ -53,10 +53,10 @@ const QSizePolicy preferred(QSizePolicy::Preferred,QSizePolicy::Preferred); using namespace Qt; EGS_CompilePage::EGS_CompilePage(QWidget *parent, const char *name, - WFlags f) : EGS_GUI_Widget(parent,name,f) { make(); } + WindowFlags f) : EGS_GUI_Widget(parent,name,f) { make(); } EGS_CompilePage::EGS_CompilePage(EGS_ConfigReader *cr, QWidget *parent, - const char *name, WFlags f) : EGS_GUI_Widget(cr,parent,name,f) { make(); } + const char *name, WindowFlags f) : EGS_GUI_Widget(cr,parent,name,f) { make(); } void EGS_CompilePage::make() { diff --git a/HEN_HOUSE/gui/egs_gui/egs_compile_page.h b/HEN_HOUSE/gui/egs_gui/egs_compile_page.h index ee62ca90d..32ac35b8c 100644 --- a/HEN_HOUSE/gui/egs_gui/egs_compile_page.h +++ b/HEN_HOUSE/gui/egs_gui/egs_compile_page.h @@ -53,9 +53,9 @@ class EGS_CompilePage : public EGS_GUI_Widget { public: - EGS_CompilePage(QWidget *parent = 0, const char * name = 0, Qt::WFlags f = 0); + EGS_CompilePage(QWidget *parent = 0, const char * name = 0, Qt::WindowFlags f = 0); EGS_CompilePage(EGS_ConfigReader *, - QWidget *parent = 0, const char * name = 0, Qt::WFlags f = 0); + QWidget *parent = 0, const char * name = 0, Qt::WindowFlags f = 0); ~EGS_CompilePage(){} void sendSignals(); diff --git a/HEN_HOUSE/gui/egs_gui/egs_configuration_page.cpp b/HEN_HOUSE/gui/egs_gui/egs_configuration_page.cpp index acd2ce95b..cc1100b8b 100644 --- a/HEN_HOUSE/gui/egs_gui/egs_configuration_page.cpp +++ b/HEN_HOUSE/gui/egs_gui/egs_configuration_page.cpp @@ -45,12 +45,12 @@ using namespace Qt; EGS_ConfigurationPage::EGS_ConfigurationPage(QWidget *parent, - const char *name, WFlags f) : EGS_GUI_Widget(parent,name,f) { + const char *name, WindowFlags f) : EGS_GUI_Widget(parent,name,f) { make(); } EGS_ConfigurationPage::EGS_ConfigurationPage(EGS_ConfigReader *cr, - QWidget *parent, const char *name, WFlags f) : + QWidget *parent, const char *name, WindowFlags f) : EGS_GUI_Widget(cr,parent,name,f) { make(); } void EGS_ConfigurationPage::make() { diff --git a/HEN_HOUSE/gui/egs_gui/egs_configuration_page.h b/HEN_HOUSE/gui/egs_gui/egs_configuration_page.h index a0a23720d..69b02c44c 100644 --- a/HEN_HOUSE/gui/egs_gui/egs_configuration_page.h +++ b/HEN_HOUSE/gui/egs_gui/egs_configuration_page.h @@ -47,9 +47,9 @@ class EGS_ConfigurationPage : public EGS_GUI_Widget { public: - EGS_ConfigurationPage(QWidget *parent=0, const char *name=0, Qt::WFlags f=0); + EGS_ConfigurationPage(QWidget *parent=0, const char *name=0, Qt::WindowFlags f=0); EGS_ConfigurationPage(EGS_ConfigReader *cr, - QWidget *parent=0, const char *name=0, Qt::WFlags f=0); + QWidget *parent=0, const char *name=0, Qt::WindowFlags f=0); ~EGS_ConfigurationPage(){} public slots: diff --git a/HEN_HOUSE/gui/egs_gui/egs_gui.pro b/HEN_HOUSE/gui/egs_gui/egs_gui.pro index e0fe3ed7b..a84433a6b 100644 --- a/HEN_HOUSE/gui/egs_gui/egs_gui.pro +++ b/HEN_HOUSE/gui/egs_gui/egs_gui.pro @@ -48,6 +48,8 @@ HEADERS += main_widget.h \ egs_configuration_page.h \ egs_config_reader.h +QT += widgets + MOC_DIR = .moc/$$my_machine OBJECTS_DIR = .obj/$$my_machine DESTDIR = ../../bin/$$my_machine diff --git a/HEN_HOUSE/gui/egs_gui/egs_gui_widget.cpp b/HEN_HOUSE/gui/egs_gui/egs_gui_widget.cpp index 2ab780b54..bc5051509 100644 --- a/HEN_HOUSE/gui/egs_gui/egs_gui_widget.cpp +++ b/HEN_HOUSE/gui/egs_gui/egs_gui_widget.cpp @@ -42,13 +42,13 @@ using namespace std; using namespace Qt; -EGS_GUI_Widget::EGS_GUI_Widget(QWidget *parent, const char *name,WFlags f) : +EGS_GUI_Widget::EGS_GUI_Widget(QWidget *parent, const char *name,WindowFlags f) : QWidget(parent,f), the_name(name) { config_reader = 0; killed = false; } -EGS_GUI_Widget::EGS_GUI_Widget(EGS_ConfigReader *cr, QWidget *parent, const char *name, WFlags f) : +EGS_GUI_Widget::EGS_GUI_Widget(EGS_ConfigReader *cr, QWidget *parent, const char *name, WindowFlags f) : QWidget(parent,f), the_name(name) { config_reader = cr; killed = false; diff --git a/HEN_HOUSE/gui/egs_gui/egs_gui_widget.h b/HEN_HOUSE/gui/egs_gui/egs_gui_widget.h index bd432d7ad..bd79072bb 100644 --- a/HEN_HOUSE/gui/egs_gui/egs_gui_widget.h +++ b/HEN_HOUSE/gui/egs_gui/egs_gui_widget.h @@ -44,9 +44,9 @@ class EGS_GUI_Widget : public QWidget { public: - EGS_GUI_Widget(QWidget *parent=0, const char *name=0, Qt::WFlags f=0); + EGS_GUI_Widget(QWidget *parent=0, const char *name=0, Qt::WindowFlags f=0); EGS_GUI_Widget(EGS_ConfigReader *, QWidget *parent=0, - const char *name=0, Qt::WFlags f=0); + const char *name=0, Qt::WindowFlags f=0); virtual ~EGS_GUI_Widget(){} diff --git a/HEN_HOUSE/gui/egs_gui/egs_run_page.cpp b/HEN_HOUSE/gui/egs_gui/egs_run_page.cpp index a95129ec6..6a1397803 100644 --- a/HEN_HOUSE/gui/egs_gui/egs_run_page.cpp +++ b/HEN_HOUSE/gui/egs_gui/egs_run_page.cpp @@ -55,11 +55,11 @@ using namespace Qt; -EGS_RunPage::EGS_RunPage(QWidget *parent, const char *name, WFlags f) : +EGS_RunPage::EGS_RunPage(QWidget *parent, const char *name, WindowFlags f) : EGS_GUI_Widget(parent,name,f) { make(); } EGS_RunPage::EGS_RunPage(EGS_ConfigReader *cr, - QWidget *parent, const char *name, WFlags f) : + QWidget *parent, const char *name, WindowFlags f) : EGS_GUI_Widget(cr,parent,name,f) { make(); } void EGS_RunPage::make() { diff --git a/HEN_HOUSE/gui/egs_gui/egs_run_page.h b/HEN_HOUSE/gui/egs_gui/egs_run_page.h index b2c5f03bf..e2f1d70c1 100644 --- a/HEN_HOUSE/gui/egs_gui/egs_run_page.h +++ b/HEN_HOUSE/gui/egs_gui/egs_run_page.h @@ -56,9 +56,9 @@ class EGS_RunPage : public EGS_GUI_Widget { public: - EGS_RunPage(QWidget *parent=0, const char *name=0, Qt::WFlags f=0); + EGS_RunPage(QWidget *parent=0, const char *name=0, Qt::WindowFlags f=0); EGS_RunPage(EGS_ConfigReader *cr, - QWidget *parent=0, const char *name=0, Qt::WFlags f=0); + QWidget *parent=0, const char *name=0, Qt::WindowFlags f=0); ~EGS_RunPage(){} public slots: diff --git a/HEN_HOUSE/gui/egs_gui/main.cpp b/HEN_HOUSE/gui/egs_gui/main.cpp index 2e6fd9f09..b51b02c8c 100644 --- a/HEN_HOUSE/gui/egs_gui/main.cpp +++ b/HEN_HOUSE/gui/egs_gui/main.cpp @@ -30,7 +30,7 @@ #include "main_widget.h" -#include +#include #include #include diff --git a/HEN_HOUSE/gui/egs_gui/main_widget.cpp b/HEN_HOUSE/gui/egs_gui/main_widget.cpp index af450fa8e..eb1cff9b4 100644 --- a/HEN_HOUSE/gui/egs_gui/main_widget.cpp +++ b/HEN_HOUSE/gui/egs_gui/main_widget.cpp @@ -60,7 +60,7 @@ bool configLibExists(const QString& lib ); using namespace std; -EGS_MainWidget::EGS_MainWidget(QWidget *parent, Qt::WFlags f) +EGS_MainWidget::EGS_MainWidget(QWidget *parent, Qt::WindowFlags f) : QWidget(parent,f) { diff --git a/HEN_HOUSE/gui/egs_gui/main_widget.h b/HEN_HOUSE/gui/egs_gui/main_widget.h index 334fe4cd2..eb51f2f19 100644 --- a/HEN_HOUSE/gui/egs_gui/main_widget.h +++ b/HEN_HOUSE/gui/egs_gui/main_widget.h @@ -56,7 +56,7 @@ class EGS_MainWidget : public QWidget public: - EGS_MainWidget(QWidget * parent = 0, Qt::WFlags f = 0); + EGS_MainWidget(QWidget * parent = 0, Qt::WindowFlags f = 0); ~EGS_MainWidget(){} public slots: diff --git a/HEN_HOUSE/gui/egs_gui/pegs_page.cpp b/HEN_HOUSE/gui/egs_gui/pegs_page.cpp index dc2096d35..753e71118 100644 --- a/HEN_HOUSE/gui/egs_gui/pegs_page.cpp +++ b/HEN_HOUSE/gui/egs_gui/pegs_page.cpp @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -837,7 +838,7 @@ bool TableEventHandler::eventFilter(QObject *o, QEvent *e) { return true; } else - to->eventFilter(o, e); + return false; } return false; } diff --git a/HEN_HOUSE/gui/egs_inprz/egs_inprz.pro b/HEN_HOUSE/gui/egs_inprz/egs_inprz.pro index 39deb1793..3a5f43573 100644 --- a/HEN_HOUSE/gui/egs_inprz/egs_inprz.pro +++ b/HEN_HOUSE/gui/egs_inprz/egs_inprz.pro @@ -86,6 +86,11 @@ HEADERS += include/cavinputs.h \ include/varinputs.h \ include/tools.h \ ../egs_gui/egs_config_reader.h + +QT += widgets \ + printsupport + + ###################################################################### # Automatically generated by qmake (1.03a) Thu Dec 5 10:07:20 2002 ###################################################################### diff --git a/HEN_HOUSE/gui/egs_inprz/include/executiondlgImpl.h b/HEN_HOUSE/gui/egs_inprz/include/executiondlgImpl.h index 1fe52b0d1..f7c139259 100644 --- a/HEN_HOUSE/gui/egs_inprz/include/executiondlgImpl.h +++ b/HEN_HOUSE/gui/egs_inprz/include/executiondlgImpl.h @@ -53,7 +53,7 @@ class ExecutiondlgImpl : public QDialog, public Ui::MExecutionDialog public: -ExecutiondlgImpl( QWidget* parent, const char* name, bool modal, Qt::WFlags f ); +ExecutiondlgImpl( QWidget* parent, const char* name, bool modal, Qt::WindowFlags f ); ~ExecutiondlgImpl(); diff --git a/HEN_HOUSE/gui/egs_inprz/include/inputRZImpl.h b/HEN_HOUSE/gui/egs_inprz/include/inputRZImpl.h index 7f2b29d41..a438b2809 100644 --- a/HEN_HOUSE/gui/egs_inprz/include/inputRZImpl.h +++ b/HEN_HOUSE/gui/egs_inprz/include/inputRZImpl.h @@ -83,7 +83,7 @@ class inputRZImpl : public QWidget, public Ui::InputRZForm public: inputRZImpl( QWidget* parent, const char* name, - bool modal, Qt::WFlags f ); + bool modal, Qt::WindowFlags f ); ~inputRZImpl(); diff --git a/HEN_HOUSE/gui/egs_inprz/include/tools.h b/HEN_HOUSE/gui/egs_inprz/include/tools.h index ad97f2895..5584d8039 100644 --- a/HEN_HOUSE/gui/egs_inprz/include/tools.h +++ b/HEN_HOUSE/gui/egs_inprz/include/tools.h @@ -33,7 +33,7 @@ #define TOOLS_H #include -#include +#include #include #include //qt3to4 -- BW diff --git a/HEN_HOUSE/gui/egs_inprz/src/eventfilter.cpp b/HEN_HOUSE/gui/egs_inprz/src/eventfilter.cpp index e7c0e5a62..91226f7d1 100644 --- a/HEN_HOUSE/gui/egs_inprz/src/eventfilter.cpp +++ b/HEN_HOUSE/gui/egs_inprz/src/eventfilter.cpp @@ -249,7 +249,7 @@ bool TableEvents::eventFilter( QObject *o, QEvent *e) } } } - return to->eventFilter( o, e ) ; + return false; } ComboEvents::ComboEvents( QWidget *parent, const char *name ) diff --git a/HEN_HOUSE/gui/egs_inprz/src/executiondlgImpl.cpp b/HEN_HOUSE/gui/egs_inprz/src/executiondlgImpl.cpp index e9da26d69..2b6456fb5 100644 --- a/HEN_HOUSE/gui/egs_inprz/src/executiondlgImpl.cpp +++ b/HEN_HOUSE/gui/egs_inprz/src/executiondlgImpl.cpp @@ -41,7 +41,7 @@ //qt3to4 -- BW #include -ExecutiondlgImpl::ExecutiondlgImpl( QWidget* parent, const char* name, bool modal, Qt::WFlags f ) +ExecutiondlgImpl::ExecutiondlgImpl( QWidget* parent, const char* name, bool modal, Qt::WindowFlags f ) //qt3to4 -- BW // : MExecutionDialog( parent, name, modal, f ) : QDialog(parent) diff --git a/HEN_HOUSE/gui/egs_inprz/src/inputRZForm.cpp b/HEN_HOUSE/gui/egs_inprz/src/inputRZForm.cpp index 7b7a98dc6..8fcdbd0b1 100644 --- a/HEN_HOUSE/gui/egs_inprz/src/inputRZForm.cpp +++ b/HEN_HOUSE/gui/egs_inprz/src/inputRZForm.cpp @@ -584,19 +584,19 @@ void inputRZImpl::UpDateInputRZForm( const MInputRZ* Input ) switch ( usercode ) { case cavrznrc: - cavrzRadioButton->setChecked( TRUE ); + cavrzRadioButton->setChecked( true ); usercodename = "cavrznrc"; break; case dosrznrc: - dosrzRadioButton->setChecked( TRUE ); + dosrzRadioButton->setChecked( true ); usercodename = "dosrznrc"; break; case sprrznrc: - sprrzRadioButton->setChecked( TRUE ); + sprrzRadioButton->setChecked( true ); usercodename = "sprrznrc"; break; case flurznrc: - flurzRadioButton->setChecked( TRUE ); + flurzRadioButton->setChecked( true ); usercodename = "flurznrc"; break; } @@ -2848,7 +2848,7 @@ void inputRZImpl::set_data_area() QString tmpDir; //qt3to4 -- BW //char s = QDir::separator(); - char s = QDir::separator().toAscii(); + char s = QDir::separator().toLatin1(); if ( HOMEPegsRadioButton->isChecked() ) tmpDir = ironIt( EGS_HOME + s + "pegs4" + s + "data" + s); @@ -3346,7 +3346,7 @@ QString inputRZImpl::getExecutable() //qt3to4 -- BW //char s = QDir::separator(); - char s = QDir::separator().toAscii(); + char s = QDir::separator().toLatin1(); QString executable = usercodename; if ( DebugradioButton->isChecked() ) @@ -3690,7 +3690,7 @@ void inputRZImpl::InitializeTable( QTableWidget* t, const QStringList& s) t->setHorizontalHeaderLabels(s); t->horizontalHeader()->setUpdatesEnabled( true ); //Proper way to resize table columns to fit the table -- EMH July 2015 - t->horizontalHeader()->setResizeMode(QHeaderView::Stretch); + t->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); t->installEventFilter(this);} //qt3to4 -- BW @@ -3731,7 +3731,7 @@ void inputRZImpl::InitializeTable( QTableWidget* t, const QString& s0, const QSt t->setHorizontalHeaderItem(1,new QTableWidgetItem(s1)); t->horizontalHeader()->setUpdatesEnabled( true ); //Proper way to resize table columns to fit the table -- EMH July 2015 - t->horizontalHeader()->setResizeMode(QHeaderView::Stretch); + t->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); t->installEventFilter(this); } @@ -3749,7 +3749,7 @@ void inputRZImpl::InitializeTable( QTableWidget* t, const QString& s0, t->setHorizontalHeaderItem(2, new QTableWidgetItem(s2) ); t->horizontalHeader()->setUpdatesEnabled( true ); //Proper way to resize table columns to fit the table -- EMH July 2015 - t->horizontalHeader()->setResizeMode(QHeaderView::Stretch); + t->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); t->installEventFilter(this); } @@ -3765,7 +3765,7 @@ void inputRZImpl::InitializeTwoColumnTable( QTableWidget* table) table->setHorizontalHeaderItem(1, new QTableWidgetItem("stop")); table->horizontalHeader()->setUpdatesEnabled( true ); //Proper way to resize table columns to fit the table -- EMH July 2015 - table->horizontalHeader()->setResizeMode(QHeaderView::Stretch); + table->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); table->installEventFilter(this); } @@ -3781,7 +3781,7 @@ void inputRZImpl::InitializeThreeColumnTable( QTableWidget* table, const QString table->setHorizontalHeaderItem(2, new QTableWidgetItem("stop")); table->horizontalHeader()->setUpdatesEnabled( true ); //Proper way to resize table columns to fit the table -- EMH July 2015 - table->horizontalHeader()->setResizeMode(QHeaderView::Stretch); + table->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); table->installEventFilter(this); } @@ -3958,8 +3958,8 @@ bool inputRZImpl::eventFilter(QObject *o, QEvent *e){ return true; } } - return to->eventFilter(o, e) ; - //return false; + //return to->eventFilter(o, e) ; + return false; } else{ return false; diff --git a/HEN_HOUSE/gui/egs_inprz/src/inputRZImpl.cpp b/HEN_HOUSE/gui/egs_inprz/src/inputRZImpl.cpp index dd13cb659..b56618570 100644 --- a/HEN_HOUSE/gui/egs_inprz/src/inputRZImpl.cpp +++ b/HEN_HOUSE/gui/egs_inprz/src/inputRZImpl.cpp @@ -65,7 +65,7 @@ using namespace std; #define zapM(x) cout<<"deleting "<< string(x->metaObject()->className())<< endl;if(x){delete(x);x=0;} inputRZImpl::inputRZImpl( QWidget* parent, const char* name, - bool modal, Qt::WFlags f ) + bool modal, Qt::WindowFlags f ) : QWidget(parent) { @@ -97,7 +97,7 @@ void inputRZImpl::compile_userCode() { //qt3to4 //char s = QDir::separator(); - char s = QDir::separator().toAscii(); + char s = QDir::separator().toLatin1(); QString egs_compiler = readVarFromConf("make_prog"); if ( egs_compiler.isEmpty() ) egs_compiler = "make";// default is GNU make @@ -143,7 +143,7 @@ void inputRZImpl::run_userCode() QString inpf = EGSfileName; //qt3to4 -- BW //char s = QDir::separator(); - char s = QDir::separator().toAscii(); + char s = QDir::separator().toLatin1(); QString the_user_code_area = ironIt( EGS_HOME+s+usercodename+s ); if ( EGSdir != the_user_code_area ){ @@ -406,7 +406,7 @@ void inputRZImpl::checkCompilationAbility(){ //qt3to4 -- BW //char s = QDir::separator(); - char s = QDir::separator().toAscii(); + char s = QDir::separator().toLatin1(); QString missing_files = QString(); @@ -517,7 +517,7 @@ void inputRZImpl::SetInpfileName( QString inp_name ) QString tmpDir = EGSdir; //qt3to4 -- BW //char s = QDir::separator(); - char s = QDir::separator().toAscii(); + char s = QDir::separator().toLatin1(); if ( !inp_name.isEmpty() ) { EGSfileName = ironIt( inp_name ); // may be a full path name QFileInfo fi( EGSfileName ); @@ -561,7 +561,7 @@ void inputRZImpl::OpenEGSInpFile() QString tmpDir = EGSdir; //qt3to4 -- BW //char s = QDir::separator(); - char s = QDir::separator().toAscii(); + char s = QDir::separator().toLatin1(); QDir d(tmpDir); if ( !d.exists() ) { tmpDir = GetCurrentDir( usercodename, EGS_HOME, HEN_HOUSE ); @@ -729,7 +729,7 @@ void inputRZImpl::customFFTable_singleclicked( int row, int col) { void inputRZImpl::GetMDfile() { QString tmpDir; - char s = QDir::separator().toAscii(); + char s = QDir::separator().toLatin1(); //try EGS_HOME/pegs4/data, then HEN_HOUSE/pegs4/data then $HOME/pegs4/data tmpDir = GetCurrentDir( "pegs4/data", EGS_HOME, HEN_HOUSE ); QDir d(tmpDir); @@ -746,7 +746,7 @@ void inputRZImpl::GetMDfile() void inputRZImpl::GetDFfile() { QString start_dir; - char s = QDir::separator().toAscii(); + char s = QDir::separator().toLatin1(); if(DFSearchComboBox->currentText() == "HEN_HOUSE") start_dir = ironIt(HEN_HOUSE + s + "pegs4" + s + "density_corrections" + s); else start_dir = ironIt(EGS_HOME + s + "pegs4" + s + "density_corrections" + s); @@ -973,7 +973,7 @@ void inputRZImpl::GetPEGSfile() QString tmpDir = PEGSdir; //qt3to4 -- BW //char s = QDir::separator(); - char s = QDir::separator().toAscii(); + char s = QDir::separator().toLatin1(); QDir d(tmpDir); if ( !d.exists() ) { tmpDir = GetCurrentDir( "pegs4/data", EGS_HOME, HEN_HOUSE ); @@ -1036,7 +1036,9 @@ void inputRZImpl::GetSPECfile() //qt3to4 -- BW //Q3FileDialog* fd = new Q3FileDialog(SPECdir, QString::null, this); QFileDialog* fd = new QFileDialog(this,"",SPECdir, QString()); - fd->setFilter( "SPEC files (*.spectrum *.ensrc)" ); + QStringList filters; + filters << "*.spectrum" << "*.ensrc"; + fd->setNameFilters( filters ); QString f; QStringList flst; if ( fd->exec() == QDialog::Accepted ) diff --git a/HEN_HOUSE/gui/egs_inprz/src/mainRZ.cpp b/HEN_HOUSE/gui/egs_inprz/src/mainRZ.cpp index 5f943de4e..2c2200186 100644 --- a/HEN_HOUSE/gui/egs_inprz/src/mainRZ.cpp +++ b/HEN_HOUSE/gui/egs_inprz/src/mainRZ.cpp @@ -39,7 +39,7 @@ int main( int argc, char* argv[] ) QApplication app( argc, argv); - inputRZImpl* inputRZ = new inputRZImpl(0,"egs_inprz",FALSE,0); + inputRZImpl* inputRZ = new inputRZImpl(0,"egs_inprz",false,0); inputRZ->show();