KTutorial
0.5.1
|
00001 /*************************************************************************** 00002 * Copyright (C) 2010 by Daniel Calviño Sánchez <danxuliu@gmail.com> * 00003 * Copyright (C) 2011 by Daniel Calviño Sánchez <danxuliu@gmail.com> * 00004 * Copyright (C) 2012 by Daniel Calviño Sánchez <danxuliu@gmail.com> * 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, see <http://www.gnu.org/licenses/>. * 00018 ***************************************************************************/ 00019 00020 #ifndef KTUTORIAL_EXTENDEDINFORMATION_WIDGETHIGHLIGHTER_H 00021 #define KTUTORIAL_EXTENDEDINFORMATION_WIDGETHIGHLIGHTER_H 00022 00023 #include <QTimer> 00024 #include <QWidget> 00025 00026 namespace ktutorial { 00027 namespace extendedinformation { 00028 00053 class WidgetHighlighter: public QWidget { 00054 Q_OBJECT 00055 public: 00056 00062 explicit WidgetHighlighter(QWidget* targetWidget); 00063 00072 virtual bool eventFilter(QObject* watched, QEvent* event); 00073 00074 public Q_SLOTS: 00075 00082 void start(); 00083 00089 void stop(); 00090 00091 Q_SIGNALS: 00092 00100 void stopped(extendedinformation::WidgetHighlighter* widgetHighlighter); 00101 00102 protected: 00103 00110 virtual void paintEvent(QPaintEvent* event); 00111 00112 private: 00113 00117 QWidget* mTargetWidget; 00118 00122 QTimer mTimer; 00123 00128 qreal mProgress; 00129 00133 qreal mProgressForEachTick; 00134 00138 bool mIncreasing; 00139 00143 bool mStopping; 00144 00148 int mFrameWidth; 00149 00150 private Q_SLOTS: 00151 00155 void updateProgress(); 00156 00157 }; 00158 00159 } 00160 } 00161 00162 #endif