]> Creatis software - bbtk.git/blob - kernel/src/bbtkQtBlackBoxDialog.cxx
Qt black boxes updated
[bbtk.git] / kernel / src / bbtkQtBlackBoxDialog.cxx
1 #ifdef USE_QT
2
3 #include "bbtkQtBlackBoxDialog.h"
4 #include "bbtkQtBlackBox.h"
5
6 namespace bbtk
7 {
8
9
10   //=========================================================================
11   QtBlackBoxDialog::QtBlackBoxDialog(QtBlackBox::Pointer box,
12                                      QWidget *parent,
13                                      const std::string& title,
14                                      int width, int height)
15
16     :
17     QDialog(parent),
18     mBox(box)
19                                     //    QDialog( parent )
20   {
21     bbtkDebugMessage("widget",9,"["<<
22                      box->bbGetName()<<"] QtBlackBoxDialog("<<parent<<",\""
23                      <<title<<"\","<<width<<"x"<<height<<")"<<std::endl);
24     Qt::IncNbWindowsAlive();
25     // Sets up the GUI inherited from Ui::bbtkQtblackBoxDialog
26     setupUi(this);
27     resize ( width  , height );
28     setWindowTitle(title.c_str());
29     
30     ///
31     box->bbSetWindow(this);
32    // Create the widget
33     box->bbUserCreateWidget(widget);
34
35     // Insert into the layout
36     horizontalLayout->addWidget(box->bbGetOutputWidget());
37
38  
39     //    updateGeometry();
40
41   }
42   //=========================================================================
43   
44  
45   //=========================================================================
46   QtBlackBoxDialog::~QtBlackBoxDialog()
47   {
48     if (mBox.lock())
49       bbtkDebugMessage("widget",9,"["<<mBox.lock()->bbGetName()
50                        <<"] $$$$$$$$$$$$$$$$$$$ ~QtBlackBoxDialog()"
51                        <<std::endl);
52     else 
53       bbtkDebugMessage("widget",9,"[DEAD] $$$$$$$$$$$$$$$$$$$$$ ~QtBlackBoxDialog()"<<std::endl);
54     //bbtkDebugMessage("widget",9,"WxFrame::~WxFrame()"<<std::endl);
55     if (mBox.lock()) mBox.lock()->bbSetWindow(0); 
56     Qt::DecNbWindowsAlive();
57   }
58   //=========================================================================
59
60 }
61 #endif
62