NDEVR
API Documentation
SectionIconTab.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: SectionIconTab
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "DLLInfo.h"
34#include <NDEVR/RibbonArea.h>
35#include <NDEVR/SectionTab.h>
36#include <QIcon>
37class QPushButton;
38class QLabel;
39class QPropertyAnimation;
40class QGraphicsOpacityEffect;
41class QFrame;
42namespace NDEVR
43{
44 class ImageView;
45 class Button;
46 class VerticalLabel;
47 class DockItem;
48 class QCustomLabel;
49 class TranslatedString;
54 class NDEVR_WIDGETS_API SectionIconTab : public SectionTab
55 {
56 Q_OBJECT
57 Q_PROPERTY(QColor background_color READ backgroundColor WRITE setBackgroundColor)
58 public:
64 explicit SectionIconTab(SectionContent* content, DockItem* widget);
68 void init();
69 virtual ~SectionIconTab();
74 void setFlat(bool flat);
79 void setFloatingWidget(FloatingWidget* widget) override;
84 void setSelected(bool is_selected) override;
88 void paintEvent(QPaintEvent *) override;
93 void resizeEvent(QResizeEvent *event) override;
98 void setFullscreen(bool fullscreen) override;
103 QSize sizeHint() const override;
108 QSize minimumSizeHint() const override;
113 QIcon getIcon() const override;
123 virtual TranslatedString getTitle() const override;
128 void setBackgroundColor(QColor color);
133 void mouseDoubleClickEvent(QMouseEvent* e) override;
138 void setIconID(const String& icon);
143 bool isDocked() { return m_is_docked; }
148 void setDocked(bool is_docked) override { m_is_docked = is_docked; }
154 void setLocation(RibbonArea area, bool is_docked) override;
155 public slots:
160 void setIcon(const QIcon& icon);
165 void setTitle(const TranslatedString& title);
170 void contextMenu(const QPoint& point);
175 void onVisible(bool is_visible);
196 protected:
201 QPalette::ColorRole preferredColorRoll() const;
211 bool event(QEvent *event) override;
224 protected:
228 QPropertyAnimation* m_color_animation;
233 QGraphicsOpacityEffect* m_opacity_effect;
238 };
239}
A core widget that allows the user to click one of many button types.
Definition Button.h:68
The root class that allows interface with the NDEVR API Widget Docking system.
Definition DockItem.h:56
Used with the NDEVR API Widget Docking system for widgets that are floating.
A widget that shows a raster image or icon.
Definition ImageView.h:44
Displays translated text.
The core container for objects using the NDEVR API Widget Docking system.
void updateFullscreenButton()
Updates the visibility and state of the fullscreen button.
bool isDocked()
Returns whether this tab is currently in a docked state.
void updateClosedButton()
Updates the visibility and state of the close button.
virtual TranslatedString getTitle() const override
Returns the translated title text displayed on this tab.
QPropertyAnimation * m_color_animation
Animation for background color transitions.
void updateMovable()
Updates the movable state of the tab based on the current section configuration.
void setIcon(const QIcon &icon)
Sets the icon displayed on this tab.
void updateOpacity()
Updates the opacity effect based on the tab's active and hover state.
Button * m_settings_button
Button to access settings for the section content.
void onVisible(bool is_visible)
Slot called when the visibility of the associated content changes.
void setFullscreen(bool fullscreen) override
Sets whether this tab is displayed in fullscreen mode.
void updateShowTab()
Updates the visibility of the tab based on the current section configuration.
QGraphicsOpacityEffect * m_opacity_effect
Opacity effect for inactive tab dimming.
void updateBackgroundColor()
Updates the background color based on the current selection and hover state.
SectionIconTab(SectionContent *content, DockItem *widget)
Constructs a SectionIconTab for the given section content and dock item.
void mouseDoubleClickEvent(QMouseEvent *e) override
Handles double-click events on the tab, typically toggling fullscreen.
void setFloatingWidget(FloatingWidget *widget) override
Assigns the floating widget that this tab is part of.
void updateIconSizes()
Updates the icon and button sizes based on the current tab dimensions.
QCustomLabel * m_title_label
The label displaying the tab title text.
bool m_is_hovering
Whether the mouse cursor is hovering over this tab.
QPalette::ColorRole preferredColorRoll() const
Returns the preferred palette color role for this tab's background.
void setFlat(bool flat)
Sets whether the tab should render with a flat visual style.
void paintEvent(QPaintEvent *) override
Paints the tab including its background color and rounded corners.
QSize sizeHint() const override
Returns the recommended size for this tab widget.
bool event(QEvent *event) override
Handles generic events such as palette changes and hover tracking.
void setIconID(const String &icon)
Sets the icon by its resource identifier string.
QSize minimumSizeHint() const override
Returns the minimum recommended size for this tab widget.
QIcon getIcon() const override
Returns the icon displayed on this tab.
Button * m_close_button
Button to close the associated section content.
void setLocation(RibbonArea area, bool is_docked) override
Updates the tab layout and appearance based on its dock location.
void resizeEvent(QResizeEvent *event) override
Handles resize events to update icon sizes and layout.
DockItem * m_widget
The dock item that owns this tab.
bool m_is_selected
Whether this tab is currently selected.
void contextMenu(const QPoint &point)
Shows a context menu at the given position.
bool m_is_flat
Whether the tab uses a flat visual style.
ImageView * m_icon_label
The label displaying the tab icon.
void setTitle(const TranslatedString &title)
Sets the title text displayed on this tab.
QColor backgroundColor()
Returns the current background color of this tab.
void init()
Initializes the tab's UI elements including icon, title, and action buttons.
void setDocked(bool is_docked) override
Sets whether this tab is in a docked state.
bool m_is_docked
Whether this tab is currently docked.
void updateSettingsButton()
Updates the visibility and state of the settings button.
Button * m_fullscreen_button
Button to toggle fullscreen mode.
RibbonArea m_ribbon_area
The ribbon area where this tab is located.
void setBackgroundColor(QColor color)
Sets the background color of this tab.
void setSelected(bool is_selected) override
Sets the selected state of this tab.
void updateRoundedCorners()
Updates the rounded corner radii based on the tab's docking position.
SectionTab(SectionContent *content, QWidget *parent)
Constructs a SectionTab associated with the given section content and parent widget.
The core String class for the NDEVR API.
Definition String.h:95
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.
RibbonArea
Requests a ribbon or tab area to be in a certain location and orientation relative to another widget.
Definition RibbonArea.h:71