dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
mytabbedstackwidget.h
Go to the documentation of this file.
1 
14 /*
15  * This program is free software; you can redistribute it and/or modify
16  * it under the terms of the GNU General Public License as published by
17  * the Free Software Foundation; either version 3 of the License, or
18  * (at your option) any later version.
19  *
20  * This program is distributed in the hope that it will be useful, but
21  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
22  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23  * for more details.
24  *
25  * You should have received a copy of the GNU General Public License along
26  * with this program; if not, see <http://www.gnu.org/licenses/>
27  *
28  * Additional note on redistribution: The copyright and license notices above
29  * must be maintained in each individual source file that is a derivative work
30  * of this source file; otherwise redistribution is prohibited.
31  */
32 
33 #ifndef MYTABBEDSTACKWIDGET_H
34 #define MYTABBEDSTACKWIDGET_H
35 
36 #include "utils_global.h"
37 #include <QStackedWidget>
38 #include <QListWidget>
39 
40 
41 /*
42  * MyTabbedStackWidget is a MyListWidget combined with a QStackedWidget,
43  * similar in function to QTabWidget.
44  */
45 class QTCREATOR_UTILS_EXPORT MyTabbedStackWidget : public QWidget
46 {
47  Q_OBJECT
48 
49 public:
50  MyTabbedStackWidget(QWidget *parent = nullptr, bool isVertical = false, bool iconAbove = true);
51 
52  void insertTab(int index, QWidget *tab, const QIcon &icon, const QString &label);
53  void removeTab(int index);
54  void setIconSize(int size) { m_listWidget->setIconSize(QSize(size, size)); }
55 
56  int currentIndex() const;
57 
58  void insertCornerWidget(int index, QWidget *widget);
59  void setHidden(int index, bool hide);
60 
61  QWidget * currentWidget(){return m_stackWidget->currentWidget();}
62  QWidget * getWidget(int index) {return m_stackWidget->widget(index);}
63 
64 signals:
65  void currentAboutToShow(int index,bool * proceed);
66  void currentChanged(int index);
67 
68 public slots:
69  void setCurrentIndex(int index);
70 
71 private slots:
72  void showWidget(int index);
73 
74 private:
75  QListWidget *m_listWidget;
76  QStackedWidget *m_stackWidget;
77  bool m_vertical;
78  bool m_iconAbove;
79 };
80 
81 #endif // MYTABBEDSTACKWIDGET_H
void setIconSize(int size)
QWidget * getWidget(int index)