1 Star 0 Fork 25

Honei_X / MyYoudaoNoteLike

forked from 风木 / MyYoudaoNoteLike 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
mainwindow.cpp 1.53 KB
一键复制 编辑 原始数据 按行查看 历史
风木 提交于 2015-02-09 17:40 . add main form
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "tabitem.h"
#include "treeviewtest.h"
#include "collpsetestform.h"
#include "collapseview.h"
#include <windows.h>
#include <QMouseEvent>
#include <QRect>
#include <QPoint>
#include <QGridLayout>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
this->setWindowFlags(Qt::FramelessWindowHint);
QLayout* l=ui->scrollAreaWidgetContents_2->layout();
l->addWidget(new CollapseView(this));
ui->splitter->setStretchFactor(0,0);
ui->splitter->setStretchFactor(1,1);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::mousePressEvent(QMouseEvent *event)
{
if(!this->isFullScreen()&&!this->isMaximized()){
//判断位置
QRect rect=ui->top_widget->rect();
QPoint pos=event->pos();
bool shouldMove=pos.x()>=rect.left()&&pos.x()<=rect.right()&&pos.y()>=rect.top()&&pos.y()<=rect.bottom();
if(shouldMove){
if (ReleaseCapture()){
SendMessage(HWND(this->winId()), WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0);
}
}
event->ignore();
}
}
void MainWindow::keyPressEvent(QKeyEvent *event)
{
switch (event->key()) {
case Qt::Key_F1:
this->showFullScreen();
break;
case Qt::Key_F2:
this->showMaximized();
break;
case Qt::Key_F3:
this->showNormal();
break;
case Qt::Key_F4:
this->close();
break;
default:
break;
}
}
1
https://gitee.com/Honei_X/MyYoudaoNoteLike.git
git@gitee.com:Honei_X/MyYoudaoNoteLike.git
Honei_X
MyYoudaoNoteLike
MyYoudaoNoteLike
master

搜索帮助