File indexing completed on 2024-05-05 04:49:30
0001 /**************************************************************************************** 0002 * Copyright (c) 2009 Thomas Luebking <thomas.luebking@web.de> * 0003 * * 0004 * This program is free software; you can redistribute it and/or modify it under * 0005 * the terms of the GNU General Public License as published by the Free Software * 0006 * Foundation; either version 2 of the License, or (at your option) any later * 0007 * version. * 0008 * * 0009 * This program is distributed in the hope that it will be useful, but WITHOUT ANY * 0010 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * 0011 * PARTICULAR PURPOSE. See the GNU General Public License for more details. * 0012 * * 0013 * You should have received a copy of the GNU General Public License along with * 0014 * this program. If not, see <http://www.gnu.org/licenses/>. * 0015 ****************************************************************************************/ 0016 0017 #ifndef TRACKACTIONBUTTON_H 0018 #define TRACKACTIONBUTTON_H 0019 0020 class QAction; 0021 0022 #include "IconButton.h" 0023 #include <QImage> 0024 #include <QIcon> 0025 0026 class TrackActionButton : public IconButton 0027 { 0028 Q_OBJECT 0029 0030 public: 0031 explicit TrackActionButton( QWidget *parent = nullptr, const QAction *act = nullptr ); 0032 void setAction( const QAction *act ); 0033 QSize sizeHint() const override; 0034 protected: 0035 bool eventFilter( QObject *o, QEvent *e ) override; 0036 void enterEvent( QEvent * ) override; 0037 void leaveEvent( QEvent * ) override; 0038 void reloadContent( const QSize &sz ) override; 0039 private Q_SLOTS: 0040 void updateAction(); 0041 void init(); 0042 private: 0043 struct 0044 { 0045 QImage image[3]; 0046 QIcon icon; 0047 } m_icon; 0048 const QAction *m_action; 0049 }; 0050 0051 0052 #endif // end include guard