3ds Max C++ API Reference
QmaxMainWindow Class Reference

This class is used by 3ds Max for its docking UI and should be used as replacement for the standard QMainWindow. More...

#include <QmaxMainWindow.h>

+ Inheritance diagram for QmaxMainWindow:

Public Types

enum  QmaxDockFlag {
  DontSaveCUIContent = 0x1 , SystemWindow = 0x2 , HideInVisiblityMenu = 0x4 , ShowInExpertMode = 0x8 ,
  DestroyOnCUIChange = 0x10 , NoDockFlags = 0
}
 
enum  QmaxDockType { Window , Toolbar , Menu }
 

Public Slots

void setDockingLocked (bool state)
 Changes the dockingLocked state. More...
 

Public Member Functions

 QmaxMainWindow (QWidget *parent=nullptr, Qt::WindowFlags flags=0)
 
virtual ~QmaxMainWindow () override
 
void loadLayout (const QString &fileName)
 Loads a docking layout from a specified file. More...
 
void saveLayout (const QString &fileName) const
 Saves the current docking layout to a specified file. More...
 
QList< QToolBar * > getToolBars () const
 Returns a list with the toolbars attached to this main window. More...
 
QList< QDockWidget * > getDockWidgets () const
 Returns a list with the dock widgets attached to this main window. More...
 
bool dockingLocked () const
 Determines whether the docked toolbars and dockwidgets can be moved around. More...
 
void expertMode (bool on)
 This method is for internal use only. More...
 
virtual QMenu * createPopupMenu () override
 

Static Public Member Functions

static QString layoutFileExtension ()
 Returns the file extension for a 3ds Max docking layout file. More...
 
static void setMaxDockType (QWidget *widget, QmaxDockType dockType)
 Sets the 3ds Max dock type on a QToolBar or QDockWidget. More...
 
static QmaxDockType maxDockType (const QWidget *widget)
 Returns the 3ds Max dock type for a QToolBar or QDockWidget. More...
 
static void setMaxDockFlags (QWidget *widget, QmaxDockFlags dockFlags)
 Sets the 3ds Max specific dock flags on a QToolBar or QDockWidget. More...
 
static QmaxDockFlags maxDockFlags (const QWidget *widget)
 Returns the 3ds Max specific dock flags for a QToolBar or QDockWidget. More...
 
static void addMaxDockFlags (QWidget *widget, QmaxDockFlags dockFlags)
 Adds the 3ds Max specific dock flags on a QToolBar or QDockWidget. More...
 
static void makeToolBarFloating (QToolBar *toolBar, const QPoint &pos=QPoint())
 Makes a docked toolbar floating at the specified screen position. More...
 
static Qt::ToolBarArea getToolBarArea (QToolBar *toolbar)
 Returns the toolbar area for a QToolBar. More...
 
static Qt::DockWidgetArea getDockWidgetArea (QDockWidget *dockwidget)
 Returns the docking area for a QDockWidget. More...
 
static QmaxDockingWinHostgetDockingWinHost (QToolBar *toolbar)
 Retrieves the QmaxDockingWinHost if the given toolbar hosts a legacy win32 control. More...
 
static ICustToolbargetICustToolbar (QToolBar *toolbar)
 Retrieves the legacy 3ds Max toolbar if the given QToolBar hosts one. More...
 

Protected Member Functions

bool eventFilter (QObject *obj, QEvent *evt) override
 
void childEvent (QChildEvent *evt) override
 
bool event (QEvent *evt) override
 
bool nativeEvent (const QByteArray &eventType, void *message, long *result) override
 
bool addDefaultDockOptions (QWidget *dockWidget, QMenu *menu) const
 Adds the default docking options for a given toolbar or dock widget to the specified menu. More...
 
QWidget * dockWidgetUnderMouse () const
 Returns the child toolbar or dock widget which is currently under the mouse. More...
 

Properties

bool dockingLocked
 Determines whether the docked toolbars and dockwidgets can be moved around and/or made floating. More...
 

Detailed Description

This class is used by 3ds Max for its docking UI and should be used as replacement for the standard QMainWindow.

Member Enumeration Documentation

◆ QmaxDockFlag

