]> Creatis software - clitk.git/commitdiff
add cancel button
authordsarrut <dsarrut>
Thu, 22 Jul 2010 05:54:40 +0000 (05:54 +0000)
committerdsarrut <dsarrut>
Thu, 22 Jul 2010 05:54:40 +0000 (05:54 +0000)
vv/vvProgressDialog.cxx
vv/vvProgressDialog.h

index 7288f65e25078f55cd917ac6a323a241da3524cb..d15ac1cabc89f961fc158bc978fc08d95293e21d 100644 (file)
@@ -24,6 +24,7 @@ vvProgressDialog::vvProgressDialog(std::string message, bool show_progress)
 {
   setupUi(this);
   connect(mCancelButton, SIGNAL(rejected()), this, SLOT(reject()));
+  SetCancelButtonEnabled(false);
   textLabel->setText(message.c_str());
   if (show_progress) 
     progressBar->show();
@@ -34,6 +35,26 @@ vvProgressDialog::vvProgressDialog(std::string message, bool show_progress)
 //------------------------------------------------------------------------------
 
 
+//------------------------------------------------------------------------------
+void vvProgressDialog::SetCancelButtonEnabled(bool b)
+{
+  if (b) {
+    mCancelButton->show();
+    //setMaximumHeight(500);
+    //setMinimumHeight(80);
+    //QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
+    // sizePolicy.setHorizontalStretch(0);
+    // sizePolicy.setVerticalStretch(0);
+    // sizePolicy.setHeightForWidth(sizePolicy().hasHeightForWidth());
+    //setSizePolicy(sizePolicy);
+  }
+  else {
+    mCancelButton->hide();
+    //    setFixedHeight(80); // fixe the size when no cancel button
+  }
+}
+//------------------------------------------------------------------------------
+
 //------------------------------------------------------------------------------
 void vvProgressDialog::SetText(std::string message)
 {
index 99060412343c8daad4629d05a20f89f33283ea25..1105320bf57c991dd03e251f6254a37dfd350b0a 100644 (file)
@@ -22,6 +22,7 @@
 // vv
 #include "ui_vvProgressDialog.h"
 
+//------------------------------------------------------------------------------
 class vvProgressDialog : 
   public QDialog, 
   private Ui::vvProgressDialog
@@ -31,9 +32,11 @@ class vvProgressDialog :
   public:
   vvProgressDialog(std::string message,bool show_progress=false);
   ~vvProgressDialog() {}
+  void SetCancelButtonEnabled(bool b);
   void SetText(std::string message);
   void AddToText(std::string message);
   void SetProgress(unsigned int current,unsigned int max);
 };
+//------------------------------------------------------------------------------
 
 #endif