NDEVR
API Documentation
QCustomToolBox.h
1/*--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: Widgets
28File: QCustomTabWidget
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include <NDEVR/ContainerWidget.h>
34namespace NDEVR
35{
37 class TranslatedString;
43 class NDEVR_WIDGETS_API QCustomToolBox : public ContainerWidgetBase
44 {
45 Q_OBJECT
46 public:
51 explicit QCustomToolBox(QWidget* parent = nullptr);
52 virtual ~QCustomToolBox();
58 void setMenuMode(bool menu_mode);
59
65 uint04 addWidget(QWidget* child) override;
71 int addItem(QWidget* widget);
78 int addItem(QWidget* widget, const QString&);
85 int addItem(QWidget* widget, const TranslatedString&);
93 int addItem(QWidget* widget, const QIcon& icon, const QString& label);
94
101 int insertItem(int index, QWidget* widget);
109 int insertItem(int index, QWidget* widget, const QString&);
117 int insertItem(int index, QWidget* widget, const TranslatedString&);
126 int insertItem(int index, QWidget* widget, const QIcon& icon, const QString& label);
127
133 SectionContent* content(int index) const;
139 QWidget* removeItem(int index);
144 void removeItem(QWidget* widget);
145
151 bool isItemEnabled(int index) const;
157 void setItemEnabled(int index, bool);
158
164 QString itemText(int index) const;
170 void setItemText(int index, const QString&);
171
177 QIcon tabIcon(int index) const;
183 void setTabIcon(int index, const QIcon& icon);
189 void setTabToolTip(int index, const QString& tip);
195 QString tabToolTip(int index) const;
196
202 void setTabWhatsThis(int index, const QString& text);
208 QString tabWhatsThis(int index) const;
209
214 int currentIndex() const;
219 QWidget* currentWidget() const;
225 QWidget* widget(int index) const;
230 QWidget* tabArea() const;
236 int indexOf(QWidget* widget) const;
241 int count() const;
251 void setCurrentWidget(QWidget* widget);
256 void setupAsBoxWidget(bool is_box_widget);
261 void setTabVisible(bool tab_visible);
266 void setTabLock(bool lock_tab);
271 void setTabBarAutoHide(bool enabled);
272
276 void clear();
277 protected:
279 QPointer<SectionWidget> m_main_section;
281 signals:
286 void currentTabChangedSignal(int index);
287 public Q_SLOTS:
292 void setCurrentIndexSlot(int index);
298 };
299}
ContainerWidgetBase(QWidget *parent=nullptr)
Constructs a ContainerWidgetBase with the given parent widget.
A hash-based key-value store, useful for quick associative lookups.
Definition Dictionary.h:64
Provides a wrapper for a widget that can be docked inside a Container or floated as a top-level windo...
int addItem(QWidget *widget, const QString &)
Adds an item with a text label.
bool isItemEnabled(int index) const
Checks whether the item at the given index is enabled.
QWidget * widget(int index) const
Returns the widget at the given item index.
QIcon tabIcon(int index) const
Returns the icon of the tab at the given index.
QString itemText(int index) const
Returns the text label of the item at the given index.
void setItemText(int index, const QString &)
Sets the text label of the item at the given index.
void setMenuMode(bool menu_mode)
Sets whether the toolbox operates in menu mode, where items behave like a collapsible menu instead of...
void clear()
Removes all items from the toolbox.
SectionContent * content(int index) const
Returns the section content at the given item index.
void setCurrentWidget(QWidget *widget)
Sets the currently selected item by widget.
void setTabToolTip(int index, const QString &tip)
Sets the tooltip text for the tab at the given index.
int currentIndex() const
Returns the index of the currently selected item.
int indexOf(QWidget *widget) const
Returns the index of the item containing the given widget.
int insertItem(int index, QWidget *widget, const TranslatedString &)
Inserts an item at the given index with a translated label.
QWidget * removeItem(int index)
Removes and returns the widget at the given index.
uint04 addWidget(QWidget *child) override
Adds a widget as a new item in the toolbox.
int insertItem(int index, QWidget *widget)
Inserts an item at the given index with auto-generated label.
void setItemEnabled(int index, bool)
Enables or disables the item at the given index.
void setCurrentIndexSlot(int index)
Slot to set the current item by index.
void setupAsBoxWidget(bool is_box_widget)
Configures the toolbox to display as a box widget layout.
void setTabIcon(int index, const QIcon &icon)
Sets the icon of the tab at the given index.
void removeItem(QWidget *widget)
Removes the item containing the given widget.
void currentTabChangedSignal(int index)
Signal emitted when the current item changes.
QString tabWhatsThis(int index) const
Returns the "What's This?" help text for the tab at the given index.
void setTabBarAutoHide(bool enabled)
Sets whether the tab bar automatically hides when only one item is present.
int addItem(QWidget *widget, const QIcon &icon, const QString &label)
Adds an item with an icon and text label.
int addItem(QWidget *widget)
Adds an item with auto-generated label.
QWidget * currentWidget() const
Returns the widget of the currently selected item.
QString tabToolTip(int index) const
Returns the tooltip text for the tab at the given index.
int count() const
Returns the number of items in the toolbox.
QWidget * tabArea() const
Returns the tab area widget used for item headers.
RibbonArea m_main_ribbon_area
The ribbon area configuration for the toolbox layout.
Dictionary< QWidget *, QCustomDockWidget * > m_managed_section_content
Maps widgets to their managed dock widget containers.
void setCurrentWidgetSlot(QWidget *widget)
Slot to set the current item by widget.
void setTabWhatsThis(int index, const QString &text)
Sets the "What's This?" help text for the tab at the given index.
void setCurrentIndex(uint04 index)
Sets the currently selected item by index.
int insertItem(int index, QWidget *widget, const QIcon &icon, const QString &label)
Inserts an item at the given index with an icon and text label.
QPointer< SectionWidget > m_main_section
The main section widget hosting the toolbox content.
void setTabVisible(bool tab_visible)
Sets whether the tab headers are visible.
void setTabLock(bool lock_tab)
Sets whether the tab headers are locked, preventing user tab switching.
QCustomToolBox(QWidget *parent=nullptr)
Constructs a toolbox widget.
int addItem(QWidget *widget, const TranslatedString &)
Adds an item with a translated label.
int insertItem(int index, QWidget *widget, const QString &)
Inserts an item at the given index with a text label.
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
The primary namespace for the NDEVR SDK.
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
RibbonArea
Requests a ribbon or tab area to be in a certain location and orientation relative to another widget.
Definition RibbonArea.h:71