mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 10:00:40 +00:00
Allow configuring a callback to create tool windows on-demand
* This means we can start with an empty manager, load a layout, and just create the needed windows as we go according to what the layout needs.
This commit is contained in:
@@ -66,6 +66,7 @@ ToolWindowManager::ToolWindowManager(QWidget *parent) :
|
||||
m_dropSuggestionSwitchTimer.setInterval(1000);
|
||||
m_dropCurrentSuggestionIndex = 0;
|
||||
m_allowFloatingWindow = true;
|
||||
m_createCallback = NULL;
|
||||
|
||||
m_rectRubberBand = new QRubberBand(QRubberBand::Rectangle, this);
|
||||
m_lineRubberBand = new QRubberBand(QRubberBand::Line, this);
|
||||
@@ -271,6 +272,21 @@ void ToolWindowManager::removeToolWindow(QWidget *toolWindow) {
|
||||
m_toolWindowProperties.remove(toolWindow);
|
||||
}
|
||||
|
||||
QWidget* ToolWindowManager::createToolWindow(const QString& objectName)
|
||||
{
|
||||
if (m_createCallback) {
|
||||
QWidget *toolWindow = m_createCallback(objectName);
|
||||
if(toolWindow) {
|
||||
m_toolWindows << toolWindow;
|
||||
m_toolWindowProperties[toolWindow] = ToolWindowProperty(0);
|
||||
QObject::connect(toolWindow, &QWidget::windowTitleChanged, this, &ToolWindowManager::windowTitleChanged);
|
||||
return toolWindow;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void ToolWindowManager::setSuggestionSwitchInterval(int msec) {
|
||||
m_dropSuggestionSwitchTimer.setInterval(msec);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user