Enumerator
DontSaveCUIContent 
SystemWindow 
HideInVisiblityMenu 
ShowInExpertMode 
DestroyOnCUIChange 
NoDockFlags 
51  {
52  DontSaveCUIContent = 0x1,
53  SystemWindow = 0x2,
54  HideInVisiblityMenu = 0x4, // hides toggle visibility menu entry in main window popup
55  ShowInExpertMode = 0x8,
56  DestroyOnCUIChange = 0x10, // indicates if a dockwidget should be destroyed when a new CUI scheme is loaded, only makes sense for content that can change dynamically in different workspaces
57  NoDockFlags = 0
58  };
@ HideInVisiblityMenu
Definition: QmaxMainWindow.h:54
@ SystemWindow
Definition: QmaxMainWindow.h:53
@ ShowInExpertMode
Definition: QmaxMainWindow.h:55
@ DestroyOnCUIChange
Definition: QmaxMainWindow.h:56
@ NoDockFlags
Definition: QmaxMainWindow.h:57
@ DontSaveCUIContent
Definition: QmaxMainWindow.h:52

◆ QmaxDockType

Enumerator
Window 
Toolbar 
Menu 
63  {
64  Window,
65  Toolbar,
66  Menu
67  };
@ Toolbar
Definition: QmaxMainWindow.h:65
@ Menu
Definition: QmaxMainWindow.h:66
@ Window
Definition: QmaxMainWindow.h:64

Constructor & Destructor Documentation

◆ QmaxMainWindow()

QmaxMainWindow ( QWidget *  parent = nullptr,
Qt::WindowFlags  flags = 0 
)
explicit

◆ ~QmaxMainWindow()

virtual ~QmaxMainWindow ( )
overridevirtual

Member Function Documentation

◆ loadLayout()

void loadLayout ( const QString &  fileName)

Loads a docking layout from a specified file.

Parameters
fileNameThe full path to a docking layout file that should be loaded.
See also
saveLayout()

◆ saveLayout()

void saveLayout ( const QString &  fileName) const

Saves the current docking layout to a specified file.

Parameters
fileNameThe full path to the docking layout file that should be saved.
See also
loadLayout()

◆ layoutFileExtension()

static QString layoutFileExtension ( )
inlinestatic

Returns the file extension for a 3ds Max docking layout file.

See also
loadLayout(), saveLayout()
84 { return ".layout"; }

◆ getToolBars()

QList< QToolBar* > getToolBars ( ) const

Returns a list with the toolbars attached to this main window.

See also
getDockWidgets()

◆ getDockWidgets()

QList< QDockWidget* > getDockWidgets ( ) const

Returns a list with the dock widgets attached to this main window.

See also
getToolBars()

◆ dockingLocked()

bool dockingLocked ( ) const

Determines whether the docked toolbars and dockwidgets can be moved around.

The basic idea of having the docking locked mode is to prevent all docked toolbars and dockwidgets to be moved or made floating. Already floating toolbars and dockwidgets can be moved around but not be docked back into the main window.

Note that docking locked does not prevent the user from resize the UI.

◆ setMaxDockType()

static void setMaxDockType ( QWidget *  widget,
QmaxDockType  dockType 
)
static

Sets the 3ds Max dock type on a QToolBar or QDockWidget.

Parameters
[in]widgetThe QToolBar or QDockWidget on which the dock type should be set.
[in]dockTypeThe dock type of the actual docking content.
See also
maxDockType()

◆ maxDockType()

static QmaxDockType maxDockType ( const QWidget *  widget)
static

Returns the 3ds Max dock type for a QToolBar or QDockWidget.

Parameters
[in]widgetThe QToolBar or QDockWidget for which the dock type should be returned.
See also
setMaxDockType()

◆ setMaxDockFlags()

static void setMaxDockFlags ( QWidget *  widget,
QmaxDockFlags  dockFlags 
)
static

Sets the 3ds Max specific dock flags on a QToolBar or QDockWidget.

Parameters
[in]widgetThe QToolBar or QDockWidget on which the dock flags should be set.
[in]dockFlagsThe 3ds Max specific dock flags.
See also
maxDockFlags(), addMaxDockFlags()

◆ maxDockFlags()

static QmaxDockFlags maxDockFlags ( const QWidget *  widget)
static

Returns the 3ds Max specific dock flags for a QToolBar or QDockWidget.

