From c4b1b353289d81c3e3a69b3457f277ae2106982b Mon Sep 17 00:00:00 2001 From: mzn Date: Tue, 1 Jul 2008 08:08:30 +0000 Subject: [PATCH] Fix for bug IPAL19980 (Qt4 porting. ?Build progress? dialog box doesn?t operate during importing of MED file). --- src/VISUGUI/VisuGUI_BuildProgressDlg.cxx | 65 +++++++++++++----------- src/VISUGUI/VisuGUI_BuildProgressDlg.h | 11 ++-- 2 files changed, 39 insertions(+), 37 deletions(-) diff --git a/src/VISUGUI/VisuGUI_BuildProgressDlg.cxx b/src/VISUGUI/VisuGUI_BuildProgressDlg.cxx index 8f92b264..66ae5dc9 100644 --- a/src/VISUGUI/VisuGUI_BuildProgressDlg.cxx +++ b/src/VISUGUI/VisuGUI_BuildProgressDlg.cxx @@ -37,8 +37,6 @@ #include "LightApp_Application.h" -#include - #include #include @@ -119,47 +117,43 @@ VisuGUI_BuildProgressDlg::VisuGUI_BuildProgressDlg( QWidget* theParent ): aProgressLayout->setMargin( 11 ); QLabel* aBuildEntitiesLabel = new QLabel( tr( "BUILD_ENTITIES" ), myProgressBox ); - myBuildEntitiesButton = new QtxColorButton( myProgressBox ); + myBuildEntitiesButton = new QPushButton( myProgressBox ); myBuildEntitiesButton->setEnabled( false ); myBuildEntitiesButton->setFixedSize( 30, 30 ); - //QPalette aPal = myBuildEntitiesButton->palette(); - //aPal.setColor( myBuildEntitiesButton->backgroundRole(), Qt::red ); - //myBuildEntitiesButton->setPalette( aPal ); - myBuildEntitiesButton->setColor( Qt::red ); + QPalette aPal = myBuildEntitiesButton->palette(); + aPal.setColor( myBuildEntitiesButton->backgroundRole(), Qt::red ); + myBuildEntitiesButton->setPalette( aPal ); myBuildFieldsCheckBox = new QCheckBox( tr( "BUILD_FIELDS" ), myProgressBox ); myBuildFieldsCheckBox->setChecked( aResourceMgr->booleanValue( "VISU", "build_fields", true ) ); - myBuildFieldsButton = new QtxColorButton( myProgressBox ); + myBuildFieldsButton = new QPushButton( myProgressBox ); myBuildFieldsButton->setEnabled( false ); myBuildFieldsButton->setFixedSize( 30, 30 ); - //aPal = myBuildFieldsButton->palette(); - //aPal.setColor( myBuildFieldsButton->backgroundRole(), Qt::red ); - //myBuildFieldsButton->setPalette( aPal ); - myBuildFieldsButton->setColor( Qt::red ); + aPal = myBuildFieldsButton->palette(); + aPal.setColor( myBuildFieldsButton->backgroundRole(), Qt::red ); + myBuildFieldsButton->setPalette( aPal ); connect( myBuildFieldsCheckBox, SIGNAL( clicked() ), this, SLOT( onBuildCheckBoxClicked() ) ); myBuildMinMaxCheckBox = new QCheckBox( tr( "BUILD_MINMAX" ), myProgressBox ); myBuildMinMaxCheckBox->setChecked( aResourceMgr->booleanValue( "VISU", "build_min_max", true ) ); - myBuildMinMaxButton = new QtxColorButton( myProgressBox ); + myBuildMinMaxButton = new QPushButton( myProgressBox ); myBuildMinMaxButton->setEnabled( false ); myBuildMinMaxButton->setFixedSize( 30, 30 ); - //aPal = myBuildMinMaxButton->palette(); - //aPal.setColor( myBuildMinMaxButton->backgroundRole(), Qt::red ); - //myBuildMinMaxButton->setPalette( aPal ); - myBuildMinMaxButton->setColor( Qt::red ); + aPal = myBuildMinMaxButton->palette(); + aPal.setColor( myBuildMinMaxButton->backgroundRole(), Qt::red ); + myBuildMinMaxButton->setPalette( aPal ); connect( myBuildMinMaxCheckBox, SIGNAL( clicked() ), this, SLOT( onBuildCheckBoxClicked() ) ); myBuildGroupsCheckBox = new QCheckBox( tr( "BUILD_GROUPS" ), myProgressBox ); myBuildGroupsCheckBox->setChecked( aResourceMgr->booleanValue( "VISU", "build_groups", true ) ); - myBuildGroupsButton = new QtxColorButton( myProgressBox ); + myBuildGroupsButton = new QPushButton( myProgressBox ); myBuildGroupsButton->setEnabled( false ); myBuildGroupsButton->setFixedSize( 30, 30 ); - //aPal = myBuildGroupsButton->palette(); - //aPal.setColor( myBuildGroupsButton->backgroundRole(), Qt::red ); - //myBuildGroupsButton->setPalette( aPal ); - myBuildGroupsButton->setColor( Qt::red ); + aPal = myBuildGroupsButton->palette(); + aPal.setColor( myBuildGroupsButton->backgroundRole(), Qt::red ); + myBuildGroupsButton->setPalette( aPal ); connect( myBuildGroupsCheckBox, SIGNAL( clicked() ), this, SLOT( onBuildCheckBoxClicked() ) ); @@ -173,6 +167,8 @@ VisuGUI_BuildProgressDlg::VisuGUI_BuildProgressDlg( QWidget* theParent ): aProgressLayout->addWidget( myBuildGroupsButton, 3, 1 ); // Time + myTime = QTime( 0, 0, 0, 0 ); + myTimeBox = new QGroupBox( tr( "IMPORT_TIME" ), this ); aTopLayout->addWidget( myTimeBox ); //myTimeBox->setColumnLayout( 0, Qt::Vertical ); @@ -187,10 +183,12 @@ VisuGUI_BuildProgressDlg::VisuGUI_BuildProgressDlg( QWidget* theParent ): myTimeLCDNumber = new QLCDNumber( myTimeBox ); myTimeLCDNumber->setSegmentStyle( QLCDNumber::Filled ); - QPalette aPal = myTimeLCDNumber->palette(); - aPal.setColor( myTimeLCDNumber->backgroundRole(), Qt::black ); - aPal.setColor( myTimeLCDNumber->foregroundRole(), Qt::white ); - myTimeLCDNumber->setPalette( aPal ); + myTimeLCDNumber->setStyleSheet( "color: white; background-color: black" ); + //QPalette aPal = myTimeLCDNumber->palette(); + //aPal.setColor( myTimeLCDNumber->backgroundRole(), Qt::black ); + //aPal.setColor( myTimeLCDNumber->foregroundRole(), Qt::white ); + //myTimeLCDNumber->setPalette( aPal ); + myTimeLCDNumber->setNumDigits( 8 ); myTimeLCDNumber->display( myTime.toString( "hh:mm:ss.zzz" ) ); @@ -352,6 +350,11 @@ void VisuGUI_BuildProgressDlg::onTimer() if( aBuildAtOnce ) { + updateButton( myBuildEntitiesButton, true ); + updateButton( myBuildFieldsButton, true ); + updateButton( myBuildMinMaxButton, true ); + updateButton( myBuildGroupsButton, true ); + QApplication::restoreOverrideCursor(); QTime aTime; @@ -376,10 +379,10 @@ void VisuGUI_BuildProgressDlg::onTimer() } } -void VisuGUI_BuildProgressDlg::updateButton( QtxColorButton* theButton, bool theIsDone ) +void VisuGUI_BuildProgressDlg::updateButton( QPushButton* theButton, bool theIsDone ) { - //QPalette aPal = theButton->palette(); - QColor aCurrentColor = theButton->color(); + QPalette aPal = theButton->palette(); + QColor aCurrentColor = aPal.color( theButton->backgroundRole() ); if( aCurrentColor == Qt::gray || aCurrentColor == Qt::green ) return; @@ -398,8 +401,8 @@ void VisuGUI_BuildProgressDlg::updateButton( QtxColorButton* theButton, bool the aNewColor.setRgb( 255, gNew, 0 ); } - //aPal.setColor( theButton->backgroundRole(), aNewColor ); - theButton->setColor( aNewColor ); + aPal.setColor( theButton->backgroundRole(), aNewColor ); + theButton->setPalette( aPal ); } void VisuGUI_BuildProgressDlg::done( int r ) diff --git a/src/VISUGUI/VisuGUI_BuildProgressDlg.h b/src/VISUGUI/VisuGUI_BuildProgressDlg.h index b5fc4089..5333d363 100644 --- a/src/VISUGUI/VisuGUI_BuildProgressDlg.h +++ b/src/VISUGUI/VisuGUI_BuildProgressDlg.h @@ -41,7 +41,6 @@ class QLineEdit; class QPushButton; class QTimer; -class QtxColorButton; //! Build Progress Dialog. class VisuGUI_BuildProgressDlg : public QDialog @@ -74,7 +73,7 @@ protected slots: void onBuildCheckBoxClicked(); private: - void updateButton( QtxColorButton*, bool ); + void updateButton( QPushButton*, bool ); private: VISU::Result_var myResult; @@ -92,16 +91,16 @@ private: QGroupBox* myProgressBox; - QtxColorButton* myBuildEntitiesButton; + QPushButton* myBuildEntitiesButton; QCheckBox* myBuildFieldsCheckBox; - QtxColorButton* myBuildFieldsButton; + QPushButton* myBuildFieldsButton; QCheckBox* myBuildMinMaxCheckBox; - QtxColorButton* myBuildMinMaxButton; + QPushButton* myBuildMinMaxButton; QCheckBox* myBuildGroupsCheckBox; - QtxColorButton* myBuildGroupsButton; + QPushButton* myBuildGroupsButton; QGroupBox* myTimeBox; QLCDNumber* myTimeLCDNumber; -- 2.39.2