1 | /* |
2 | * kPPP: A pppd front end for the KDE project |
3 | * |
4 | * $Id$ |
5 | * |
6 | * Copyright (C) 1997 Bernd Johannes Wuebben |
7 | * wuebben@math.cornell.edu |
8 | * |
9 | * based on EzPPP: |
10 | * Copyright (C) 1997 Jay Painter |
11 | * |
12 | * This library is free software; you can redistribute it and/or |
13 | * modify it under the terms of the GNU Library General Public |
14 | * License as published by the Free Software Foundation; either |
15 | * version 2 of the License, or (at your option) any later version. |
16 | * |
17 | * This library is distributed in the hope that it will be useful, |
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
20 | * Library General Public License for more details. |
21 | * |
22 | * You should have received a copy of the GNU Library General Public |
23 | * License along with this program; if not, write to the Free |
24 | * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
25 | */ |
26 | |
27 | #include "iplined.h" |
28 | |
29 | IPLineEdit::IPLineEdit( QWidget *parent, const char *name ) |
30 | : KRestrictedLine(parent) |
31 | { |
32 | setValidChars(QString("0123456789." )); |
33 | setObjectName(name); |
34 | setMaxLength(3 * 4 + 1 * 3); |
35 | } |
36 | |
37 | QSize IPLineEdit::sizeHint() const { |
38 | QFontMetrics fm = fontMetrics(); |
39 | |
40 | QSize s; |
41 | s.setHeight(QLineEdit::sizeHint().height()); |
42 | s.setWidth(fm.boundingRect("888.888.888.888XX" ).width()); |
43 | return s; |
44 | } |
45 | |