void MultiPageLayout::addPage( Page * page, int pageIndex, PagePosition position ) { PageView *view = new PageView(page); view->setSceneRect(0,0,page->width(),page->height()); int fromCol, columnSpan; switch(position) { case SinglePage: fromCol = 2; columnSpan = 2; break; case DoublePageFirst: fromCol = 2; columnSpan = 1; break; case DoublePageSecond: fromCol = 3; columnSpan = 1; break; } view->setZoom(zoom); connect(this,SIGNAL(zoomChanged(double)),view,SLOT(setZoom(double))); addWidget( view , 1, fromCol, 1, columnSpan, Qt::AlignCenter ); PageControlWidget *control = new PageControlWidget(book, page); addWidget(control,2,fromCol,1,columnSpan, Qt::AlignCenter); switch(position) { case SinglePage: case DoublePageFirst: if(bSwapDirection) { connect(control,SIGNAL(addPage()),this,SLOT(addPageAfterSecond())); connect(control,SIGNAL(removePage()),this,SLOT(removeSecondPage())); connect(control,SIGNAL(addPageFromTemplate(LayoutTemplate*)),this,SLOT(addPageAfterSecond(LayoutTemplate*))); } else { connect(control,SIGNAL(addPage()),this,SLOT(addPageAfterFirst())); connect(control,SIGNAL(removePage()),this,SLOT(removeFirstPage())); connect(control,SIGNAL(addPageFromTemplate(LayoutTemplate*)),this,SLOT(addPageAfterFirst(LayoutTemplate*))); } break; case DoublePageSecond: if(bSwapDirection) { connect(control,SIGNAL(addPage()),this,SLOT(addPageAfterFirst())); connect(control,SIGNAL(removePage()),this,SLOT(removeFirstPage())); connect(control,SIGNAL(addPageFromTemplate(LayoutTemplate*)),this,SLOT(addPageAfterFirst(LayoutTemplate*))); } else {