@@ -55,7 +55,7 @@ AZ_POP_DISABLE_WARNING
|
||||
namespace MaterialEditor
|
||||
{
|
||||
MaterialEditorWindow::MaterialEditorWindow(QWidget* parent /* = 0 */)
|
||||
: AzQtComponents::DockMainWindow(parent)
|
||||
: AzQtComponents::AzQtApplicationWindow(parent, "MaterialEditorWindow")
|
||||
{
|
||||
resize(1280, 1024);
|
||||
|
||||
@@ -82,45 +82,25 @@ namespace MaterialEditor
|
||||
setWindowTitle(QApplication::applicationName());
|
||||
}
|
||||
|
||||
m_advancedDockManager = new AzQtComponents::FancyDocking(this);
|
||||
|
||||
setObjectName("MaterialEditorWindow");
|
||||
setDockNestingEnabled(true);
|
||||
setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea);
|
||||
setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
|
||||
setCorner(Qt::TopRightCorner, Qt::RightDockWidgetArea);
|
||||
setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);
|
||||
|
||||
m_menuBar = new QMenuBar(this);
|
||||
m_menuBar->setObjectName("MenuBar");
|
||||
setMenuBar(m_menuBar);
|
||||
|
||||
m_toolBar = new MaterialEditorToolBar(this);
|
||||
m_toolBar->setObjectName("ToolBar");
|
||||
addToolBar(m_toolBar);
|
||||
|
||||
m_centralWidget = new QWidget(this);
|
||||
m_tabWidget = new AzQtComponents::TabWidget(m_centralWidget);
|
||||
m_tabWidget->setObjectName("TabWidget");
|
||||
m_tabWidget->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Preferred);
|
||||
m_tabWidget->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
m_materialViewport = new MaterialViewportWidget(m_centralWidget);
|
||||
m_materialViewport->setObjectName("Viewport");
|
||||
m_materialViewport->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
||||
|
||||
QVBoxLayout* vl = new QVBoxLayout(m_centralWidget);
|
||||
|
||||
vl->setMargin(0);
|
||||
vl->setContentsMargins(0, 0, 0, 0);
|
||||
vl->addWidget(m_tabWidget);
|
||||
vl->addWidget(m_materialViewport);
|
||||
m_centralWidget->setLayout(vl);
|
||||
setCentralWidget(m_centralWidget);
|
||||
|
||||
|
||||
m_statusBar = new StatusBarWidget(this);
|
||||
m_statusBar->setObjectName("StatusBar");
|
||||
statusBar()->addPermanentWidget(m_statusBar, 1);
|
||||
|
||||
|
||||
SetupMenu();
|
||||
SetupTabs();
|
||||
|
||||
@@ -738,22 +718,6 @@ namespace MaterialEditor
|
||||
}
|
||||
}
|
||||
|
||||
void MaterialEditorWindow::SelectPreviousTab()
|
||||
{
|
||||
if (m_tabWidget->count() > 1)
|
||||
{
|
||||
// Adding count to wrap around when index <= 0
|
||||
m_tabWidget->setCurrentIndex((m_tabWidget->currentIndex() + m_tabWidget->count() - 1) % m_tabWidget->count());
|
||||
}
|
||||
}
|
||||
|
||||
void MaterialEditorWindow::SelectNextTab()
|
||||
{
|
||||
if (m_tabWidget->count() > 1)
|
||||
{
|
||||
m_tabWidget->setCurrentIndex((m_tabWidget->currentIndex() + 1) % m_tabWidget->count());
|
||||
}
|
||||
}
|
||||
} // namespace MaterialEditor
|
||||
|
||||
#include <Window/moc_MaterialEditorWindow.cpp>
|
||||
|
||||
@@ -12,10 +12,11 @@
|
||||
#include <Atom/Document/MaterialDocumentNotificationBus.h>
|
||||
|
||||
AZ_PUSH_DISABLE_WARNING(4251 4800, "-Wunknown-warning-option") // disable warnings spawned by QT
|
||||
#include <AzQtComponents/Components/DockMainWindow.h>
|
||||
//#include <AzQtComponents/Components/DockMainWindow.h>
|
||||
#include <AzQtComponents/Components/FancyDocking.h>
|
||||
#include <AzQtComponents/Components/StyledDockWidget.h>
|
||||
#include <AzQtComponents/Components/Widgets/TabWidget.h>
|
||||
#include <AzQtComponents/Application/Window/AzQtApplicationWindow.h>
|
||||
|
||||
#include <Atom/Window/MaterialEditorWindowRequestBus.h>
|
||||
#include <Viewport/MaterialViewportWidget.h>
|
||||
@@ -43,7 +44,7 @@ namespace MaterialEditor
|
||||
* 3) MaterialPropertyInspector - The user edits the properties of the selected Material.
|
||||
*/
|
||||
class MaterialEditorWindow
|
||||
: public AzQtComponents::DockMainWindow
|
||||
: public AzQtComponents::AzQtApplicationWindow
|
||||
, private MaterialEditorWindowRequestBus::Handler
|
||||
, private MaterialDocumentNotificationBus::Handler
|
||||
{
|
||||
@@ -74,61 +75,31 @@ namespace MaterialEditor
|
||||
void OnDocumentUndoStateChanged(const AZ::Uuid& documentId) override;
|
||||
void OnDocumentSaved(const AZ::Uuid& documentId) override;
|
||||
|
||||
void SetupMenu();
|
||||
void SetupMenu() override;
|
||||
void SetupTabs() override;
|
||||
|
||||
void SetupTabs();
|
||||
void AddTabForDocumentId(const AZ::Uuid& documentId);
|
||||
void RemoveTabForDocumentId(const AZ::Uuid& documentId);
|
||||
void UpdateTabForDocumentId(const AZ::Uuid& documentId);
|
||||
QString GetDocumentPath(const AZ::Uuid& documentId) const;
|
||||
AZ::Uuid GetDocumentIdFromTab(const int tabIndex) const;
|
||||
QString GetDocumentPath(const AZ::Uuid& documentId) const;
|
||||
|
||||
void OpenTabContextMenu();
|
||||
void SelectPreviousTab();
|
||||
void SelectNextTab();
|
||||
void OpenTabContextMenu() override;
|
||||
|
||||
void closeEvent(QCloseEvent* closeEvent) override;
|
||||
|
||||
AzQtComponents::FancyDocking* m_advancedDockManager = nullptr;
|
||||
QWidget* m_centralWidget = nullptr;
|
||||
QMenuBar* m_menuBar = nullptr;
|
||||
AzQtComponents::TabWidget* m_tabWidget = nullptr;
|
||||
MaterialViewportWidget* m_materialViewport = nullptr;
|
||||
MaterialEditorToolBar* m_toolBar = nullptr;
|
||||
|
||||
AZStd::unordered_map <AZStd::string, AzQtComponents::StyledDockWidget*> m_dockWidgets;
|
||||
|
||||
QMenu* m_menuFile = {};
|
||||
QAction* m_actionNew = {};
|
||||
QAction* m_actionOpen = {};
|
||||
QAction* m_actionOpenRecent = {};
|
||||
QAction* m_actionClose = {};
|
||||
QAction* m_actionCloseAll = {};
|
||||
QAction* m_actionCloseOthers = {};
|
||||
QAction* m_actionSave = {};
|
||||
QAction* m_actionSaveAsCopy = {};
|
||||
QAction* m_actionSaveAsChild = {};
|
||||
QAction* m_actionSaveAll = {};
|
||||
QAction* m_actionExit = {};
|
||||
|
||||
QMenu* m_menuEdit = {};
|
||||
QAction* m_actionUndo = {};
|
||||
QAction* m_actionRedo = {};
|
||||
QAction* m_actionSettings = {};
|
||||
|
||||
QMenu* m_menuView = {};
|
||||
QAction* m_actionAssetBrowser = {};
|
||||
QAction* m_actionInspector = {};
|
||||
QAction* m_actionConsole = {};
|
||||
QAction* m_actionPythonTerminal = {};
|
||||
QAction* m_actionPerfMonitor = {};
|
||||
QAction* m_actionViewportSettings = {};
|
||||
QAction* m_actionNextTab = {};
|
||||
QAction* m_actionPreviousTab = {};
|
||||
|
||||
QMenu* m_menuHelp = {};
|
||||
QAction* m_actionHelp = {};
|
||||
QAction* m_actionAbout = {};
|
||||
|
||||
StatusBarWidget* m_statusBar = {};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user