主导航改用StackedWidget

TaoZhang-Branch
wuyize 2023-03-07 20:27:58 +08:00
parent 6a4a724f00
commit 526f33ceba
5 changed files with 17 additions and 68 deletions

View File

@ -104,10 +104,10 @@
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="ElementPoolWidget.cpp" />
<ClCompile Include="src\CaptionButton.cpp" /> <ClCompile Include="src\CaptionButton.cpp" />
<ClCompile Include="src\Editor\EditorWidget.cpp" /> <ClCompile Include="src\Editor\EditorWidget.cpp" />
<ClCompile Include="src\Editor\ElementManager.cpp" /> <ClCompile Include="src\Editor\ElementManager.cpp" />
<ClCompile Include="src\Editor\ElementPoolWidget.cpp" />
<ClCompile Include="src\Editor\GraphicElement.cpp" /> <ClCompile Include="src\Editor\GraphicElement.cpp" />
<ClCompile Include="src\Editor\LayerManager.cpp" /> <ClCompile Include="src\Editor\LayerManager.cpp" />
<ClCompile Include="src\Editor\LayerStyle.cpp" /> <ClCompile Include="src\Editor\LayerStyle.cpp" />

View File

@ -207,7 +207,7 @@
<ClCompile Include="src\Editor\PixelPath.cpp"> <ClCompile Include="src\Editor\PixelPath.cpp">
<Filter>Source Files\Editor</Filter> <Filter>Source Files\Editor</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="ElementPoolWidget.cpp"> <ClCompile Include="src\Editor\ElementPoolWidget.cpp">
<Filter>Source Files\Editor</Filter> <Filter>Source Files\Editor</Filter>
</ClCompile> </ClCompile>
</ItemGroup> </ItemGroup>

View File

@ -40,66 +40,20 @@
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_4" stretch="1"> <layout class="QGridLayout" name="gridLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="sizeConstraint"> <property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum> <enum>QLayout::SetDefaultConstraint</enum>
</property> </property>
<item> <property name="topMargin">
<widget class="QTabWidget" name="tabWidget">
<property name="font">
<font>
<family>Segoe UI, Microsoft YaHei UI</family>
<pointsize>10</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">
QTabBar::tab {
height: 0px;
margin-top:0px;
}
QTabWidget::tab-bar
{
height: 0px;
top:0px;
}
QTabWidget::pane {
border: 0px;
background-color: transparent;
}
</string>
</property>
<property name="tabPosition">
<enum>QTabWidget::North</enum>
</property>
<property name="tabShape">
<enum>QTabWidget::Rounded</enum>
</property>
<property name="currentIndex">
<number>0</number> <number>0</number>
</property> </property>
<property name="elideMode"> <property name="spacing">
<enum>Qt::ElideNone</enum> <number>0</number>
</property> </property>
<property name="tabsClosable"> <item row="0" column="0">
<bool>false</bool> <widget class="QStackedWidget" name="stackedWidget">
</property> <widget class="EditorWidget" name="editorWidget"/>
<widget class="EditorWidget" name="editorWidget"> <widget class="Renderer::RendererWidget" name="rendererWidget"/>
<attribute name="title">
<string>纹理编辑</string>
</attribute>
</widget>
<widget class="Renderer::RendererWidget" name="rendererWidget">
<attribute name="title">
<string>场景渲染</string>
</attribute>
</widget>
</widget> </widget>
</item> </item>
</layout> </layout>

View File

@ -15,14 +15,9 @@ CentralWidget::CentralWidget(QWidget* parent) : QMainWindow(parent)
{ {
ui.setupUi(this); ui.setupUi(this);
NavigationBarWidget* navigationBarWidget = new NavigationBarWidget(); NavigationBarWidget* navigationBarWidget = new NavigationBarWidget();
ui.gridLayout->addWidget(navigationBarWidget, 0, 0, 1, 1, Qt::AlignTop | Qt::AlignHCenter);
QHBoxLayout* tabBarLayout = new QHBoxLayout(ui.tabWidget); QObject::connect(navigationBarWidget->tabs, &QtMaterialTabs::currentChanged, ui.stackedWidget, &QStackedWidget::setCurrentIndex);
tabBarLayout->setSpacing(0); QObject::connect(ui.stackedWidget, &QStackedWidget::currentChanged,
tabBarLayout->setMargin(0);
tabBarLayout->addWidget(navigationBarWidget, 0, Qt::AlignTop | Qt::AlignHCenter);
QObject::connect(navigationBarWidget->tabs, &QtMaterialTabs::currentChanged, ui.tabWidget, &QTabWidget::setCurrentIndex);
QObject::connect(ui.tabWidget, &QTabWidget::currentChanged,
ui.rendererWidget, &Renderer::RendererWidget::currentTabChanged); ui.rendererWidget, &Renderer::RendererWidget::currentTabChanged);
} }
@ -41,7 +36,7 @@ MainWindow::MainWindow(QWidget* parent, const Qt::WindowFlags flags)
m_titleBar->maximizeButton()->setFixedHeight(kTitleBarHeight); m_titleBar->maximizeButton()->setFixedHeight(kTitleBarHeight);
m_titleBar->closeButton()->setFixedHeight(kTitleBarHeight); m_titleBar->closeButton()->setFixedHeight(kTitleBarHeight);
m_titleBar->setTitleFont(QFont(QString("Segoe UI, Microsoft YaHei UI"), 10)); m_titleBar->setTitleFont(QFont(QString("Segoe UI, Microsoft YaHei UI"), 10));
m_titleBar->chromePalette()->setTitleBarActiveBackgroundColor(QColor(0,0,0,0)); m_titleBar->chromePalette()->setTitleBarActiveBackgroundColor(QColor(0, 0, 0, 0));
m_titleBar->chromePalette()->setTitleBarInactiveBackgroundColor(QColor(0, 0, 0, 0)); m_titleBar->chromePalette()->setTitleBarInactiveBackgroundColor(QColor(0, 0, 0, 0));
m_central_widget = new CentralWidget(); m_central_widget = new CentralWidget();