Parameters
[in]widgetThe QToolBar or QDockWidget for which the dock flags should be returned.
See also
setMaxDockFlags(), addMaxDockFlags()

◆ addMaxDockFlags()

static void addMaxDockFlags ( QWidget *  widget,
QmaxDockFlags  dockFlags 
)
inlinestatic

Adds the 3ds Max specific dock flags on a QToolBar or QDockWidget.

Parameters
[in]widgetThe QToolBar or QDockWidget on which the dock flags should be added.
[in]dockFlagsThe 3ds Max specific dock flags.
See also
maxDockFlags(), setMaxDockFlags()
134 { setMaxDockFlags( widget, maxDockFlags( widget ) | dockFlags ); }
static void setMaxDockFlags(QWidget *widget, QmaxDockFlags dockFlags)
Sets the 3ds Max specific dock flags on a QToolBar or QDockWidget.
static QmaxDockFlags maxDockFlags(const QWidget *widget)
Returns the 3ds Max specific dock flags for a QToolBar or QDockWidget.

◆ makeToolBarFloating()

static void makeToolBarFloating ( QToolBar *  toolBar,
const QPoint &  pos = QPoint() 
)
static

Makes a docked toolbar floating at the specified screen position.

Parameters
[in]toolBarThe QToolBar that should float.
[in]posThe screen position at which the toolbar should float.
Note
The toolbar needs to be added once to the main window toolbar layout, before you can't float it.

◆ getToolBarArea()

static Qt::ToolBarArea getToolBarArea ( QToolBar *  toolbar)
static

Returns the toolbar area for a QToolBar.

Parameters
[in]toolbarThe QToolBar for which the toolbar area should be returned.
See also
getDockWidgetArea()

◆ getDockWidgetArea()

static Qt::DockWidgetArea getDockWidgetArea ( QDockWidget *  dockwidget)
static

Returns the docking area for a QDockWidget.

Parameters
[in]dockwidgetThe QDockWidget for which the docking area should be returned.
See also
getToolBarArea()

◆ getDockingWinHost()

static QmaxDockingWinHost* getDockingWinHost ( QToolBar *  toolbar)
static

Retrieves the QmaxDockingWinHost if the given toolbar hosts a legacy win32 control.

Parameters
[in]toolbarThe QToolBar for which the QmaxDockingWinHost should be retrieved.
See also
getICustToolbar()

◆ getICustToolbar()

static ICustToolbar* getICustToolbar ( QToolBar *  toolbar)
static

Retrieves the legacy 3ds Max toolbar if the given QToolBar hosts one.

Note
The function calls internally GetICustToolbar( HWND ), so you need to call ReleaseICustToolbar after usage.
See also
GetICustToolbar(), ReleaseICustToolbar(), getDockingWinHost()

◆ expertMode()

void expertMode ( bool  on)

This method is for internal use only.

Calling this method alone will not put 3ds Max in Expert mode.

◆ createPopupMenu()

virtual QMenu* createPopupMenu ( )
overridevirtual

◆ setDockingLocked

void setDockingLocked ( bool  state)
slot

Changes the dockingLocked state.

Parameters
[in]stateThe new dockingLocked state.
See also
dockingLocked()

◆ eventFilter()

bool eventFilter ( QObject *  obj,
QEvent *  evt 
)
overrideprotected

◆ childEvent()

void childEvent ( QChildEvent *  evt)
overrideprotected

◆ event()

bool event ( QEvent *  evt)
overrideprotected

◆ nativeEvent()

bool nativeEvent ( const QByteArray &  eventType,
void message,
long *  result 
)
overrideprotected

◆ addDefaultDockOptions()

bool addDefaultDockOptions ( QWidget *  dockWidget,
QMenu *  menu 
) const
protected

Adds the default docking options for a given toolbar or dock widget to the specified menu.

◆ dockWidgetUnderMouse()

QWidget* dockWidgetUnderMouse ( ) const
protected

Returns the child toolbar or dock widget which is currently under the mouse.

Property Documentation

◆ dockingLocked

bool dockingLocked
readwrite

Determines whether the docked toolbars and dockwidgets can be moved around and/or made floating.

See also
dockingLocked(), setDockingLocked(), dockingLockedChanged()