2 * This file is a part of QComicBook.
4 * Copyright (C) 2005-2006 Pawel Stolowski <yogin@linux.bydg.org>
6 * QComicBook is free software; you can redestribute it and/or modify it
7 * under terms of GNU General Public License by Free Software Foundation.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY. See GPL for more details.
13 #include "pagenumberedit.h"
14 #include <qvalidator.h>
16 using namespace QComicBook;
18 PageNumberEdit::PageNumberEdit(QWidget *parent, int val, int max): QLineEdit(parent)
21 //setFocusPolicy(QWidget::ClickFocus);
22 validator = new QIntValidator(1, max, this);
23 setValidator(validator);
28 setText(QString::number(val));
29 connect(this, SIGNAL(returnPressed()), this, SLOT(onReturn()));
32 PageNumberEdit::~PageNumberEdit()
36 void PageNumberEdit::setMax(int n)
41 void PageNumberEdit::onReturn()
43 emit pageSelected(pageNumber());
46 int PageNumberEdit::pageNumber() const
48 return text().toInt() - 1;
51 void PageNumberEdit::selectAll()
53 //do nothing - just override default QLineEdit behavior