Főoldal | Osztályhierarchia | Osztálylista | Fájllista | Osztálytagok | Fájlelemek | Kapcsolódó lapok

precisetimeedit.cc

00001 /*
00002  * SubTimer source file
00003  *  Copyright (C) 2005 Peter Salvi
00004  *   Last modification: <2005.03.23., 16:17:06>
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00019  */
00020 
00021 #include <qdatetime.h>
00022 
00023 #include "precisetimeedit.hh"
00024 #include "precisetimevalidator.hh"
00025 
00026 PreciseTimeEdit::PreciseTimeEdit(QWidget *parent, const char *name)
00027   : QLineEdit(parent, name)
00028 {
00029   ptv = new PreciseTimeValidator();
00030   setValidator(ptv);
00031   setInputMask("99:99:99.999");
00032   setText("00:00:00.000");
00033 }
00034 
00035 PreciseTimeEdit::~PreciseTimeEdit()
00036 {
00037   delete ptv;
00038 }
00039 
00040 QTime PreciseTimeEdit::time() const
00041 {
00042   int h, m, s, z;
00043   QString tmp = text();
00044   h = tmp.mid(0, 2).toInt();
00045   m = tmp.mid(3, 2).toInt();
00046   s = tmp.mid(6, 2).toInt();
00047   z = tmp.mid(9, 3).toInt();
00048   return QTime(h, m, s, z);
00049 }
00050 
00051 void PreciseTimeEdit::setTime(QTime t)
00052 {
00053   setText(t.toString("hh:mm:ss.zzz"));
00054 }

Projekt: SubTimer Készült: Wed Mar 23 22:06:53 2005 Készítette: doxygen 1.3.6