1 /*************************************************************************** 2 * Copyright (C) 2020 by Simone Gaiarin <simgunz@gmail.com> * 3 * * 4 * This program is free software; you can redistribute it and/or modify * 5 * it under the terms of the GNU General Public License as published by * 6 * the Free Software Foundation; either version 2 of the License, or * 7 * (at your option) any later version. * 8 ***************************************************************************/ 9 10 #ifndef ACTIONBAR_H 11 #define ACTIONBAR_H 12 13 #include <QWidgetAction> 14 15 class QAction; 16 class QWidget; 17 18 /** 19 * @short A widget action to display a set of actions in a toolbar 20 */ 21 class ActionBar : public QWidgetAction 22 { 23 Q_OBJECT 24 25 public: 26 explicit ActionBar(QObject *parent = nullptr); 27 QWidget *createWidget(QWidget *parent) override; 28 29 void addAction(QAction *action); 30 void insertAction(int pos, QAction *action); 31 void removeAction(QAction *action); 32 void recreateWidgets(); 33 34 private: 35 QList<QAction *> m_actions; 36 }; 37 38 #endif 39