chengxr 1 год назад
Родитель
Сommit
8b9371daa3
6 измененных файлов с 116 добавлено и 37 удалено
  1. 0 23
      QFD/MainWindow.cpp
  2. 0 14
      QFD/MainWindow.h
  3. 10 0
      QFD/pages/Login.cpp
  4. 12 0
      QFD/pages/Login.h
  5. 56 0
      QFD/pages/MainWindow.cpp
  6. 38 0
      QFD/pages/MainWindow.h

+ 0 - 23
QFD/MainWindow.cpp

@@ -1,23 +0,0 @@
-#include "MainWindow.h"
-
-#include <DateTime/DatePicker.h>
-#include <QFramelessWindow.h>
-#include <TitleBar.h>
-
-#include <QDebug>
-
-MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) {
-  QFramelessHelper *helper = new QFramelessHelper(this);
-  StandardTitleBar *titleBar = new StandardTitleBar(this);
-  helper->setTitleBar(titleBar);
-
-  setMinimumSize(QSize(800, 600));
-
-  QIcon icon = QIcon(":/resource/logo.png");
-  setWindowIcon(icon);
-  titleBar->setIcon(icon);
-
-  setWindowTitle("QFD2");
-}
-
-MainWindow::~MainWindow() {}

+ 0 - 14
QFD/MainWindow.h

@@ -1,14 +0,0 @@
-#ifndef MAINWINDOW_H
-#define MAINWINDOW_H
-
-#include <QMainWindow>
-
-class MainWindow : public QMainWindow
-{
-    Q_OBJECT
-
-public:
-    MainWindow(QWidget *parent = nullptr);
-    ~MainWindow();
-};
-#endif // MAINWINDOW_H

+ 10 - 0
QFD/pages/Login.cpp

@@ -0,0 +1,10 @@
+#include "Login.h"
+
+Login::Login() {
+  Qt::WindowFlags flags = Qt::Dialog | Qt::FramelessWindowHint;
+  this->setWindowFlags(flags);
+  this->setAttribute(Qt::WA_AlwaysShowToolTips);
+  this->setFocusPolicy(Qt::StrongFocus);
+
+  this->setWindowTitle("登录界面");
+}

+ 12 - 0
QFD/pages/Login.h

@@ -0,0 +1,12 @@
+#ifndef LOGIN_H
+#define LOGIN_H
+
+#include <QDialog>
+
+class Login : public QDialog
+{
+public:
+    Login();
+};
+
+#endif // LOGIN_H

+ 56 - 0
QFD/pages/MainWindow.cpp

@@ -0,0 +1,56 @@
+#include "MainWindow.h"
+
+#include <DateTime/DatePicker.h>
+#include <QFramelessWindow.h>
+#include <TitleBar.h>
+
+#include <Widgets/StackedWidget.h>
+
+#include <QDebug>
+
+StackedWidget::StackedWidget(QWidget *parent) : QFrame(parent) {
+  m_hBoxLayout = new QHBoxLayout(this);
+  m_view = new PopUpAniStackedWidget(this);
+
+  m_hBoxLayout->setContentsMargins(0, 0, 0, 0);
+  m_hBoxLayout->addWidget(m_view);
+
+  connect(
+      m_view, &PopUpAniStackedWidget::currentChanged, this,
+      [this](int index) { emit currentWidgetChanged(m_view->widget(index)); });
+}
+
+void StackedWidget::addWidget(QWidget *widget) { m_view->addWidget(widget); }
+
+///
+/// @todo widget.verticalScrollBar().setValue(0)
+///
+void StackedWidget::setCurrentWidget(QWidget *widget, bool popOut) {
+  if (popOut) {
+    m_view->setCurrentWidget(widget, true, false, 200, QEasingCurve::InQuad);
+  } else {
+    m_view->setCurrentWidget(widget, false, true, 300);
+  }
+}
+
+void StackedWidget::setCurrentIndex(int index, bool popOut) {
+  setCurrentWidget(m_view->widget(index), popOut);
+}
+
+PopUpAniStackedWidget *StackedWidget::view() const { return m_view; }
+
+MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) {
+  QFramelessHelper *helper = new QFramelessHelper(this);
+  StandardTitleBar *titleBar = new StandardTitleBar(this);
+  helper->setTitleBar(titleBar);
+
+  setMinimumSize(QSize(800, 600));
+
+  QIcon icon = QIcon(":/resource/logo.png");
+  setWindowIcon(icon);
+  titleBar->setIcon(icon);
+
+  setWindowTitle("专家评定数据分析软件");
+}
+
+MainWindow::~MainWindow() {}

+ 38 - 0
QFD/pages/MainWindow.h

@@ -0,0 +1,38 @@
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <QFrame>
+#include <QMainWindow>
+
+class PopUpAniStackedWidget;
+class QHBoxLayout;
+
+class StackedWidget : public QFrame {
+  Q_OBJECT
+public:
+  StackedWidget(QWidget *parent = nullptr);
+
+  void addWidget(QWidget *widget);
+
+  void setCurrentWidget(QWidget *widget, bool popOut = false);
+
+  void setCurrentIndex(int index, bool popOut = false);
+
+  PopUpAniStackedWidget *view() const;
+
+signals:
+  void currentWidgetChanged(QWidget *);
+
+private:
+  QHBoxLayout *m_hBoxLayout;
+  PopUpAniStackedWidget *m_view;
+};
+
+class MainWindow : public QMainWindow {
+  Q_OBJECT
+
+public:
+  MainWindow(QWidget *parent = nullptr);
+  ~MainWindow();
+};
+#endif // MAINWINDOW_H