File indexing completed on 2024-12-15 04:00:59
0001 /* 0002 * SPDX-FileCopyrightText: 2019-2023 Mattia Basaglia <dev@dragon.best> 0003 * 0004 * SPDX-License-Identifier: GPL-3.0-or-later 0005 */ 0006 0007 #ifndef BETTER_STACKED_WIDGET_HPP 0008 #define BETTER_STACKED_WIDGET_HPP 0009 0010 #include <QWidget> 0011 #include <memory> 0012 0013 namespace glaxnimate::android { 0014 0015 /** 0016 * @brief Drop-in replacement for QToolBox but that doesn't look like utter crap 0017 */ 0018 class BetterToolboxWidget : public QWidget 0019 { 0020 Q_OBJECT 0021 0022 public: 0023 explicit BetterToolboxWidget(QWidget *parent = nullptr); 0024 ~BetterToolboxWidget(); 0025 0026 QWidget* addItem(const QIcon& icon, const QString& text); 0027 void addItem(QWidget* widget, const QIcon& icon, const QString& text); 0028 void addItem(QWidget* widget, const QString& text); 0029 void setItemText(int index, const QString& text); 0030 int count() const; 0031 0032 QSize sizeHint() const override; 0033 0034 protected: 0035 bool event(QEvent *event) override; 0036 0037 private: 0038 class Private; 0039 std::unique_ptr<Private> d; 0040 }; 0041 0042 0043 } // namespace glaxnimate::android 0044 #endif // BETTER_STACKED_WIDGET_HPP