PeriDyno 1.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Builder.h
Go to the documentation of this file.
1/*
2 TabToolbar - a small utility library for Qt, providing tabbed toolbars
3 Copyright (C) 2018 Oleksii Sierov
4
5 TabToolbar is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 TabToolbar is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with TabToolbar. If not, see <http://www.gnu.org/licenses/>.
17*/
18#ifndef TT_BUILDER_H
19#define TT_BUILDER_H
20#include <QToolButton>
21#include <QString>
22#include <QAction>
23#include <QMenu>
24#include <QMap>
25#include <QWidget>
26#include <functional>
27
28#include "API.h"
29
30class QJsonObject;
31
32namespace tt
33{
34
35class TabToolbar;
36
37class TT_API Builder : public QObject
38{
39 Q_OBJECT
40public:
41 explicit Builder(QWidget* parent);
42
43 TabToolbar* CreateTabToolbar(const QString& configPath);
44 void SetCustomWidgetCreator(const QString& name, const std::function<QWidget*()>& creator);
45 void SetCustomWidgetCreator(const QString& name, const std::function<QWidget*(const QJsonObject&)>& creator);
46
47 QWidget* operator[](const QString& widgetName) const;
48
49private:
50 QMap<QString, QWidget*> guiWidgets;
51 QMap<QString, std::function<QWidget*(const QJsonObject&)>> customWidgetCreators;
52};
53
54}
55#endif
void SetCustomWidgetCreator(const QString &name, const std::function< QWidget *()> &creator)
Definition Builder.cpp:45
Builder(QWidget *parent)
Definition Builder.cpp:36
QMap< QString, QWidget * > guiWidgets
Definition Builder.h:50
QWidget * operator[](const QString &widgetName) const
Definition Builder.cpp:40
QMap< QString, std::function< QWidget *(const QJsonObject &)> > customWidgetCreators
Definition Builder.h:51
TabToolbar * CreateTabToolbar(const QString &configPath)
Definition Builder.cpp:55
Definition Builder.h:33