diff --git a/YACReader/goto_dialog.cpp b/YACReader/goto_dialog.cpp index a35cbde0..cd640240 100644 --- a/YACReader/goto_dialog.cpp +++ b/YACReader/goto_dialog.cpp @@ -60,12 +60,10 @@ void GoToDialog::setupUI() void GoToDialog::goTo() { unsigned int page = pageNumber->text().toInt(); - pageNumber->clear(); - - if (page >= 1) + if (page >= 1 && page <= v->top()) { emit(goToPage(page - 1)); - - close(); + close(); + } } void GoToDialog::setNumPages(unsigned int numPages) diff --git a/YACReader/goto_flow_toolbar.cpp b/YACReader/goto_flow_toolbar.cpp index 2dc49566..3156c651 100644 --- a/YACReader/goto_flow_toolbar.cpp +++ b/YACReader/goto_flow_toolbar.cpp @@ -109,8 +109,10 @@ void GoToFlowToolBar::setTop(int numPages) void GoToFlowToolBar::goTo() { - if (edit->text().toInt() != 0) - emit(goTo(edit->text().toInt() - 1)); + unsigned int page = edit->text().toInt(); + if (page >= 1 && page <= v->top()) { + emit(goTo(page - 1)); + } } void GoToFlowToolBar::centerSlide() diff --git a/YACReader/goto_flow_widget.cpp b/YACReader/goto_flow_widget.cpp index 9b96efe6..b3178948 100644 --- a/YACReader/goto_flow_widget.cpp +++ b/YACReader/goto_flow_widget.cpp @@ -11,7 +11,7 @@ GoToFlowWidget::GoToFlowWidget(QWidget *parent) : QWidget(parent) { - mainLayout = new QVBoxLayout; + mainLayout = new QVBoxLayout(this); mainLayout->setMargin(0); mainLayout->setSpacing(0); @@ -22,11 +22,7 @@ GoToFlowWidget::GoToFlowWidget(QWidget *parent) //toolBar->installEventFilter(this); } -GoToFlowWidget::~GoToFlowWidget() -{ - delete toolBar; - delete mainLayout; -} +GoToFlowWidget::~GoToFlowWidget() { } void GoToFlowWidget::setPageNumber(int page) {