소스 검색

ctkConsole - Factorize by building layout within init() function

Jean-Christophe Fillion-Robin 14 년 전
부모
커밋
00890de30f
1개의 변경된 파일5개의 추가작업 그리고 6개의 파일을 삭제
  1. 5 6
      Libs/Widgets/ctkConsole.cpp

+ 5 - 6
Libs/Widgets/ctkConsole.cpp

@@ -107,6 +107,10 @@ void ctkConsolePrivate::init()
 
   this->CommandHistory.append("");
   this->CommandPosition = 0;
+
+  QVBoxLayout * layout = new QVBoxLayout(q);
+  layout->setMargin(0);
+  layout->addWidget(this);
 }
 
 //-----------------------------------------------------------------------------
@@ -554,9 +558,7 @@ ctkConsole::ctkConsole(QWidget* parentObject) :
   d_ptr(new ctkConsolePrivate(*this))
 {
   Q_D(ctkConsole);
-  QVBoxLayout* layout = new QVBoxLayout(this);
-  layout->setMargin(0);
-  layout->addWidget(d);
+  d->init();
 }
 
 //-----------------------------------------------------------------------------
@@ -565,9 +567,6 @@ ctkConsole::ctkConsole(ctkConsolePrivate * pimpl, QWidget* parentObject) :
 {
   Q_D(ctkConsole);
   d->init();
-  QVBoxLayout* layout = new QVBoxLayout(this);
-  layout->setMargin(0);
-  layout->addWidget(d);
 }
 
 //-----------------------------------------------------------------------------