mirror of
https://github.com/Linloir/SceneEditor.git
synced 2025-12-18 16:08:11 +08:00
[UI][UPD] Minor updates
- Tested version (Can build & run)
This commit is contained in:
parent
e5abe8c248
commit
be3eda82f2
@ -108,6 +108,7 @@
|
|||||||
<ClCompile Include="ebo.cpp" />
|
<ClCompile Include="ebo.cpp" />
|
||||||
<ClCompile Include="editorpage.cpp" />
|
<ClCompile Include="editorpage.cpp" />
|
||||||
<ClCompile Include="framelesswindow.cpp" />
|
<ClCompile Include="framelesswindow.cpp" />
|
||||||
|
<ClCompile Include="lineeditwidget.cpp" />
|
||||||
<ClCompile Include="logger.cpp" />
|
<ClCompile Include="logger.cpp" />
|
||||||
<ClCompile Include="mesh.cpp" />
|
<ClCompile Include="mesh.cpp" />
|
||||||
<ClCompile Include="model.cpp" />
|
<ClCompile Include="model.cpp" />
|
||||||
@ -135,10 +136,11 @@
|
|||||||
<QtMoc Include="sceneviewer.h" />
|
<QtMoc Include="sceneviewer.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="aboutpage.h" />
|
<QtMoc Include="aboutpage.h" />
|
||||||
<ClInclude Include="camera.h" />
|
<ClInclude Include="camera.h" />
|
||||||
<QtMoc Include="editorpage.h" />
|
<QtMoc Include="editorpage.h" />
|
||||||
<QtMoc Include="framelesswindow.h" />
|
<QtMoc Include="framelesswindow.h" />
|
||||||
|
<QtMoc Include="lineeditwidget.h" />
|
||||||
<ClInclude Include="logger.h" />
|
<ClInclude Include="logger.h" />
|
||||||
<ClInclude Include="mesh.h" />
|
<ClInclude Include="mesh.h" />
|
||||||
<ClInclude Include="model.h" />
|
<ClInclude Include="model.h" />
|
||||||
|
|||||||
@ -141,6 +141,9 @@
|
|||||||
<ClCompile Include="aboutpage.cpp">
|
<ClCompile Include="aboutpage.cpp">
|
||||||
<Filter>Source Files\Qt Widgets\Pages\About Page</Filter>
|
<Filter>Source Files\Qt Widgets\Pages\About Page</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="lineeditwidget.cpp">
|
||||||
|
<Filter>Source Files\Qt Widgets\GUI Components</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="camera.h">
|
<ClInclude Include="camera.h">
|
||||||
@ -191,9 +194,6 @@
|
|||||||
<ClInclude Include="scrolllist.h">
|
<ClInclude Include="scrolllist.h">
|
||||||
<Filter>Header Files\Qt Widgets\GUI Components</Filter>
|
<Filter>Header Files\Qt Widgets\GUI Components</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="aboutpage.h">
|
|
||||||
<Filter>Header Files\Qt Widgets\Pages\About Page</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<QtMoc Include="mainwindow.h">
|
<QtMoc Include="mainwindow.h">
|
||||||
@ -220,6 +220,12 @@
|
|||||||
<QtMoc Include="roundedcornerwidget.h">
|
<QtMoc Include="roundedcornerwidget.h">
|
||||||
<Filter>Header Files\Qt Widgets\GUI Components</Filter>
|
<Filter>Header Files\Qt Widgets\GUI Components</Filter>
|
||||||
</QtMoc>
|
</QtMoc>
|
||||||
|
<QtMoc Include="aboutpage.h">
|
||||||
|
<Filter>Header Files\Qt Widgets\Pages\About Page</Filter>
|
||||||
|
</QtMoc>
|
||||||
|
<QtMoc Include="lineeditwidget.h">
|
||||||
|
<Filter>Header Files\Qt Widgets\GUI Components</Filter>
|
||||||
|
</QtMoc>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="fragmentshader.fs">
|
<None Include="fragmentshader.fs">
|
||||||
|
|||||||
@ -82,7 +82,7 @@ PushButton* EditorPage::getPageTextButton(QWidget* context) {
|
|||||||
_textButtonWidget = new QWidget(_textButton);
|
_textButtonWidget = new QWidget(_textButton);
|
||||||
_textButtonLayout = new QHBoxLayout(_textButtonWidget);
|
_textButtonLayout = new QHBoxLayout(_textButtonWidget);
|
||||||
_textButtonLayout->setContentsMargins(0, 0, 0, 0);
|
_textButtonLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
_textButtonLayout->setSpacing(8);
|
_textButtonLayout->setSpacing(12);
|
||||||
_textButtonWidget->setLayout(_textButtonLayout);
|
_textButtonWidget->setLayout(_textButtonLayout);
|
||||||
|
|
||||||
// Generate text button contents
|
// Generate text button contents
|
||||||
|
|||||||
@ -29,11 +29,9 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
}
|
}
|
||||||
if (previousPage != nullptr) {
|
if (previousPage != nullptr) {
|
||||||
previousPage->offStage();
|
previousPage->offStage();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
if (currentPage != nullptr) {
|
if (currentPage != nullptr) {
|
||||||
currentPage->onStage();
|
currentPage->onStage();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
_sideBar->setMouseTracking(true);
|
_sideBar->setMouseTracking(true);
|
||||||
@ -45,8 +43,12 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
// Create editor page and connect to side bar
|
// Create editor page and connect to side bar
|
||||||
_editorPage = new EditorPage(_placeHolderWidget);
|
_editorPage = new EditorPage(_placeHolderWidget);
|
||||||
_editorPage->setMouseTracking(true);
|
_editorPage->setMouseTracking(true);
|
||||||
_editorPage->show();
|
|
||||||
_sideBar->addPage(_editorPage);
|
_sideBar->addPage(_editorPage);
|
||||||
|
|
||||||
|
// Create about page and connect to side bar
|
||||||
|
_aboutPage = new AboutPage(_placeHolderWidget);
|
||||||
|
_aboutPage->setMouseTracking(true);
|
||||||
|
_sideBar->addPage(_aboutPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow() {
|
MainWindow::~MainWindow() {
|
||||||
@ -63,6 +65,7 @@ void MainWindow::resizePages(QResizeEvent* event) {
|
|||||||
|
|
||||||
// Resize the editor page
|
// Resize the editor page
|
||||||
_editorPage->resize(size);
|
_editorPage->resize(size);
|
||||||
|
_aboutPage->resize(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::showEvent(QShowEvent* event) {
|
void MainWindow::showEvent(QShowEvent* event) {
|
||||||
@ -71,6 +74,7 @@ void MainWindow::showEvent(QShowEvent* event) {
|
|||||||
|
|
||||||
// Resize all the pages based on the placeholder widget
|
// Resize all the pages based on the placeholder widget
|
||||||
_editorPage->resize(_placeHolderWidget->size());
|
_editorPage->resize(_placeHolderWidget->size());
|
||||||
|
_aboutPage->resize(_placeHolderWidget->size());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MainWindow::eventFilter(QObject* object, QEvent* event) {
|
bool MainWindow::eventFilter(QObject* object, QEvent* event) {
|
||||||
|
|||||||
@ -5,6 +5,7 @@
|
|||||||
#include "framelesswindow.h"
|
#include "framelesswindow.h"
|
||||||
#include "sidebar.h"
|
#include "sidebar.h"
|
||||||
#include "editorpage.h"
|
#include "editorpage.h"
|
||||||
|
#include "aboutpage.h"
|
||||||
|
|
||||||
class MainWindow : public FramelessWindow
|
class MainWindow : public FramelessWindow
|
||||||
{
|
{
|
||||||
@ -21,6 +22,7 @@ private:
|
|||||||
// Side bar and corresponding pages
|
// Side bar and corresponding pages
|
||||||
SideBar* _sideBar = nullptr;
|
SideBar* _sideBar = nullptr;
|
||||||
EditorPage* _editorPage = nullptr;
|
EditorPage* _editorPage = nullptr;
|
||||||
|
AboutPage* _aboutPage = nullptr;
|
||||||
|
|
||||||
// Place holder widget for resizing pages
|
// Place holder widget for resizing pages
|
||||||
QWidget* _placeHolderWidget = nullptr;
|
QWidget* _placeHolderWidget = nullptr;
|
||||||
|
|||||||
@ -13,26 +13,31 @@ PageWidget::PageWidget(QWidget* parent) : QWidget(parent) {
|
|||||||
// Construct content widget
|
// Construct content widget
|
||||||
_contentWidget = new QWidget(this);
|
_contentWidget = new QWidget(this);
|
||||||
_stretchLayout->addWidget(_contentWidget);
|
_stretchLayout->addWidget(_contentWidget);
|
||||||
|
_contentWidget->show();
|
||||||
|
|
||||||
// Add opacity effect to real content
|
// Add opacity effect to real content
|
||||||
_pageOpacityEffect = new QGraphicsOpacityEffect(_contentWidget);
|
_pageOpacityEffect = new QGraphicsOpacityEffect(_contentWidget);
|
||||||
_pageOpacityEffect->setOpacity(0);
|
_pageOpacityEffect->setOpacity(0);
|
||||||
_contentWidget->setGraphicsEffect(_pageOpacityEffect);
|
_contentWidget->setGraphicsEffect(_pageOpacityEffect);
|
||||||
|
|
||||||
|
// Move offstage
|
||||||
|
move(_originPagePosition + QPoint(0, 150));
|
||||||
|
hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
PageWidget::~PageWidget() {}
|
PageWidget::~PageWidget() {}
|
||||||
|
|
||||||
void PageWidget::onStage() {
|
void PageWidget::onStage() {
|
||||||
// Move up and fade in
|
// Move up and fade in
|
||||||
QParallelAnimationGroup* onStageAnimation = new QParallelAnimationGroup(_contentWidget);
|
QParallelAnimationGroup* onStageAnimation = new QParallelAnimationGroup(this);
|
||||||
QPropertyAnimation* moveAnimation = new QPropertyAnimation(_contentWidget, "pos");
|
QPropertyAnimation* moveAnimation = new QPropertyAnimation(this, "pos");
|
||||||
QPropertyAnimation* fadeInAnimation = new QPropertyAnimation(_pageOpacityEffect, "opacity");
|
QPropertyAnimation* fadeInAnimation = new QPropertyAnimation(_pageOpacityEffect, "opacity");
|
||||||
moveAnimation->setDuration(300);
|
moveAnimation->setDuration(600);
|
||||||
moveAnimation->setEasingCurve(QEasingCurve::OutCubic);
|
moveAnimation->setEasingCurve(QEasingCurve::OutExpo);
|
||||||
moveAnimation->setStartValue(_contentWidget->pos());
|
moveAnimation->setStartValue(pos());
|
||||||
moveAnimation->setEndValue(_originPagePosition);
|
moveAnimation->setEndValue(_originPagePosition);
|
||||||
fadeInAnimation->setDuration(300);
|
fadeInAnimation->setDuration(500);
|
||||||
fadeInAnimation->setEasingCurve(QEasingCurve::OutQuad);
|
fadeInAnimation->setEasingCurve(QEasingCurve::InQuad);
|
||||||
fadeInAnimation->setStartValue(_pageOpacityEffect->opacity());
|
fadeInAnimation->setStartValue(_pageOpacityEffect->opacity());
|
||||||
fadeInAnimation->setEndValue(0.999);
|
fadeInAnimation->setEndValue(0.999);
|
||||||
onStageAnimation->addAnimation(moveAnimation);
|
onStageAnimation->addAnimation(moveAnimation);
|
||||||
@ -40,20 +45,19 @@ void PageWidget::onStage() {
|
|||||||
onStageAnimation->start(QAbstractAnimation::DeleteWhenStopped);
|
onStageAnimation->start(QAbstractAnimation::DeleteWhenStopped);
|
||||||
|
|
||||||
// Show page
|
// Show page
|
||||||
_contentWidget->show();
|
show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PageWidget::offStage() {
|
void PageWidget::offStage() {
|
||||||
// Move down and fade out
|
// Move down and fade out
|
||||||
QParallelAnimationGroup* offStageAnimation = new QParallelAnimationGroup(_contentWidget);
|
QParallelAnimationGroup* offStageAnimation = new QParallelAnimationGroup(this);
|
||||||
//QPropertyAnimation* moveAnimation = new QPropertyAnimation(_contentWidget, "pos");
|
//QPropertyAnimation* moveAnimation = new QPropertyAnimation(_contentWidget, "pos");
|
||||||
QPropertyAnimation* fadeOutAnimation = new QPropertyAnimation(_pageOpacityEffect, "opacity");
|
QPropertyAnimation* fadeOutAnimation = new QPropertyAnimation(_pageOpacityEffect, "opacity");
|
||||||
//moveAnimation->setDuration(300);
|
//moveAnimation->setDuration(300);
|
||||||
//moveAnimation->setEasingCurve(QEasingCurve::OutCubic);
|
//moveAnimation->setEasingCurve(QEasingCurve::OutCubic);
|
||||||
//moveAnimation->setStartValue(_contentWidget->pos());
|
//moveAnimation->setStartValue(_contentWidget->pos());
|
||||||
//moveAnimation->setEndValue(_originPagePosition - QPoint(0, 100));
|
//moveAnimation->setEndValue(_originPagePosition - QPoint(0, 100));
|
||||||
fadeOutAnimation->setDuration(300);
|
fadeOutAnimation->setDuration(200);
|
||||||
fadeOutAnimation->setEasingCurve(QEasingCurve::OutQuad);
|
|
||||||
fadeOutAnimation->setStartValue(_pageOpacityEffect->opacity());
|
fadeOutAnimation->setStartValue(_pageOpacityEffect->opacity());
|
||||||
fadeOutAnimation->setEndValue(0);
|
fadeOutAnimation->setEndValue(0);
|
||||||
//offStageAnimation->addAnimation(moveAnimation);
|
//offStageAnimation->addAnimation(moveAnimation);
|
||||||
@ -62,6 +66,7 @@ void PageWidget::offStage() {
|
|||||||
|
|
||||||
// Connect animation finished signal to hide page
|
// Connect animation finished signal to hide page
|
||||||
connect(offStageAnimation, &QParallelAnimationGroup::finished, [=]() {
|
connect(offStageAnimation, &QParallelAnimationGroup::finished, [=]() {
|
||||||
_contentWidget->hide();
|
move(_originPagePosition + QPoint(0, 150));
|
||||||
|
hide();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user