Warning, file /frameworks/kwidgetsaddons/src/kanimatedbutton.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 This file is part of the KDE libraries 0003 SPDX-FileCopyrightText: 2000 Kurt Granroth <granroth@kde.org> 0004 SPDX-FileCopyrightText: 2006 Hamish Rodda <rodda@kde.org> 0005 0006 SPDX-License-Identifier: LGPL-2.0-only 0007 */ 0008 #ifndef KANIMATEDBUTTON_H 0009 #define KANIMATEDBUTTON_H 0010 0011 #include <QToolButton> 0012 #include <kwidgetsaddons_export.h> 0013 #include <memory> 0014 0015 /** 0016 * @class KAnimatedButton kanimatedbutton.h KAnimatedButton 0017 * 0018 * @short An extended version of QToolButton which can display an animation. 0019 * 0020 * This widget extends QToolButton with the ability to display an animation. 0021 * All you need to do is pass along a path to a file containing an animation, 0022 * it can be anything supported by QMovie, or a picture containing all the 0023 * frames of the animation next to each other (each frame being assumed of 0024 * having the same size). 0025 * 0026 * @author Kurt Granroth <granroth@kde.org> 0027 */ 0028 class KWIDGETSADDONS_EXPORT KAnimatedButton : public QToolButton 0029 { 0030 Q_OBJECT 0031 Q_PROPERTY(QString animationPath READ animationPath WRITE setAnimationPath) 0032 0033 public: 0034 /** 0035 * Construct an animated tool button. 0036 * 0037 * @param parent The parent widget 0038 */ 0039 explicit KAnimatedButton(QWidget *parent = nullptr); 0040 0041 /** 0042 * Destructor 0043 */ 0044 ~KAnimatedButton() override; 0045 0046 /** 0047 * Returns the path used to load the animation 0048 */ 0049 QString animationPath() const; 0050 0051 /** 0052 * Sets the path to the file which contains the animation to load. 0053 * 0054 * @param path The path of the file containing the animation 0055 */ 0056 void setAnimationPath(const QString &path); 0057 0058 public Q_SLOTS: 0059 /** 0060 * Starts the animation from frame 1 0061 */ 0062 void start(); 0063 0064 /** 0065 * Stops the animation. This will also reset the widget to frame 1. 0066 */ 0067 void stop(); 0068 0069 private: 0070 std::unique_ptr<class KAnimatedButtonPrivate> const d; 0071 0072 Q_DISABLE_COPY(KAnimatedButton) 0073 }; 0074 0075 #endif // KANIMATEDBUTTON_H