├── a.bat ├── app.ico ├── logo.jpg ├── screenshot ├── black.png └── green.png ├── Resources ├── MyTitle.css └── MyTitle │ ├── max.png │ ├── min.png │ ├── close.png │ └── restore.png ├── form.cpp ├── form.h ├── res.qrc ├── main.cpp ├── mainwindow.cpp ├── mainwindow.h ├── form.ui ├── FramlessWidget.pro ├── framelesswindow.h ├── titlebar.h ├── message_box.h ├── mainwindow.ui ├── framelesswindow.ui ├── frameless_helper.h ├── framelesswindow.cpp ├── titlebar.cpp ├── message_box.cpp ├── frameless_helper.cpp ├── LICENSE ├── README.md └── FramlessWidget.pro.user /a.bat: -------------------------------------------------------------------------------- 1 | cmd -------------------------------------------------------------------------------- /app.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stimer0083/FrameLessWidget/HEAD/app.ico -------------------------------------------------------------------------------- /logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stimer0083/FrameLessWidget/HEAD/logo.jpg -------------------------------------------------------------------------------- /screenshot/black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stimer0083/FrameLessWidget/HEAD/screenshot/black.png -------------------------------------------------------------------------------- /screenshot/green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stimer0083/FrameLessWidget/HEAD/screenshot/green.png -------------------------------------------------------------------------------- /Resources/MyTitle.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stimer0083/FrameLessWidget/HEAD/Resources/MyTitle.css -------------------------------------------------------------------------------- /Resources/MyTitle/max.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stimer0083/FrameLessWidget/HEAD/Resources/MyTitle/max.png -------------------------------------------------------------------------------- /Resources/MyTitle/min.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stimer0083/FrameLessWidget/HEAD/Resources/MyTitle/min.png -------------------------------------------------------------------------------- /Resources/MyTitle/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stimer0083/FrameLessWidget/HEAD/Resources/MyTitle/close.png -------------------------------------------------------------------------------- /Resources/MyTitle/restore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stimer0083/FrameLessWidget/HEAD/Resources/MyTitle/restore.png -------------------------------------------------------------------------------- /form.cpp: -------------------------------------------------------------------------------- 1 | #include "form.h" 2 | #include "ui_form.h" 3 | 4 | Form::Form(QWidget *parent) : 5 | QWidget(parent), 6 | ui(new Ui::Form) 7 | { 8 | ui->setupUi(this); 9 | } 10 | 11 | Form::~Form() 12 | { 13 | delete ui; 14 | } 15 | -------------------------------------------------------------------------------- /form.h: -------------------------------------------------------------------------------- 1 | #ifndef FORM_H 2 | #define FORM_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class Form; 8 | } 9 | 10 | class Form : public QWidget 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit Form(QWidget *parent = 0); 16 | ~Form(); 17 | 18 | private: 19 | Ui::Form *ui; 20 | }; 21 | 22 | #endif // FORM_H 23 | -------------------------------------------------------------------------------- /res.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | logo.jpg 4 | 5 | 6 | Resources/MyTitle/close.png 7 | Resources/MyTitle/max.png 8 | Resources/MyTitle/min.png 9 | Resources/MyTitle/restore.png 10 | Resources/MyTitle.css 11 | 12 | 13 | -------------------------------------------------------------------------------- /main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "framelesswindow.h" 3 | #include "mainwindow.h" 4 | #include 5 | 6 | int main(int argc, char *argv[]) 7 | { 8 | QApplication a(argc, argv); 9 | 10 | FramelessWindow framelessWindow; 11 | 12 | // create our mainwindow instance 13 | MainWindow *mainWindow = new MainWindow; 14 | framelessWindow.setContent(mainWindow); 15 | 16 | 17 | framelessWindow.show(); 18 | 19 | return a.exec(); 20 | } 21 | -------------------------------------------------------------------------------- /mainwindow.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | #include "ui_mainwindow.h" 3 | #include 4 | MainWindow::MainWindow(QWidget *parent) : 5 | QMainWindow(parent), 6 | ui(new Ui::MainWindow) 7 | { 8 | ui->setupUi(this); 9 | 10 | } 11 | 12 | MainWindow::~MainWindow() 13 | { 14 | delete ui; 15 | } 16 | 17 | void MainWindow::on_pushButton_clicked() 18 | { 19 | qDebug()<<"1"; 20 | } 21 | 22 | void MainWindow::on_pushButton_5_clicked() 23 | { 24 | qDebug()<<"2"; 25 | } 26 | -------------------------------------------------------------------------------- /mainwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef MAINWINDOW_H 2 | #define MAINWINDOW_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class MainWindow; 8 | } 9 | 10 | class MainWindow : public QMainWindow 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit MainWindow(QWidget *parent = 0); 16 | ~MainWindow(); 17 | 18 | private slots: 19 | void on_pushButton_clicked(); 20 | 21 | void on_pushButton_5_clicked(); 22 | 23 | private: 24 | Ui::MainWindow *ui; 25 | }; 26 | 27 | #endif // MAINWINDOW_H 28 | -------------------------------------------------------------------------------- /form.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | Form 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | Form 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /FramlessWidget.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2017-08-12T21:03:55 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += core gui axcontainer 8 | RC_ICONS = app.ico 9 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 10 | 11 | TARGET = testWidget 12 | TEMPLATE = app 13 | 14 | 15 | SOURCES += main.cpp\ 16 | titlebar.cpp \ 17 | frameless_helper.cpp \ 18 | framelesswindow.cpp \ 19 | mainwindow.cpp \ 20 | form.cpp 21 | 22 | HEADERS += \ 23 | titlebar.h \ 24 | frameless_helper.h \ 25 | framelesswindow.h \ 26 | mainwindow.h \ 27 | form.h 28 | 29 | FORMS += \ 30 | framelesswindow.ui \ 31 | mainwindow.ui \ 32 | form.ui 33 | 34 | RESOURCES += \ 35 | res.qrc 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /framelesswindow.h: -------------------------------------------------------------------------------- 1 | #ifndef FramelessWindow_H 2 | #define FramelessWindow_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include "titlebar.h" 8 | #include "frameless_helper.h" 9 | #include 10 | 11 | namespace Ui { 12 | class FramelessWindow; 13 | } 14 | 15 | class FramelessWindow : public QWidget 16 | { 17 | Q_OBJECT 18 | 19 | public: 20 | explicit FramelessWindow(QWidget *parent = 0); 21 | ~FramelessWindow(); 22 | 23 | void mousePressEvent(QMouseEvent *event); 24 | void mouseReleaseEvent(QMouseEvent *event); 25 | 26 | void mouseMoveEvent(QMouseEvent *event); 27 | 28 | void setMinimizeVisible(bool); 29 | void setMaximizeVisible(bool); 30 | void setWidgetResizable(bool); 31 | protected: 32 | 33 | void paintEvent(QPaintEvent *); 34 | public: 35 | QVBoxLayout *m_pLayout; 36 | void setContent(QWidget *w); 37 | void loadStyleSheet(const QString &sheetName); 38 | private slots: 39 | 40 | private: 41 | 42 | Ui::FramelessWindow *ui; 43 | bool m_bPressed; 44 | QPoint m_point; 45 | int m_nBorder; 46 | TitleBar *pTitleBar; 47 | FramelessHelper *pHelper; 48 | }; 49 | 50 | #endif // FramelessWindow_H 51 | -------------------------------------------------------------------------------- /titlebar.h: -------------------------------------------------------------------------------- 1 | #ifndef TITLE_BAR 2 | #define TITLE_BAR 3 | 4 | #include 5 | 6 | class QLabel; 7 | class QPushButton; 8 | 9 | class TitleBar : public QWidget 10 | { 11 | Q_OBJECT 12 | 13 | public: 14 | explicit TitleBar(QWidget *parent = 0); 15 | ~TitleBar(); 16 | // void loadStyleSheet(const QString &sheetName); 17 | 18 | protected: 19 | 20 | 21 | // 双击标题栏进行界面的最大化/还原 22 | virtual void mouseDoubleClickEvent(QMouseEvent *event); 23 | 24 | // 进行鼠界面的拖动 25 | // virtual void mousePressEvent(QMouseEvent *event); 26 | 27 | // 设置界面标题与图标 28 | virtual bool eventFilter(QObject *obj, QEvent *event); 29 | 30 | //void paintEvent(QPaintEvent *event); 31 | 32 | void paintEvent(QPaintEvent *); 33 | private slots: 34 | 35 | // 进行最小化、最大化/还原、关闭操作 36 | void onClicked(); 37 | 38 | private: 39 | 40 | // 最大化/还原 41 | void updateMaximize(); 42 | 43 | public: 44 | QLabel *m_pIconLabel; 45 | QLabel *m_pTitleLabel; 46 | QPushButton *m_pMinimizeButton; 47 | QPushButton *m_pMaximizeButton; 48 | QPushButton* m_pButtonRestore; // 最大化还原按钮; 49 | QPushButton *m_pCloseButton; 50 | 51 | bool mMaximizeable=true; 52 | bool mMinimizeable=true; 53 | private: 54 | // 窗口边框宽度; 55 | int m_windowBorderWidth; 56 | 57 | 58 | }; 59 | 60 | #endif // TITLE_BAR 61 | -------------------------------------------------------------------------------- /message_box.h: -------------------------------------------------------------------------------- 1 | #ifndef MESSAGE_BOX 2 | #define MESSAGE_BOX 3 | 4 | /** 5 | 6 | 7 | showInformation(this, QStringLiteral("提示"), QStringLiteral("这是一个普通的提示框-Information!")); 8 | showQuestion(this, QStringLiteral("提示"), QStringLiteral("这是一个普通的提示框-Question!")); 9 | showSuccess(this, QStringLiteral("提示"), QStringLiteral("这是一个普通的提示框-Success!")); 10 | showError(this, QStringLiteral("提示"), QStringLiteral("这是一个普通的提示框-Error!")); 11 | 12 | 13 | */ 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include "customwindow.h" 20 | 21 | class QLabel; 22 | 23 | class MessageBox : public CustomWindow 24 | { 25 | Q_OBJECT 26 | 27 | public: 28 | explicit MessageBox(QWidget *parent = 0, const QString &title = tr("Tip"), const QString &text = tr("This is Infomation!"), 29 | QMessageBox::StandardButtons buttons = QMessageBox::Ok, QMessageBox::StandardButton defaultButton = QMessageBox::Ok); 30 | ~MessageBox(); 31 | QAbstractButton *clickedButton() const; 32 | QMessageBox::StandardButton standardButton(QAbstractButton *button) const; 33 | 34 | // 设置默认按钮 35 | void setDefaultButton(QPushButton *button); 36 | void setDefaultButton(QMessageBox::StandardButton button); 37 | void setStandardButtons(QDialogButtonBox::StandardButtons); 38 | // 设置窗体标题 39 | void setTitle(const QString &title); 40 | // 设置提示信息 41 | void setText(const QString &text); 42 | // 设置窗体图标 43 | void setIcon(const QString &icon); 44 | void setIcon(const QPixmap &icon); 45 | // 添加控件-替换提示信息所在的QLabel 46 | void addWidget(QWidget *pWidget); 47 | 48 | int exec(QAbstractButton *button=NULL); 49 | 50 | protected: 51 | // 多语言翻译 52 | void changeEvent(QEvent *event); 53 | 54 | private slots: 55 | void onButtonClicked(QAbstractButton *button); 56 | 57 | private: 58 | void translateUI(); 59 | 60 | private: 61 | QLabel *m_pIconLabel; 62 | QLabel *m_pLabel; 63 | QGridLayout *m_pGridLayout; 64 | QDialogButtonBox *m_pButtonBox; 65 | QAbstractButton *m_pClickedButton; 66 | QAbstractButton *m_pDefaultButton; 67 | }; 68 | 69 | QMessageBox::StandardButton showInformation(QWidget *parent, const QString &title, 70 | const QString &text, QMessageBox::StandardButtons buttons=QMessageBox::Cancel, 71 | QMessageBox::StandardButton defaultButton=QMessageBox::Cancel); 72 | 73 | 74 | 75 | #endif // MESSAGEBOX_H 76 | -------------------------------------------------------------------------------- /mainwindow.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | MainWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 611 10 | 442 11 | 12 | 13 | 14 | MainWindow 15 | 16 | 17 | 18 | 19 | 20 | 80 21 | 160 22 | 75 23 | 23 24 | 25 | 26 | 27 | PushButton 28 | 29 | 30 | 31 | 32 | 33 | 170 34 | 210 35 | 75 36 | 23 37 | 38 | 39 | 40 | PushButton 41 | 42 | 43 | 44 | 45 | 46 | 290 47 | 260 48 | 75 49 | 23 50 | 51 | 52 | 53 | PushButton 54 | 55 | 56 | 57 | 58 | 59 | 380 60 | 330 61 | 75 62 | 23 63 | 64 | 65 | 66 | PushButton 67 | 68 | 69 | 70 | 71 | 72 | 490 73 | 360 74 | 75 75 | 23 76 | 77 | 78 | 79 | PushButton 80 | 81 | 82 | 83 | 84 | 85 | 86 | 0 87 | 0 88 | 611 89 | 23 90 | 91 | 92 | 93 | 94 | add 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 123 104 | 105 | 106 | 107 | 108 | 109 | 110 | -------------------------------------------------------------------------------- /framelesswindow.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | FramelessWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 496 10 | 334 11 | 12 | 13 | 14 | Widget 15 | 16 | 17 | 18 | 19 | 20 | 21 | 0 22 | 23 | 24 | 0 25 | 26 | 27 | 0 28 | 29 | 30 | 0 31 | 32 | 33 | 0 34 | 35 | 36 | 37 | 38 | 39 | 0 40 | 41 | 42 | 0 43 | 44 | 45 | 0 46 | 47 | 48 | 0 49 | 50 | 51 | 0 52 | 53 | 54 | 55 | 56 | 0 57 | 58 | 59 | 60 | 61 | true 62 | 63 | 64 | 65 | 66 | 0 67 | 0 68 | 492 69 | 330 70 | 71 | 72 | 73 | 74 | 0 75 | 76 | 77 | 0 78 | 79 | 80 | 0 81 | 82 | 83 | 0 84 | 85 | 86 | 0 87 | 88 | 89 | 90 | 91 | 0 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | -------------------------------------------------------------------------------- /frameless_helper.h: -------------------------------------------------------------------------------- 1 | #ifndef FRAMELESS_HELPER_H 2 | #define FRAMELESS_HELPER_H 3 | 4 | /** 5 | 6 | 使用例子 7 | FramelessHelper *pHelper = new FramelessHelper(this); 8 | pHelper->activateOn(this); //激活当前窗体 9 | pHelper->setTitleHeight(pTitleBar->height()); //设置窗体的标题栏高度 10 | pHelper->setWidgetMovable(true); //设置窗体可移动 11 | pHelper->setWidgetResizable(true); //设置窗体可缩放 12 | pHelper->setRubberBandOnMove(true); //设置橡皮筋效果-可移动 13 | pHelper->setRubberBandOnResize(true); //设置橡皮筋效果-可缩放 14 | 15 | 16 | */ 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | class QWidget; 27 | class FramelessHelperPrivate; 28 | 29 | class FramelessHelper : public QObject 30 | { 31 | Q_OBJECT 32 | 33 | public: 34 | explicit FramelessHelper(QObject *parent = 0); 35 | ~FramelessHelper(); 36 | // 激活窗体 37 | void activateOn(QWidget *topLevelWidget); 38 | // 移除窗体 39 | void removeFrom(QWidget *topLevelWidget); 40 | // 设置窗体移动 41 | void setWidgetMovable(bool movable); 42 | // 设置窗体缩放 43 | void setWidgetResizable(bool resizable); 44 | // 设置橡皮筋移动 45 | void setRubberBandOnMove(bool movable); 46 | // 设置橡皮筋缩放 47 | void setRubberBandOnResize(bool resizable); 48 | // 设置边框的宽度 49 | void setBorderWidth(uint width); 50 | // 设置标题栏高度 51 | void setTitleHeight(uint height); 52 | bool widgetResizable(); 53 | bool widgetMovable(); 54 | bool rubberBandOnMove(); 55 | bool rubberBandOnResisze(); 56 | uint borderWidth(); 57 | uint titleHeight(); 58 | 59 | protected: 60 | // 事件过滤,进行移动、缩放等 61 | virtual bool eventFilter(QObject *obj, QEvent *event); 62 | 63 | private: 64 | FramelessHelperPrivate *d; 65 | }; 66 | 67 | 68 | /***** 69 | * CursorPosCalculator 70 | * 计算鼠标是否位于左、上、右、下、左上角、左下角、右上角、右下角 71 | *****/ 72 | class CursorPosCalculator 73 | { 74 | public: 75 | explicit CursorPosCalculator(); 76 | void reset(); 77 | void recalculate(const QPoint &globalMousePos, const QRect &frameRect); 78 | 79 | public: 80 | bool m_bOnEdges : true; 81 | bool m_bOnLeftEdge : true; 82 | bool m_bOnRightEdge : true; 83 | bool m_bOnTopEdge : true; 84 | bool m_bOnBottomEdge : true; 85 | bool m_bOnTopLeftEdge : true; 86 | bool m_bOnBottomLeftEdge : true; 87 | bool m_bOnTopRightEdge : true; 88 | bool m_bOnBottomRightEdge : true; 89 | 90 | static int m_nBorderWidth; 91 | static int m_nTitleHeight; 92 | }; 93 | 94 | 95 | /***** 96 | * WidgetData 97 | * 更新鼠标样式、移动窗体、缩放窗体 98 | *****/ 99 | class WidgetData 100 | { 101 | public: 102 | explicit WidgetData(FramelessHelperPrivate *d, QWidget *pTopLevelWidget); 103 | ~WidgetData(); 104 | QWidget* widget(); 105 | // 处理鼠标事件-划过、按下、释放、移动 106 | void handleWidgetEvent(QEvent *event); 107 | // 更新橡皮筋状态 108 | void updateRubberBandStatus(); 109 | 110 | private: 111 | // 更新鼠标样式 112 | void updateCursorShape(const QPoint &gMousePos); 113 | // 重置窗体大小 114 | void resizeWidget(const QPoint &gMousePos); 115 | // 移动窗体 116 | void moveWidget(const QPoint &gMousePos); 117 | // 处理鼠标按下 118 | void handleMousePressEvent(QMouseEvent *event); 119 | // 处理鼠标释放 120 | void handleMouseReleaseEvent(QMouseEvent *event); 121 | // 处理鼠标移动 122 | void handleMouseMoveEvent(QMouseEvent *event); 123 | // 处理鼠标离开 124 | void handleLeaveEvent(QEvent *event); 125 | // 处理鼠标进入 126 | void handleHoverMoveEvent(QHoverEvent *event); 127 | 128 | private: 129 | FramelessHelperPrivate *d; 130 | QRubberBand *m_pRubberBand; 131 | QWidget *m_pWidget; 132 | QPoint m_ptDragPos; 133 | CursorPosCalculator m_pressedMousePos; 134 | CursorPosCalculator m_moveMousePos; 135 | bool m_bLeftButtonPressed; 136 | bool m_bCursorShapeChanged; 137 | bool m_bLeftButtonTitlePressed; 138 | Qt::WindowFlags m_windowFlags; 139 | }; 140 | 141 | /***** 142 | * FramelessHelperPrivate 143 | * 存储界面对应的数据集合,以及是否可移动、可缩放属性 144 | *****/ 145 | 146 | class FramelessHelperPrivate 147 | { 148 | public: 149 | QHash m_widgetDataHash; 150 | bool m_bWidgetMovable : true; 151 | bool m_bWidgetResizable : true; 152 | bool m_bRubberBandOnResize : true; 153 | bool m_bRubberBandOnMove : true; 154 | }; 155 | 156 | #endif //FRAMELESS_HELPER_H 157 | -------------------------------------------------------------------------------- /framelesswindow.cpp: -------------------------------------------------------------------------------- 1 | #include "FramelessWindow.h" 2 | #include "ui_framelesswindow.h" 3 | #include "titlebar.h" 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include "frameless_helper.h" 14 | 15 | 16 | FramelessWindow::FramelessWindow(QWidget *parent) : 17 | QWidget(parent), 18 | ui(new Ui::FramelessWindow), 19 | m_bPressed(false), 20 | m_nBorder(5)//drag edge 21 | { 22 | ui->setupUi(this); 23 | 24 | setWindowFlags(Qt::FramelessWindowHint | windowFlags()); 25 | // 背景透明 26 | setAttribute(Qt::WA_TranslucentBackground, true); 27 | setWindowOpacity(1); 28 | 29 | pTitleBar = new TitleBar(this); 30 | 31 | installEventFilter(pTitleBar); 32 | 33 | resize(400, 300); 34 | 35 | setWindowTitle("Custom Window"); 36 | setWindowIcon(QIcon(":/images/logo")); 37 | 38 | //添加标题栏 39 | ui->contentLayout->insertWidget(0,pTitleBar); 40 | 41 | //设置窗口样式 42 | pHelper = new FramelessHelper(this); 43 | pHelper->activateOn(this); //激活当前窗体 44 | pHelper->setTitleHeight(pTitleBar->height()); //设置窗体的标题栏高度 45 | pHelper->setWidgetMovable(true); //设置窗体可移动 46 | pHelper->setWidgetResizable(true); //设置窗体可缩放 47 | pHelper->setRubberBandOnMove(false); //设置橡皮筋效果-可移动 48 | pHelper->setRubberBandOnResize(true); //设置橡皮筋效果-可缩放 49 | 50 | // //shadow under window title text 51 | // QGraphicsDropShadowEffect *textShadow = new QGraphicsDropShadowEffect; 52 | // textShadow->setBlurRadius(4.0); 53 | // textShadow->setColor(QColor("#eee")); 54 | // textShadow->setOffset(0.0); 55 | // pTitleBar->m_pTitleLabel->setGraphicsEffect(textShadow); 56 | 57 | //window shadow 58 | // QGraphicsDropShadowEffect *windowShadow = new QGraphicsDropShadowEffect; 59 | // windowShadow->setBlurRadius(9.0); 60 | // windowShadow->setColor(palette().color(QPalette::Highlight)); 61 | // windowShadow->setOffset(0.0); 62 | // ui->windowFrame->setGraphicsEffect(windowShadow); 63 | 64 | this->loadStyleSheet("MyTitle"); 65 | } 66 | 67 | 68 | 69 | FramelessWindow::~FramelessWindow() 70 | { 71 | delete ui; 72 | } 73 | 74 | void FramelessWindow::paintEvent(QPaintEvent*) 75 | 76 | { 77 | QStyleOption opt; 78 | opt.init(this); 79 | QPainter p(this); 80 | style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); 81 | } 82 | 83 | void FramelessWindow::loadStyleSheet(const QString &sheetName) 84 | { 85 | QFile file(":/Resources/" + sheetName + ".css"); 86 | file.open(QFile::ReadOnly); 87 | if (file.isOpen()) 88 | { 89 | QString styleSheet = this->styleSheet(); 90 | styleSheet += QLatin1String(file.readAll()); 91 | this->setStyleSheet(styleSheet); 92 | } 93 | 94 | } 95 | void FramelessWindow::setContent(QWidget *w) 96 | { 97 | ui->contentLayout->setMargin(0); 98 | // ui->contentLayout->addWidget(w); 99 | ui->mainLayout->addWidget(w); 100 | ui->scrollArea->widget()->setMinimumSize(w->size()); 101 | resize(w->size().width()+2,w->size().height()+2+pTitleBar->height() ); 102 | } 103 | 104 | void FramelessWindow::setMinimizeVisible(bool visible){ 105 | this->pTitleBar->mMinimizeable=visible; 106 | this->pTitleBar->m_pMinimizeButton->setVisible(visible); 107 | } 108 | 109 | void FramelessWindow::setMaximizeVisible(bool visible){ 110 | this->pTitleBar->mMaximizeable=visible; 111 | this->pTitleBar->m_pMaximizeButton->setVisible(visible); 112 | this->pTitleBar->m_pButtonRestore->setVisible(!visible); 113 | 114 | } 115 | 116 | void FramelessWindow::setWidgetResizable(bool resizable){ 117 | this->pHelper->setWidgetResizable(resizable); 118 | } 119 | 120 | // 鼠标相对于窗体的位置 event->globalPos() - this->pos() 121 | void FramelessWindow::mousePressEvent(QMouseEvent *event) 122 | { 123 | 124 | //#ifdef Q_OS_WIN 125 | // if (ReleaseCapture()) 126 | // SendMessage(HWND(winId()), WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0); 127 | // event->ignore(); 128 | //#else 129 | 130 | if (event->button() == Qt::LeftButton) 131 | { 132 | m_bPressed = true; 133 | m_point = event->pos(); 134 | } 135 | //#endif 136 | } 137 | 138 | // 若鼠标左键被按下,移动窗体位置 139 | void FramelessWindow::mouseMoveEvent(QMouseEvent *event) 140 | { 141 | if (m_bPressed) 142 | move(event->pos() - m_point + pos()); 143 | } 144 | 145 | // 设置鼠标未被按下 146 | void FramelessWindow::mouseReleaseEvent(QMouseEvent *event) 147 | { 148 | Q_UNUSED(event); 149 | 150 | m_bPressed = false; 151 | } 152 | 153 | 154 | -------------------------------------------------------------------------------- /titlebar.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include "titlebar.h" 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | TitleBar::TitleBar(QWidget *parent) 14 | : QWidget(parent) 15 | , m_windowBorderWidth(0) 16 | { 17 | setFixedHeight(30); 18 | 19 | m_pIconLabel = new QLabel(this); 20 | m_pTitleLabel = new QLabel(this); 21 | m_pMinimizeButton = new QPushButton(this); 22 | m_pMaximizeButton = new QPushButton(this); 23 | m_pButtonRestore= new QPushButton(this); 24 | m_pCloseButton = new QPushButton(this); 25 | 26 | m_pIconLabel->setFixedSize(20, 20); 27 | m_pIconLabel->setScaledContents(true); 28 | 29 | m_pTitleLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); 30 | 31 | m_pMinimizeButton->setFixedSize(27, 22); 32 | m_pMaximizeButton->setFixedSize(27, 22); 33 | m_pCloseButton->setFixedSize(27, 22); 34 | m_pButtonRestore->setFixedSize(27, 22); 35 | 36 | setObjectName("titleBar"); 37 | m_pTitleLabel->setObjectName("whiteLabel"); 38 | m_pMinimizeButton->setObjectName("minimizeButton"); 39 | m_pMaximizeButton->setObjectName("maximizeButton"); 40 | m_pCloseButton->setObjectName("closeButton"); 41 | m_pButtonRestore->setObjectName("restoreButton"); 42 | 43 | m_pMinimizeButton->setToolTip("Minimize"); 44 | m_pMaximizeButton->setToolTip("Maximize"); 45 | m_pCloseButton->setToolTip("Close"); 46 | m_pButtonRestore->setToolTip("Restore"); 47 | 48 | m_pMinimizeButton->setFocusPolicy(Qt::TabFocus); 49 | m_pMaximizeButton->setFocusPolicy(Qt::TabFocus); 50 | m_pCloseButton->setFocusPolicy(Qt::TabFocus); 51 | m_pButtonRestore->setFocusPolicy(Qt::TabFocus); 52 | 53 | m_pButtonRestore->hide(); 54 | 55 | 56 | QHBoxLayout *pLayout = new QHBoxLayout(this); 57 | pLayout->addWidget(m_pIconLabel); 58 | pLayout->addSpacing(5); 59 | pLayout->addWidget(m_pTitleLabel,1); 60 | pLayout->addWidget(m_pMinimizeButton); 61 | pLayout->addWidget(m_pMaximizeButton); 62 | pLayout->addWidget(m_pButtonRestore); 63 | pLayout->addWidget(m_pCloseButton); 64 | pLayout->setSpacing(0); 65 | pLayout->setContentsMargins(5, 0, 5, 0); 66 | 67 | setLayout(pLayout); 68 | 69 | connect(m_pMinimizeButton, SIGNAL(clicked(bool)), this, SLOT(onClicked())); 70 | connect(m_pMaximizeButton, SIGNAL(clicked(bool)), this, SLOT(onClicked())); 71 | connect(m_pCloseButton, SIGNAL(clicked(bool)), this, SLOT(onClicked())); 72 | connect(m_pButtonRestore, SIGNAL(clicked(bool)), this, SLOT(onClicked())); 73 | 74 | // 加载本地样式 MyTitle.css文件; 75 | 76 | } 77 | 78 | TitleBar::~TitleBar() 79 | { 80 | 81 | } 82 | 83 | void TitleBar::mouseDoubleClickEvent(QMouseEvent *event) 84 | { 85 | Q_UNUSED(event); 86 | 87 | QWidget *pWindow = this->window(); 88 | if (pWindow->isTopLevel()) 89 | { 90 | if(mMaximizeable&&mMinimizeable){ 91 | if( pWindow->isMaximized()){ 92 | emit m_pButtonRestore->clicked(); 93 | }else{ 94 | emit m_pMaximizeButton->clicked(); 95 | } 96 | } 97 | 98 | } 99 | } 100 | 101 | // 绘制标题栏背景色; 102 | //void TitleBar::paintEvent(QPaintEvent *event) 103 | //{ 104 | // //设置背景色; 105 | // QPainter painter(this); 106 | // QPainterPath pathBack; 107 | // pathBack.setFillRule(Qt::WindingFill); 108 | // pathBack.addRoundedRect(QRect(0, 0, this->width(), this->height()), 3, 3); 109 | // painter.setRenderHint(QPainter::SmoothPixmapTransform, true); 110 | // painter.fillPath(pathBack, QBrush(m_barColor)); 111 | 112 | // // 当窗口最大化或者还原后,窗口长度变了,标题栏的长度应当一起改变; 113 | // // 这里减去m_windowBorderWidth ,是因为窗口可能设置了不同宽度的边框; 114 | // // 如果窗口有边框则需要设置m_windowBorderWidth的值,否则m_windowBorderWidth默认为0; 115 | // if (this->width() != (this->parentWidget()->width() - m_windowBorderWidth)) 116 | // { 117 | // this->setFixedWidth(this->parentWidget()->width() - m_windowBorderWidth); 118 | // } 119 | // QWidget::paintEvent(event); 120 | //} 121 | 122 | void TitleBar::paintEvent(QPaintEvent*) 123 | 124 | { 125 | QStyleOption opt; 126 | opt.init(this); 127 | QPainter p(this); 128 | style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); 129 | } 130 | 131 | 132 | //void TitleBar::mousePressEvent(QMouseEvent *event) 133 | //{ 134 | //#ifdef Q_OS_WIN 135 | // if (ReleaseCapture()) 136 | // { 137 | // QWidget *pWindow = this->window(); 138 | // if (pWindow->isTopLevel()) 139 | // { 140 | // SendMessage(HWND(pWindow->winId()), WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0); 141 | // } 142 | // } 143 | // event->ignore(); 144 | //#else 145 | //#endif 146 | //} 147 | 148 | bool TitleBar::eventFilter(QObject *obj, QEvent *event) 149 | { 150 | switch (event->type()) 151 | { 152 | case QEvent::WindowTitleChange: 153 | { 154 | QWidget *pWidget = qobject_cast(obj); 155 | if (pWidget) 156 | { 157 | m_pTitleLabel->setText(pWidget->windowTitle()); 158 | return true; 159 | } 160 | } 161 | case QEvent::WindowIconChange: 162 | { 163 | QWidget *pWidget = qobject_cast(obj); 164 | if (pWidget) 165 | { 166 | QIcon icon = pWidget->windowIcon(); 167 | m_pIconLabel->setPixmap(icon.pixmap(m_pIconLabel->size())); 168 | return true; 169 | } 170 | } 171 | case QEvent::WindowStateChange: 172 | case QEvent::Resize: 173 | updateMaximize(); 174 | return true; 175 | } 176 | return QWidget::eventFilter(obj, event); 177 | } 178 | 179 | void TitleBar::onClicked() 180 | { 181 | QPushButton *pButton = qobject_cast(sender()); 182 | QWidget *pWindow = this->window(); 183 | if (pWindow->isTopLevel()) 184 | { 185 | if (pButton == m_pMinimizeButton) 186 | { 187 | pWindow->showMinimized(); 188 | } 189 | else if (pButton == m_pMaximizeButton) 190 | { 191 | //显示还原 192 | m_pMaximizeButton->setVisible(false); 193 | m_pButtonRestore->setVisible(true); 194 | pWindow->showMaximized(); 195 | } 196 | else if (pButton == m_pButtonRestore) 197 | { 198 | //显示最大化 199 | m_pMaximizeButton->setVisible(true); 200 | m_pButtonRestore->setVisible(false); 201 | pWindow->showNormal(); 202 | } 203 | else if (pButton == m_pCloseButton) 204 | { 205 | pWindow->close(); 206 | } 207 | } 208 | } 209 | 210 | void TitleBar::updateMaximize() 211 | { 212 | QWidget *pWindow = this->window(); 213 | if (pWindow->isTopLevel()) 214 | { 215 | bool bMaximize = pWindow->isMaximized(); 216 | if (bMaximize) 217 | { 218 | if(mMaximizeable){ 219 | //显示还原 220 | m_pMaximizeButton->setVisible(false); 221 | m_pButtonRestore->setVisible(true); 222 | // m_pMaximizeButton->hide(); 223 | // m_pButtonRestore->show(); 224 | } 225 | 226 | // m_pMaximizeButtm_pMaximizeButton->setToolTip(tr("Restore")); 227 | // m_pMaximizeButtm_pMaximizeButton->setProperty("maximizeProperty", "restore"); 228 | } 229 | else 230 | { 231 | if(mMaximizeable){ 232 | //显示最大化 233 | m_pMaximizeButton->setVisible(true); 234 | m_pButtonRestore->setVisible(false); 235 | } 236 | // m_pMaximizeButton->setProperty("maximizeProperty", "maximize"); 237 | // m_pMaximizeButton->setToolTip(tr("Maximize")); 238 | } 239 | 240 | 241 | } 242 | } 243 | -------------------------------------------------------------------------------- /message_box.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "message_box.h" 9 | 10 | MessageBox::MessageBox(QWidget *parent, const QString &title, const QString &text, 11 | QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton) 12 | : CustomWindow(parent) 13 | { 14 | resize(300, 130); 15 | setWindowIcon(QIcon(":/images/logo")); 16 | setWindowTitle(title); 17 | this->setMinimumSize(300, 130); 18 | 19 | setMinimizeVisible(false); 20 | setMaximizeVisible(false); 21 | 22 | setWidgetResizable(false); 23 | 24 | m_pButtonBox = new QDialogButtonBox(this); 25 | m_pButtonBox->setStandardButtons(QDialogButtonBox::StandardButtons(int(buttons))); 26 | setDefaultButton(defaultButton); 27 | 28 | QPushButton *pYesButton = m_pButtonBox->button(QDialogButtonBox::Yes); 29 | if (pYesButton != NULL) 30 | { 31 | pYesButton->setObjectName("blueButton"); 32 | pYesButton->setStyle(QApplication::style()); 33 | } 34 | 35 | m_pIconLabel = new QLabel(this); 36 | m_pLabel = new QLabel(this); 37 | 38 | // QPixmap pixmap(); 39 | m_pIconLabel->setPixmap(style()->standardPixmap(QStyle::SP_MessageBoxInformation)); 40 | m_pIconLabel->setFixedSize(35, 35); 41 | m_pIconLabel->setScaledContents(true); 42 | 43 | m_pLabel->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); 44 | m_pLabel->setObjectName("whiteLabel"); 45 | m_pLabel->setOpenExternalLinks(true); 46 | m_pLabel->setText(text); 47 | 48 | m_pGridLayout = new QGridLayout(); 49 | m_pGridLayout->addWidget(m_pIconLabel, 0, 0, 2, 1, Qt::AlignTop); 50 | m_pGridLayout->addWidget(m_pLabel, 0, 1, 2, 1); 51 | m_pGridLayout->addWidget(m_pButtonBox, m_pGridLayout->rowCount(), 0, 1, m_pGridLayout->columnCount()); 52 | m_pGridLayout->setSizeConstraint(QLayout::SetNoConstraint); 53 | m_pGridLayout->setHorizontalSpacing(10); 54 | m_pGridLayout->setVerticalSpacing(10); 55 | m_pGridLayout->setContentsMargins(10, 10, 10, 10); 56 | m_pLayout->addLayout(m_pGridLayout); 57 | 58 | translateUI(); 59 | 60 | connect(m_pButtonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(onButtonClicked(QAbstractButton*))); 61 | 62 | } 63 | 64 | MessageBox::~MessageBox() 65 | { 66 | 67 | } 68 | 69 | void MessageBox::setStandardButtons(QDialogButtonBox::StandardButtons buttons){ 70 | m_pButtonBox->setStandardButtons(buttons); 71 | } 72 | 73 | void MessageBox::changeEvent(QEvent *event) 74 | { 75 | switch (event->type()) 76 | { 77 | case QEvent::LanguageChange: 78 | translateUI(); 79 | break; 80 | default: 81 | CustomWindow::changeEvent(event); 82 | } 83 | } 84 | 85 | void MessageBox::translateUI() 86 | { 87 | QPushButton *pYesButton = m_pButtonBox->button(QDialogButtonBox::Yes); 88 | if (pYesButton != NULL) 89 | pYesButton->setText(tr("Yes")); 90 | 91 | QPushButton *pNoButton = m_pButtonBox->button(QDialogButtonBox::No); 92 | if (pNoButton != NULL) 93 | pNoButton->setText(tr("No")); 94 | 95 | QPushButton *pOkButton = m_pButtonBox->button(QDialogButtonBox::Ok); 96 | if (pOkButton != NULL) 97 | pOkButton->setText(tr("Ok")); 98 | 99 | QPushButton *pCancelButton = m_pButtonBox->button(QDialogButtonBox::Cancel); 100 | if (pCancelButton != NULL) 101 | pCancelButton->setText(tr("Cancel")); 102 | } 103 | 104 | QMessageBox::StandardButton MessageBox::standardButton(QAbstractButton *button) const 105 | { 106 | return (QMessageBox::StandardButton)m_pButtonBox->standardButton(button); 107 | } 108 | 109 | QAbstractButton *MessageBox::clickedButton() const 110 | { 111 | return m_pClickedButton; 112 | } 113 | 114 | int MessageBox::exec(QAbstractButton *button) 115 | { 116 | int nResult = m_pButtonBox->standardButton(button); 117 | return nResult; 118 | } 119 | 120 | void MessageBox::onButtonClicked(QAbstractButton *button) 121 | { 122 | m_pClickedButton = button; 123 | (exec(button)); 124 | } 125 | 126 | void MessageBox::setDefaultButton(QPushButton *button) 127 | { 128 | if (!m_pButtonBox->buttons().contains(button)) 129 | return; 130 | m_pDefaultButton = button; 131 | button->setDefault(true); 132 | button->setFocus(); 133 | } 134 | 135 | void MessageBox::setDefaultButton(QMessageBox::StandardButton button) 136 | { 137 | setDefaultButton(m_pButtonBox->button(QDialogButtonBox::StandardButton(button))); 138 | } 139 | 140 | void MessageBox::setTitle(const QString &title) 141 | { 142 | setWindowTitle(title); 143 | } 144 | 145 | void MessageBox::setText(const QString &text) 146 | { 147 | m_pLabel->setText(text); 148 | } 149 | 150 | void MessageBox::setIcon(const QString &icon) 151 | { 152 | m_pIconLabel->setPixmap(QPixmap(icon)); 153 | } 154 | 155 | void MessageBox::setIcon(const QPixmap &icon) 156 | { 157 | m_pIconLabel->setPixmap((icon)); 158 | } 159 | 160 | 161 | void MessageBox::addWidget(QWidget *pWidget) 162 | { 163 | m_pLabel->hide(); 164 | m_pGridLayout->addWidget(pWidget, 0, 1, 2, 1); 165 | } 166 | 167 | 168 | QMessageBox::StandardButton showInformation(QWidget *parent, const QString &title, 169 | const QString &text, QMessageBox::StandardButtons buttons, 170 | QMessageBox::StandardButton defaultButton) 171 | { 172 | MessageBox msgBox(parent, title, text, buttons, defaultButton); 173 | msgBox.setIcon(msgBox.style()->standardPixmap(QStyle::SP_MessageBoxInformation)); 174 | if (msgBox.exec() == -1) 175 | return QMessageBox::Cancel; 176 | return msgBox.standardButton(msgBox.clickedButton()); 177 | } 178 | 179 | QMessageBox::StandardButton showError(QWidget *parent, const QString &title, 180 | const QString &text, QMessageBox::StandardButtons buttons, 181 | QMessageBox::StandardButton defaultButton) 182 | { 183 | MessageBox msgBox(parent, title, text, buttons, defaultButton); 184 | msgBox.setIcon(msgBox.style()->standardPixmap(QStyle::SP_MessageBoxCritical)); 185 | if (msgBox.exec() == -1) 186 | return QMessageBox::Cancel; 187 | return msgBox.standardButton(msgBox.clickedButton()); 188 | } 189 | 190 | QMessageBox::StandardButton showSuccess(QWidget *parent, const QString &title, 191 | const QString &text, QMessageBox::StandardButtons buttons, 192 | QMessageBox::StandardButton defaultButton) 193 | { 194 | MessageBox msgBox(parent, title, text, buttons, defaultButton); 195 | msgBox.setIcon(msgBox.style()->standardPixmap(QStyle::SP_MessageBoxInformation)); 196 | if (msgBox.exec() == -1) 197 | return QMessageBox::Cancel; 198 | return msgBox.standardButton(msgBox.clickedButton()); 199 | } 200 | 201 | QMessageBox::StandardButton showQuestion(QWidget *parent, const QString &title, 202 | const QString &text, QMessageBox::StandardButtons buttons, 203 | QMessageBox::StandardButton defaultButton) 204 | { 205 | MessageBox msgBox(parent, title, text, buttons, defaultButton); 206 | msgBox.setIcon(msgBox.style()->standardPixmap(QStyle::SP_MessageBoxQuestion)); 207 | if (msgBox.exec() == -1) 208 | return QMessageBox::Cancel; 209 | return msgBox.standardButton(msgBox.clickedButton()); 210 | } 211 | 212 | QMessageBox::StandardButton showWarning(QWidget *parent, const QString &title, 213 | const QString &text, QMessageBox::StandardButtons buttons, 214 | QMessageBox::StandardButton defaultButton) 215 | { 216 | MessageBox msgBox(parent, title, text, buttons, defaultButton); 217 | msgBox.setIcon(msgBox.style()->standardPixmap(QStyle::SP_MessageBoxWarning)); 218 | if (msgBox.exec() == -1) 219 | return QMessageBox::Cancel; 220 | return msgBox.standardButton(msgBox.clickedButton()); 221 | } 222 | 223 | QMessageBox::StandardButton showCritical(QWidget *parent, const QString &title, 224 | const QString &text, QMessageBox::StandardButtons buttons, 225 | QMessageBox::StandardButton defaultButton) 226 | { 227 | MessageBox msgBox(parent, title, text, buttons, defaultButton); 228 | msgBox.setIcon(msgBox.style()->standardPixmap(QStyle::SP_MessageBoxCritical)); 229 | if (msgBox.exec() == -1) 230 | return QMessageBox::Cancel; 231 | return msgBox.standardButton(msgBox.clickedButton()); 232 | } 233 | 234 | QMessageBox::StandardButton showCheckBoxQuestion(QWidget *parent, const QString &title, 235 | const QString &text, QMessageBox::StandardButtons buttons, 236 | QMessageBox::StandardButton defaultButton) 237 | { 238 | MessageBox msgBox(parent, title, text, buttons, defaultButton); 239 | msgBox.setIcon(msgBox.style()->standardPixmap(QStyle::SP_MessageBoxQuestion)); 240 | 241 | QCheckBox *pCheckBox = new QCheckBox(&msgBox); 242 | pCheckBox->setText(text); 243 | msgBox.addWidget(pCheckBox); 244 | if (msgBox.exec() == -1) 245 | return QMessageBox::Cancel; 246 | 247 | QMessageBox::StandardButton standardButton = msgBox.standardButton(msgBox.clickedButton()); 248 | if (standardButton == QMessageBox::Yes) 249 | { 250 | return pCheckBox->isChecked() ? QMessageBox::Yes : QMessageBox::No; 251 | } 252 | return QMessageBox::Cancel; 253 | } 254 | 255 | -------------------------------------------------------------------------------- /frameless_helper.cpp: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "frameless_helper.h" 4 | #include 5 | #include 6 | 7 | int CursorPosCalculator::m_nBorderWidth = 5; 8 | int CursorPosCalculator::m_nTitleHeight = 30; 9 | 10 | /***** CursorPosCalculator *****/ 11 | CursorPosCalculator::CursorPosCalculator() 12 | { 13 | reset(); 14 | } 15 | 16 | void CursorPosCalculator::reset() 17 | { 18 | m_bOnEdges = false; 19 | m_bOnLeftEdge = false; 20 | m_bOnRightEdge = false; 21 | m_bOnTopEdge = false; 22 | m_bOnBottomEdge = false; 23 | m_bOnTopLeftEdge = false; 24 | m_bOnBottomLeftEdge = false; 25 | m_bOnTopRightEdge = false; 26 | m_bOnBottomRightEdge = false; 27 | } 28 | 29 | void CursorPosCalculator::recalculate(const QPoint &gMousePos, const QRect &frameRect) 30 | { 31 | int globalMouseX = gMousePos.x(); 32 | int globalMouseY = gMousePos.y(); 33 | 34 | int frameX = frameRect.x(); 35 | int frameY = frameRect.y(); 36 | 37 | int frameWidth = frameRect.width(); 38 | int frameHeight = frameRect.height(); 39 | 40 | m_bOnLeftEdge = (globalMouseX >= frameX && 41 | globalMouseX <= frameX + m_nBorderWidth ); 42 | 43 | 44 | m_bOnRightEdge = (globalMouseX >= frameX + frameWidth - m_nBorderWidth && 45 | globalMouseX <= frameX + frameWidth); 46 | 47 | m_bOnTopEdge = (globalMouseY >= frameY && 48 | globalMouseY <= frameY + m_nBorderWidth ); 49 | 50 | m_bOnBottomEdge = (globalMouseY >= frameY + frameHeight - m_nBorderWidth && 51 | globalMouseY <= frameY + frameHeight); 52 | 53 | m_bOnTopLeftEdge = m_bOnTopEdge && m_bOnLeftEdge; 54 | m_bOnBottomLeftEdge = m_bOnBottomEdge && m_bOnLeftEdge; 55 | m_bOnTopRightEdge = m_bOnTopEdge && m_bOnRightEdge; 56 | m_bOnBottomRightEdge = m_bOnBottomEdge && m_bOnRightEdge; 57 | 58 | m_bOnEdges = m_bOnLeftEdge || m_bOnRightEdge || m_bOnTopEdge || m_bOnBottomEdge; 59 | } 60 | 61 | 62 | /***** WidgetData *****/ 63 | WidgetData::WidgetData(FramelessHelperPrivate *_d, QWidget *pTopLevelWidget) 64 | { 65 | d = _d; 66 | m_pWidget = pTopLevelWidget; 67 | m_bLeftButtonPressed = false; 68 | m_bCursorShapeChanged = false; 69 | m_bLeftButtonTitlePressed = false; 70 | m_pRubberBand = NULL; 71 | 72 | m_windowFlags = m_pWidget->windowFlags(); 73 | m_pWidget->setMouseTracking(true); 74 | m_pWidget->setAttribute(Qt::WA_Hover, true); 75 | 76 | updateRubberBandStatus(); 77 | } 78 | 79 | WidgetData::~WidgetData() 80 | { 81 | m_pWidget->setMouseTracking(false); 82 | m_pWidget->setWindowFlags(m_windowFlags); 83 | m_pWidget->setAttribute(Qt::WA_Hover, false); 84 | 85 | delete m_pRubberBand; 86 | m_pRubberBand = NULL; 87 | } 88 | 89 | QWidget* WidgetData::widget() 90 | { 91 | return m_pWidget; 92 | } 93 | 94 | void WidgetData::handleWidgetEvent(QEvent *event) 95 | { 96 | switch (event->type()) 97 | { 98 | default: 99 | break; 100 | case QEvent::MouseButtonPress: 101 | handleMousePressEvent(static_cast(event)); 102 | break; 103 | case QEvent::MouseButtonRelease: 104 | handleMouseReleaseEvent(static_cast(event)); 105 | break; 106 | case QEvent::MouseMove: 107 | handleMouseMoveEvent(static_cast(event)); 108 | break; 109 | case QEvent::Leave: 110 | handleLeaveEvent(static_cast(event)); 111 | break; 112 | case QEvent::HoverMove: 113 | handleHoverMoveEvent(static_cast(event)); 114 | break; 115 | } 116 | } 117 | 118 | void WidgetData::updateRubberBandStatus() 119 | { 120 | if (d->m_bRubberBandOnMove || d->m_bRubberBandOnResize) 121 | { 122 | if (NULL == m_pRubberBand){ 123 | m_pRubberBand = new QRubberBand(QRubberBand::Rectangle); 124 | QPalette pal; 125 | pal.setBrush(QPalette::Highlight, QBrush(Qt::red)); 126 | m_pRubberBand->setPalette(pal); 127 | } 128 | } 129 | else 130 | { 131 | delete m_pRubberBand; 132 | m_pRubberBand = NULL; 133 | } 134 | } 135 | 136 | void WidgetData::updateCursorShape(const QPoint &gMousePos) 137 | { 138 | if (m_pWidget->isFullScreen() || m_pWidget->isMaximized()) 139 | { 140 | if (m_bCursorShapeChanged) 141 | { 142 | m_pWidget->unsetCursor(); 143 | } 144 | return; 145 | } 146 | 147 | m_moveMousePos.recalculate(gMousePos, m_pWidget->frameGeometry()); 148 | 149 | if(m_moveMousePos.m_bOnTopLeftEdge || m_moveMousePos.m_bOnBottomRightEdge) 150 | { 151 | m_pWidget->setCursor( Qt::SizeFDiagCursor ); 152 | m_bCursorShapeChanged = true; 153 | } 154 | else if(m_moveMousePos.m_bOnTopRightEdge || m_moveMousePos.m_bOnBottomLeftEdge) 155 | { 156 | m_pWidget->setCursor( Qt::SizeBDiagCursor ); 157 | m_bCursorShapeChanged = true; 158 | } 159 | else if(m_moveMousePos.m_bOnLeftEdge || m_moveMousePos.m_bOnRightEdge) 160 | { 161 | m_pWidget->setCursor( Qt::SizeHorCursor ); 162 | m_bCursorShapeChanged = true; 163 | } 164 | else if(m_moveMousePos.m_bOnTopEdge || m_moveMousePos.m_bOnBottomEdge) 165 | { 166 | m_pWidget->setCursor( Qt::SizeVerCursor ); 167 | m_bCursorShapeChanged = true; 168 | } 169 | else 170 | { 171 | if (m_bCursorShapeChanged) 172 | { 173 | m_pWidget->unsetCursor(); 174 | m_bCursorShapeChanged = false; 175 | } 176 | } 177 | } 178 | 179 | void WidgetData::resizeWidget(const QPoint &gMousePos) 180 | { 181 | QRect origRect; 182 | 183 | if (d->m_bRubberBandOnResize) 184 | origRect = m_pRubberBand->frameGeometry(); 185 | else 186 | origRect = m_pWidget->frameGeometry(); 187 | 188 | int left = origRect.left(); 189 | int top = origRect.top(); 190 | int right = origRect.right(); 191 | int bottom = origRect.bottom(); 192 | origRect.getCoords(&left, &top, &right, &bottom); 193 | 194 | int minWidth = m_pWidget->minimumWidth(); 195 | int minHeight = m_pWidget->minimumHeight(); 196 | 197 | if (m_pressedMousePos.m_bOnTopLeftEdge) 198 | { 199 | left = gMousePos.x(); 200 | top = gMousePos.y(); 201 | } 202 | else if (m_pressedMousePos.m_bOnBottomLeftEdge) 203 | { 204 | left = gMousePos.x(); 205 | bottom = gMousePos.y(); 206 | } 207 | else if (m_pressedMousePos.m_bOnTopRightEdge) 208 | { 209 | right = gMousePos.x(); 210 | top = gMousePos.y(); 211 | } 212 | else if (m_pressedMousePos.m_bOnBottomRightEdge) 213 | { 214 | right = gMousePos.x(); 215 | bottom = gMousePos.y(); 216 | } 217 | else if (m_pressedMousePos.m_bOnLeftEdge) 218 | { 219 | left = gMousePos.x(); 220 | } 221 | else if (m_pressedMousePos.m_bOnRightEdge) 222 | { 223 | right = gMousePos.x(); 224 | } 225 | else if (m_pressedMousePos.m_bOnTopEdge) 226 | { 227 | top = gMousePos.y(); 228 | } 229 | else if (m_pressedMousePos.m_bOnBottomEdge) 230 | { 231 | bottom = gMousePos.y(); 232 | } 233 | 234 | QRect newRect(QPoint(left, top), QPoint(right, bottom)); 235 | 236 | if (newRect.isValid()) 237 | { 238 | if (minWidth > newRect.width()) 239 | { 240 | if (left != origRect.left()) 241 | newRect.setLeft(origRect.left()); 242 | else 243 | newRect.setRight(origRect.right()); 244 | } 245 | if (minHeight > newRect.height()) 246 | { 247 | if (top != origRect.top()) 248 | newRect.setTop(origRect.top()); 249 | else 250 | newRect.setBottom(origRect.bottom()); 251 | } 252 | 253 | if (d->m_bRubberBandOnResize) 254 | { 255 | m_pRubberBand->setGeometry(newRect); 256 | } 257 | else 258 | { 259 | m_pWidget->setGeometry(newRect); 260 | } 261 | } 262 | } 263 | 264 | void WidgetData::moveWidget(const QPoint& gMousePos) 265 | { 266 | if (d->m_bRubberBandOnMove) 267 | { 268 | m_pRubberBand->move(gMousePos - m_ptDragPos); 269 | } 270 | else 271 | { 272 | m_pWidget->move(gMousePos - m_ptDragPos); 273 | } 274 | } 275 | 276 | void WidgetData::handleMousePressEvent(QMouseEvent *event) 277 | { 278 | if (event->button() == Qt::LeftButton) 279 | { 280 | m_bLeftButtonPressed = true; 281 | m_bLeftButtonTitlePressed = event->pos().y() < m_moveMousePos.m_nTitleHeight; 282 | 283 | QRect frameRect = m_pWidget->frameGeometry(); 284 | m_pressedMousePos.recalculate(event->globalPos(), frameRect); 285 | 286 | m_ptDragPos = event->globalPos() - frameRect.topLeft(); 287 | 288 | if (m_pressedMousePos.m_bOnEdges) 289 | { 290 | if (d->m_bRubberBandOnResize) 291 | { 292 | m_pRubberBand->setGeometry(frameRect); 293 | m_pRubberBand->show(); 294 | } 295 | } 296 | else if (d->m_bRubberBandOnMove) 297 | { 298 | m_pRubberBand->setGeometry(frameRect); 299 | m_pRubberBand->show(); 300 | } 301 | } 302 | } 303 | 304 | void WidgetData::handleMouseReleaseEvent(QMouseEvent *event) 305 | { 306 | if (event->button() == Qt::LeftButton) 307 | { 308 | m_bLeftButtonPressed = false; 309 | m_bLeftButtonTitlePressed = false; 310 | m_pressedMousePos.reset(); 311 | if (m_pRubberBand && m_pRubberBand->isVisible()) 312 | { 313 | m_pRubberBand->hide(); 314 | m_pWidget->setGeometry(m_pRubberBand->geometry()); 315 | } 316 | } 317 | } 318 | 319 | void WidgetData::handleMouseMoveEvent(QMouseEvent *event) 320 | { 321 | if (m_bLeftButtonPressed) 322 | { 323 | 324 | if (d->m_bWidgetResizable && m_pressedMousePos.m_bOnEdges) 325 | { 326 | resizeWidget(event->globalPos()); 327 | }else if (d->m_bWidgetMovable && m_bLeftButtonPressed) 328 | { 329 | moveWidget(event->globalPos()); 330 | } 331 | } 332 | else if (d->m_bWidgetResizable) 333 | { 334 | updateCursorShape(event->globalPos()); 335 | } 336 | } 337 | 338 | void WidgetData::handleLeaveEvent(QEvent *event) 339 | { 340 | Q_UNUSED(event) 341 | if (!m_bLeftButtonPressed) 342 | { 343 | m_pWidget->unsetCursor(); 344 | } 345 | } 346 | 347 | void WidgetData::handleHoverMoveEvent(QHoverEvent *event) 348 | { 349 | if (d->m_bWidgetResizable) 350 | { 351 | updateCursorShape(m_pWidget->mapToGlobal(event->pos())); 352 | } 353 | } 354 | 355 | class WidgetData; 356 | 357 | /*****FramelessHelper*****/ 358 | FramelessHelper::FramelessHelper(QObject *parent) 359 | : QObject(parent), 360 | d(new FramelessHelperPrivate()) 361 | { 362 | d->m_bWidgetMovable = true; 363 | d->m_bWidgetResizable = true; 364 | d->m_bRubberBandOnResize = false; 365 | d->m_bRubberBandOnMove = false; 366 | } 367 | 368 | FramelessHelper::~FramelessHelper() 369 | { 370 | QList keys = d->m_widgetDataHash.keys(); 371 | int size = keys.size(); 372 | for (int i = 0; i < size; ++i) 373 | { 374 | delete d->m_widgetDataHash.take(keys[i]); 375 | } 376 | 377 | delete d; 378 | } 379 | 380 | bool FramelessHelper::eventFilter(QObject *obj, QEvent *event) 381 | { 382 | switch (event->type()) 383 | { 384 | case QEvent::MouseMove: 385 | case QEvent::HoverMove: 386 | case QEvent::MouseButtonPress: 387 | case QEvent::MouseButtonRelease: 388 | case QEvent::Leave: 389 | { 390 | WidgetData *data = d->m_widgetDataHash.value(static_cast(obj)); 391 | if (data) 392 | { 393 | data->handleWidgetEvent(event); 394 | return true; 395 | } 396 | } 397 | } 398 | return QObject::eventFilter(obj, event); 399 | } 400 | 401 | void FramelessHelper::activateOn(QWidget *topLevelWidget) 402 | { 403 | if (!d->m_widgetDataHash.contains(topLevelWidget)) 404 | { 405 | WidgetData *data = new WidgetData(d, topLevelWidget); 406 | d->m_widgetDataHash.insert(topLevelWidget, data); 407 | 408 | topLevelWidget->installEventFilter(this); 409 | } 410 | } 411 | 412 | void FramelessHelper::removeFrom(QWidget *topLevelWidget) 413 | { 414 | WidgetData *data = d->m_widgetDataHash.take(topLevelWidget); 415 | if (data) 416 | { 417 | topLevelWidget->removeEventFilter(this); 418 | delete data; 419 | } 420 | } 421 | 422 | void FramelessHelper::setRubberBandOnMove(bool movable) 423 | { 424 | d->m_bRubberBandOnMove = movable; 425 | QList list = d->m_widgetDataHash.values(); 426 | foreach (WidgetData *data, list) 427 | { 428 | data->updateRubberBandStatus(); 429 | } 430 | } 431 | 432 | void FramelessHelper::setWidgetMovable(bool movable) 433 | { 434 | d->m_bWidgetMovable = movable; 435 | } 436 | 437 | void FramelessHelper::setWidgetResizable(bool resizable) 438 | { 439 | d->m_bWidgetResizable = resizable; 440 | } 441 | 442 | void FramelessHelper::setRubberBandOnResize(bool resizable) 443 | { 444 | d->m_bRubberBandOnResize = resizable; 445 | QList list = d->m_widgetDataHash.values(); 446 | foreach (WidgetData *data, list) 447 | { 448 | data->updateRubberBandStatus(); 449 | } 450 | } 451 | 452 | void FramelessHelper::setBorderWidth(uint width) 453 | { 454 | if (width > 0) 455 | { 456 | CursorPosCalculator::m_nBorderWidth = width; 457 | } 458 | } 459 | 460 | void FramelessHelper::setTitleHeight(uint height) 461 | { 462 | if (height > 0) 463 | { 464 | CursorPosCalculator::m_nTitleHeight = height; 465 | } 466 | } 467 | 468 | bool FramelessHelper::widgetMovable() 469 | { 470 | return d->m_bWidgetMovable; 471 | } 472 | 473 | bool FramelessHelper::widgetResizable() 474 | { 475 | return d->m_bWidgetResizable; 476 | } 477 | 478 | bool FramelessHelper::rubberBandOnMove() 479 | { 480 | return d->m_bRubberBandOnMove; 481 | } 482 | 483 | bool FramelessHelper::rubberBandOnResisze() 484 | { 485 | return d->m_bRubberBandOnResize; 486 | } 487 | 488 | uint FramelessHelper::borderWidth() 489 | { 490 | return CursorPosCalculator::m_nBorderWidth; 491 | } 492 | 493 | uint FramelessHelper::titleHeight() 494 | { 495 | return CursorPosCalculator::m_nTitleHeight; 496 | } 497 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # FrameLessWidget 2 | 3 | 软件开发工作学习交流QQ群 157978042 欢迎加入 4 | 我的QQ: 307060248 5 | 6 | ## features 7 | 8 | ## screenshot 9 | 10 | ![](https://github.com/sangxiaokai/FrameLessWidget/blob/master/screenshot/black.png) 11 | ![](https://github.com/sangxiaokai/FrameLessWidget/blob/master/screenshot/green.png) 12 | 13 | ## How to Use 14 | 15 | ```qt 16 | 17 | ... 18 | #include "frameless_helper/framelesswindow.h" 19 | 20 | int main(int argc, char *argv[]) 21 | { 22 | QApplication a(argc, argv); 23 | ... 24 | 25 | FramelessWindow framelessWindow; 26 | 27 | 28 | QWidget *w=new QWidget(); 29 | 30 | framelessWindow.setContent(w); 31 | framelessWindow.show(); 32 | 33 | return a.exec(); 34 | } 35 | 36 | 37 | ``` 38 | ## 捐赠(Donation) 39 | 40 | ![](https://github.com/sangxiaokai/app_licenser/blob/master/mypay.png) 41 | 42 | 43 | 44 | ## Licence 45 | 46 | ```txt 47 | GNU GENERAL PUBLIC LICENSE 48 | Version 3, 29 June 2007 49 | 50 | Copyright (C) 2007 Free Software Foundation, Inc. 51 | Everyone is permitted to copy and distribute verbatim copies 52 | of this license document, but changing it is not allowed. 53 | 54 | Preamble 55 | 56 | The GNU General Public License is a free, copyleft license for 57 | software and other kinds of works. 58 | 59 | The licenses for most software and other practical works are designed 60 | to take away your freedom to share and change the works. By contrast, 61 | the GNU General Public License is intended to guarantee your freedom to 62 | share and change all versions of a program--to make sure it remains free 63 | software for all its users. We, the Free Software Foundation, use the 64 | GNU General Public License for most of our software; it applies also to 65 | any other work released this way by its authors. You can apply it to 66 | your programs, too. 67 | 68 | When we speak of free software, we are referring to freedom, not 69 | price. Our General Public Licenses are designed to make sure that you 70 | have the freedom to distribute copies of free software (and charge for 71 | them if you wish), that you receive source code or can get it if you 72 | want it, that you can change the software or use pieces of it in new 73 | free programs, and that you know you can do these things. 74 | 75 | To protect your rights, we need to prevent others from denying you 76 | these rights or asking you to surrender the rights. Therefore, you have 77 | certain responsibilities if you distribute copies of the software, or if 78 | you modify it: responsibilities to respect the freedom of others. 79 | 80 | For example, if you distribute copies of such a program, whether 81 | gratis or for a fee, you must pass on to the recipients the same 82 | freedoms that you received. You must make sure that they, too, receive 83 | or can get the source code. And you must show them these terms so they 84 | know their rights. 85 | 86 | Developers that use the GNU GPL protect your rights with two steps: 87 | (1) assert copyright on the software, and (2) offer you this License 88 | giving you legal permission to copy, distribute and/or modify it. 89 | 90 | For the developers' and authors' protection, the GPL clearly explains 91 | that there is no warranty for this free software. For both users' and 92 | authors' sake, the GPL requires that modified versions be marked as 93 | changed, so that their problems will not be attributed erroneously to 94 | authors of previous versions. 95 | 96 | Some devices are designed to deny users access to install or run 97 | modified versions of the software inside them, although the manufacturer 98 | can do so. This is fundamentally incompatible with the aim of 99 | protecting users' freedom to change the software. The systematic 100 | pattern of such abuse occurs in the area of products for individuals to 101 | use, which is precisely where it is most unacceptable. Therefore, we 102 | have designed this version of the GPL to prohibit the practice for those 103 | products. If such problems arise substantially in other domains, we 104 | stand ready to extend this provision to those domains in future versions 105 | of the GPL, as needed to protect the freedom of users. 106 | 107 | Finally, every program is threatened constantly by software patents. 108 | States should not allow patents to restrict development and use of 109 | software on general-purpose computers, but in those that do, we wish to 110 | avoid the special danger that patents applied to a free program could 111 | make it effectively proprietary. To prevent this, the GPL assures that 112 | patents cannot be used to render the program non-free. 113 | 114 | The precise terms and conditions for copying, distribution and 115 | modification follow. 116 | 117 | TERMS AND CONDITIONS 118 | 119 | 0. Definitions. 120 | 121 | "This License" refers to version 3 of the GNU General Public License. 122 | 123 | "Copyright" also means copyright-like laws that apply to other kinds of 124 | works, such as semiconductor masks. 125 | 126 | "The Program" refers to any copyrightable work licensed under this 127 | License. Each licensee is addressed as "you". "Licensees" and 128 | "recipients" may be individuals or organizations. 129 | 130 | To "modify" a work means to copy from or adapt all or part of the work 131 | in a fashion requiring copyright permission, other than the making of an 132 | exact copy. The resulting work is called a "modified version" of the 133 | earlier work or a work "based on" the earlier work. 134 | 135 | A "covered work" means either the unmodified Program or a work based 136 | on the Program. 137 | 138 | To "propagate" a work means to do anything with it that, without 139 | permission, would make you directly or secondarily liable for 140 | infringement under applicable copyright law, except executing it on a 141 | computer or modifying a private copy. Propagation includes copying, 142 | distribution (with or without modification), making available to the 143 | public, and in some countries other activities as well. 144 | 145 | To "convey" a work means any kind of propagation that enables other 146 | parties to make or receive copies. Mere interaction with a user through 147 | a computer network, with no transfer of a copy, is not conveying. 148 | 149 | An interactive user interface displays "Appropriate Legal Notices" 150 | to the extent that it includes a convenient and prominently visible 151 | feature that (1) displays an appropriate copyright notice, and (2) 152 | tells the user that there is no warranty for the work (except to the 153 | extent that warranties are provided), that licensees may convey the 154 | work under this License, and how to view a copy of this License. If 155 | the interface presents a list of user commands or options, such as a 156 | menu, a prominent item in the list meets this criterion. 157 | 158 | 1. Source Code. 159 | 160 | The "source code" for a work means the preferred form of the work 161 | for making modifications to it. "Object code" means any non-source 162 | form of a work. 163 | 164 | A "Standard Interface" means an interface that either is an official 165 | standard defined by a recognized standards body, or, in the case of 166 | interfaces specified for a particular programming language, one that 167 | is widely used among developers working in that language. 168 | 169 | The "System Libraries" of an executable work include anything, other 170 | than the work as a whole, that (a) is included in the normal form of 171 | packaging a Major Component, but which is not part of that Major 172 | Component, and (b) serves only to enable use of the work with that 173 | Major Component, or to implement a Standard Interface for which an 174 | implementation is available to the public in source code form. A 175 | "Major Component", in this context, means a major essential component 176 | (kernel, window system, and so on) of the specific operating system 177 | (if any) on which the executable work runs, or a compiler used to 178 | produce the work, or an object code interpreter used to run it. 179 | 180 | The "Corresponding Source" for a work in object code form means all 181 | the source code needed to generate, install, and (for an executable 182 | work) run the object code and to modify the work, including scripts to 183 | control those activities. However, it does not include the work's 184 | System Libraries, or general-purpose tools or generally available free 185 | programs which are used unmodified in performing those activities but 186 | which are not part of the work. For example, Corresponding Source 187 | includes interface definition files associated with source files for 188 | the work, and the source code for shared libraries and dynamically 189 | linked subprograms that the work is specifically designed to require, 190 | such as by intimate data communication or control flow between those 191 | subprograms and other parts of the work. 192 | 193 | The Corresponding Source need not include anything that users 194 | can regenerate automatically from other parts of the Corresponding 195 | Source. 196 | 197 | The Corresponding Source for a work in source code form is that 198 | same work. 199 | 200 | 2. Basic Permissions. 201 | 202 | All rights granted under this License are granted for the term of 203 | copyright on the Program, and are irrevocable provided the stated 204 | conditions are met. This License explicitly affirms your unlimited 205 | permission to run the unmodified Program. The output from running a 206 | covered work is covered by this License only if the output, given its 207 | content, constitutes a covered work. This License acknowledges your 208 | rights of fair use or other equivalent, as provided by copyright law. 209 | 210 | You may make, run and propagate covered works that you do not 211 | convey, without conditions so long as your license otherwise remains 212 | in force. You may convey covered works to others for the sole purpose 213 | of having them make modifications exclusively for you, or provide you 214 | with facilities for running those works, provided that you comply with 215 | the terms of this License in conveying all material for which you do 216 | not control copyright. Those thus making or running the covered works 217 | for you must do so exclusively on your behalf, under your direction 218 | and control, on terms that prohibit them from making any copies of 219 | your copyrighted material outside their relationship with you. 220 | 221 | Conveying under any other circumstances is permitted solely under 222 | the conditions stated below. Sublicensing is not allowed; section 10 223 | makes it unnecessary. 224 | 225 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 226 | 227 | No covered work shall be deemed part of an effective technological 228 | measure under any applicable law fulfilling obligations under article 229 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 230 | similar laws prohibiting or restricting circumvention of such 231 | measures. 232 | 233 | When you convey a covered work, you waive any legal power to forbid 234 | circumvention of technological measures to the extent such circumvention 235 | is effected by exercising rights under this License with respect to 236 | the covered work, and you disclaim any intention to limit operation or 237 | modification of the work as a means of enforcing, against the work's 238 | users, your or third parties' legal rights to forbid circumvention of 239 | technological measures. 240 | 241 | 4. Conveying Verbatim Copies. 242 | 243 | You may convey verbatim copies of the Program's source code as you 244 | receive it, in any medium, provided that you conspicuously and 245 | appropriately publish on each copy an appropriate copyright notice; 246 | keep intact all notices stating that this License and any 247 | non-permissive terms added in accord with section 7 apply to the code; 248 | keep intact all notices of the absence of any warranty; and give all 249 | recipients a copy of this License along with the Program. 250 | 251 | You may charge any price or no price for each copy that you convey, 252 | and you may offer support or warranty protection for a fee. 253 | 254 | 5. Conveying Modified Source Versions. 255 | 256 | You may convey a work based on the Program, or the modifications to 257 | produce it from the Program, in the form of source code under the 258 | terms of section 4, provided that you also meet all of these conditions: 259 | 260 | a) The work must carry prominent notices stating that you modified 261 | it, and giving a relevant date. 262 | 263 | b) The work must carry prominent notices stating that it is 264 | released under this License and any conditions added under section 265 | 7. This requirement modifies the requirement in section 4 to 266 | "keep intact all notices". 267 | 268 | c) You must license the entire work, as a whole, under this 269 | License to anyone who comes into possession of a copy. This 270 | License will therefore apply, along with any applicable section 7 271 | additional terms, to the whole of the work, and all its parts, 272 | regardless of how they are packaged. This License gives no 273 | permission to license the work in any other way, but it does not 274 | invalidate such permission if you have separately received it. 275 | 276 | d) If the work has interactive user interfaces, each must display 277 | Appropriate Legal Notices; however, if the Program has interactive 278 | interfaces that do not display Appropriate Legal Notices, your 279 | work need not make them do so. 280 | 281 | A compilation of a covered work with other separate and independent 282 | works, which are not by their nature extensions of the covered work, 283 | and which are not combined with it such as to form a larger program, 284 | in or on a volume of a storage or distribution medium, is called an 285 | "aggregate" if the compilation and its resulting copyright are not 286 | used to limit the access or legal rights of the compilation's users 287 | beyond what the individual works permit. Inclusion of a covered work 288 | in an aggregate does not cause this License to apply to the other 289 | parts of the aggregate. 290 | 291 | 6. Conveying Non-Source Forms. 292 | 293 | You may convey a covered work in object code form under the terms 294 | of sections 4 and 5, provided that you also convey the 295 | machine-readable Corresponding Source under the terms of this License, 296 | in one of these ways: 297 | 298 | a) Convey the object code in, or embodied in, a physical product 299 | (including a physical distribution medium), accompanied by the 300 | Corresponding Source fixed on a durable physical medium 301 | customarily used for software interchange. 302 | 303 | b) Convey the object code in, or embodied in, a physical product 304 | (including a physical distribution medium), accompanied by a 305 | written offer, valid for at least three years and valid for as 306 | long as you offer spare parts or customer support for that product 307 | model, to give anyone who possesses the object code either (1) a 308 | copy of the Corresponding Source for all the software in the 309 | product that is covered by this License, on a durable physical 310 | medium customarily used for software interchange, for a price no 311 | more than your reasonable cost of physically performing this 312 | conveying of source, or (2) access to copy the 313 | Corresponding Source from a network server at no charge. 314 | 315 | c) Convey individual copies of the object code with a copy of the 316 | written offer to provide the Corresponding Source. This 317 | alternative is allowed only occasionally and noncommercially, and 318 | only if you received the object code with such an offer, in accord 319 | with subsection 6b. 320 | 321 | d) Convey the object code by offering access from a designated 322 | place (gratis or for a charge), and offer equivalent access to the 323 | Corresponding Source in the same way through the same place at no 324 | further charge. You need not require recipients to copy the 325 | Corresponding Source along with the object code. If the place to 326 | copy the object code is a network server, the Corresponding Source 327 | may be on a different server (operated by you or a third party) 328 | that supports equivalent copying facilities, provided you maintain 329 | clear directions next to the object code saying where to find the 330 | Corresponding Source. Regardless of what server hosts the 331 | Corresponding Source, you remain obligated to ensure that it is 332 | available for as long as needed to satisfy these requirements. 333 | 334 | e) Convey the object code using peer-to-peer transmission, provided 335 | you inform other peers where the object code and Corresponding 336 | Source of the work are being offered to the general public at no 337 | charge under subsection 6d. 338 | 339 | A separable portion of the object code, whose source code is excluded 340 | from the Corresponding Source as a System Library, need not be 341 | included in conveying the object code work. 342 | 343 | A "User Product" is either (1) a "consumer product", which means any 344 | tangible personal property which is normally used for personal, family, 345 | or household purposes, or (2) anything designed or sold for incorporation 346 | into a dwelling. In determining whether a product is a consumer product, 347 | doubtful cases shall be resolved in favor of coverage. For a particular 348 | product received by a particular user, "normally used" refers to a 349 | typical or common use of that class of product, regardless of the status 350 | of the particular user or of the way in which the particular user 351 | actually uses, or expects or is expected to use, the product. A product 352 | is a consumer product regardless of whether the product has substantial 353 | commercial, industrial or non-consumer uses, unless such uses represent 354 | the only significant mode of use of the product. 355 | 356 | "Installation Information" for a User Product means any methods, 357 | procedures, authorization keys, or other information required to install 358 | and execute modified versions of a covered work in that User Product from 359 | a modified version of its Corresponding Source. The information must 360 | suffice to ensure that the continued functioning of the modified object 361 | code is in no case prevented or interfered with solely because 362 | modification has been made. 363 | 364 | If you convey an object code work under this section in, or with, or 365 | specifically for use in, a User Product, and the conveying occurs as 366 | part of a transaction in which the right of possession and use of the 367 | User Product is transferred to the recipient in perpetuity or for a 368 | fixed term (regardless of how the transaction is characterized), the 369 | Corresponding Source conveyed under this section must be accompanied 370 | by the Installation Information. But this requirement does not apply 371 | if neither you nor any third party retains the ability to install 372 | modified object code on the User Product (for example, the work has 373 | been installed in ROM). 374 | 375 | The requirement to provide Installation Information does not include a 376 | requirement to continue to provide support service, warranty, or updates 377 | for a work that has been modified or installed by the recipient, or for 378 | the User Product in which it has been modified or installed. Access to a 379 | network may be denied when the modification itself materially and 380 | adversely affects the operation of the network or violates the rules and 381 | protocols for communication across the network. 382 | 383 | Corresponding Source conveyed, and Installation Information provided, 384 | in accord with this section must be in a format that is publicly 385 | documented (and with an implementation available to the public in 386 | source code form), and must require no special password or key for 387 | unpacking, reading or copying. 388 | 389 | 7. Additional Terms. 390 | 391 | "Additional permissions" are terms that supplement the terms of this 392 | License by making exceptions from one or more of its conditions. 393 | Additional permissions that are applicable to the entire Program shall 394 | be treated as though they were included in this License, to the extent 395 | that they are valid under applicable law. If additional permissions 396 | apply only to part of the Program, that part may be used separately 397 | under those permissions, but the entire Program remains governed by 398 | this License without regard to the additional permissions. 399 | 400 | When you convey a copy of a covered work, you may at your option 401 | remove any additional permissions from that copy, or from any part of 402 | it. (Additional permissions may be written to require their own 403 | removal in certain cases when you modify the work.) You may place 404 | additional permissions on material, added by you to a covered work, 405 | for which you have or can give appropriate copyright permission. 406 | 407 | Notwithstanding any other provision of this License, for material you 408 | add to a covered work, you may (if authorized by the copyright holders of 409 | that material) supplement the terms of this License with terms: 410 | 411 | a) Disclaiming warranty or limiting liability differently from the 412 | terms of sections 15 and 16 of this License; or 413 | 414 | b) Requiring preservation of specified reasonable legal notices or 415 | author attributions in that material or in the Appropriate Legal 416 | Notices displayed by works containing it; or 417 | 418 | c) Prohibiting misrepresentation of the origin of that material, or 419 | requiring that modified versions of such material be marked in 420 | reasonable ways as different from the original version; or 421 | 422 | d) Limiting the use for publicity purposes of names of licensors or 423 | authors of the material; or 424 | 425 | e) Declining to grant rights under trademark law for use of some 426 | trade names, trademarks, or service marks; or 427 | 428 | f) Requiring indemnification of licensors and authors of that 429 | material by anyone who conveys the material (or modified versions of 430 | it) with contractual assumptions of liability to the recipient, for 431 | any liability that these contractual assumptions directly impose on 432 | those licensors and authors. 433 | 434 | All other non-permissive additional terms are considered "further 435 | restrictions" within the meaning of section 10. If the Program as you 436 | received it, or any part of it, contains a notice stating that it is 437 | governed by this License along with a term that is a further 438 | restriction, you may remove that term. If a license document contains 439 | a further restriction but permits relicensing or conveying under this 440 | License, you may add to a covered work material governed by the terms 441 | of that license document, provided that the further restriction does 442 | not survive such relicensing or conveying. 443 | 444 | If you add terms to a covered work in accord with this section, you 445 | must place, in the relevant source files, a statement of the 446 | additional terms that apply to those files, or a notice indicating 447 | where to find the applicable terms. 448 | 449 | Additional terms, permissive or non-permissive, may be stated in the 450 | form of a separately written license, or stated as exceptions; 451 | the above requirements apply either way. 452 | 453 | 8. Termination. 454 | 455 | You may not propagate or modify a covered work except as expressly 456 | provided under this License. Any attempt otherwise to propagate or 457 | modify it is void, and will automatically terminate your rights under 458 | this License (including any patent licenses granted under the third 459 | paragraph of section 11). 460 | 461 | However, if you cease all violation of this License, then your 462 | license from a particular copyright holder is reinstated (a) 463 | provisionally, unless and until the copyright holder explicitly and 464 | finally terminates your license, and (b) permanently, if the copyright 465 | holder fails to notify you of the violation by some reasonable means 466 | prior to 60 days after the cessation. 467 | 468 | Moreover, your license from a particular copyright holder is 469 | reinstated permanently if the copyright holder notifies you of the 470 | violation by some reasonable means, this is the first time you have 471 | received notice of violation of this License (for any work) from that 472 | copyright holder, and you cure the violation prior to 30 days after 473 | your receipt of the notice. 474 | 475 | Termination of your rights under this section does not terminate the 476 | licenses of parties who have received copies or rights from you under 477 | this License. If your rights have been terminated and not permanently 478 | reinstated, you do not qualify to receive new licenses for the same 479 | material under section 10. 480 | 481 | 9. Acceptance Not Required for Having Copies. 482 | 483 | You are not required to accept this License in order to receive or 484 | run a copy of the Program. Ancillary propagation of a covered work 485 | occurring solely as a consequence of using peer-to-peer transmission 486 | to receive a copy likewise does not require acceptance. However, 487 | nothing other than this License grants you permission to propagate or 488 | modify any covered work. These actions infringe copyright if you do 489 | not accept this License. Therefore, by modifying or propagating a 490 | covered work, you indicate your acceptance of this License to do so. 491 | 492 | 10. Automatic Licensing of Downstream Recipients. 493 | 494 | Each time you convey a covered work, the recipient automatically 495 | receives a license from the original licensors, to run, modify and 496 | propagate that work, subject to this License. You are not responsible 497 | for enforcing compliance by third parties with this License. 498 | 499 | An "entity transaction" is a transaction transferring control of an 500 | organization, or substantially all assets of one, or subdividing an 501 | organization, or merging organizations. If propagation of a covered 502 | work results from an entity transaction, each party to that 503 | transaction who receives a copy of the work also receives whatever 504 | licenses to the work the party's predecessor in interest had or could 505 | give under the previous paragraph, plus a right to possession of the 506 | Corresponding Source of the work from the predecessor in interest, if 507 | the predecessor has it or can get it with reasonable efforts. 508 | 509 | You may not impose any further restrictions on the exercise of the 510 | rights granted or affirmed under this License. For example, you may 511 | not impose a license fee, royalty, or other charge for exercise of 512 | rights granted under this License, and you may not initiate litigation 513 | (including a cross-claim or counterclaim in a lawsuit) alleging that 514 | any patent claim is infringed by making, using, selling, offering for 515 | sale, or importing the Program or any portion of it. 516 | 517 | 11. Patents. 518 | 519 | A "contributor" is a copyright holder who authorizes use under this 520 | License of the Program or a work on which the Program is based. The 521 | work thus licensed is called the contributor's "contributor version". 522 | 523 | A contributor's "essential patent claims" are all patent claims 524 | owned or controlled by the contributor, whether already acquired or 525 | hereafter acquired, that would be infringed by some manner, permitted 526 | by this License, of making, using, or selling its contributor version, 527 | but do not include claims that would be infringed only as a 528 | consequence of further modification of the contributor version. For 529 | purposes of this definition, "control" includes the right to grant 530 | patent sublicenses in a manner consistent with the requirements of 531 | this License. 532 | 533 | Each contributor grants you a non-exclusive, worldwide, royalty-free 534 | patent license under the contributor's essential patent claims, to 535 | make, use, sell, offer for sale, import and otherwise run, modify and 536 | propagate the contents of its contributor version. 537 | 538 | In the following three paragraphs, a "patent license" is any express 539 | agreement or commitment, however denominated, not to enforce a patent 540 | (such as an express permission to practice a patent or covenant not to 541 | sue for patent infringement). To "grant" such a patent license to a 542 | party means to make such an agreement or commitment not to enforce a 543 | patent against the party. 544 | 545 | If you convey a covered work, knowingly relying on a patent license, 546 | and the Corresponding Source of the work is not available for anyone 547 | to copy, free of charge and under the terms of this License, through a 548 | publicly available network server or other readily accessible means, 549 | then you must either (1) cause the Corresponding Source to be so 550 | available, or (2) arrange to deprive yourself of the benefit of the 551 | patent license for this particular work, or (3) arrange, in a manner 552 | consistent with the requirements of this License, to extend the patent 553 | license to downstream recipients. "Knowingly relying" means you have 554 | actual knowledge that, but for the patent license, your conveying the 555 | covered work in a country, or your recipient's use of the covered work 556 | in a country, would infringe one or more identifiable patents in that 557 | country that you have reason to believe are valid. 558 | 559 | If, pursuant to or in connection with a single transaction or 560 | arrangement, you convey, or propagate by procuring conveyance of, a 561 | covered work, and grant a patent license to some of the parties 562 | receiving the covered work authorizing them to use, propagate, modify 563 | or convey a specific copy of the covered work, then the patent license 564 | you grant is automatically extended to all recipients of the covered 565 | work and works based on it. 566 | 567 | A patent license is "discriminatory" if it does not include within 568 | the scope of its coverage, prohibits the exercise of, or is 569 | conditioned on the non-exercise of one or more of the rights that are 570 | specifically granted under this License. You may not convey a covered 571 | work if you are a party to an arrangement with a third party that is 572 | in the business of distributing software, under which you make payment 573 | to the third party based on the extent of your activity of conveying 574 | the work, and under which the third party grants, to any of the 575 | parties who would receive the covered work from you, a discriminatory 576 | patent license (a) in connection with copies of the covered work 577 | conveyed by you (or copies made from those copies), or (b) primarily 578 | for and in connection with specific products or compilations that 579 | contain the covered work, unless you entered into that arrangement, 580 | or that patent license was granted, prior to 28 March 2007. 581 | 582 | Nothing in this License shall be construed as excluding or limiting 583 | any implied license or other defenses to infringement that may 584 | otherwise be available to you under applicable patent law. 585 | 586 | 12. No Surrender of Others' Freedom. 587 | 588 | If conditions are imposed on you (whether by court order, agreement or 589 | otherwise) that contradict the conditions of this License, they do not 590 | excuse you from the conditions of this License. If you cannot convey a 591 | covered work so as to satisfy simultaneously your obligations under this 592 | License and any other pertinent obligations, then as a consequence you may 593 | not convey it at all. For example, if you agree to terms that obligate you 594 | to collect a royalty for further conveying from those to whom you convey 595 | the Program, the only way you could satisfy both those terms and this 596 | License would be to refrain entirely from conveying the Program. 597 | 598 | 13. Use with the GNU Affero General Public License. 599 | 600 | Notwithstanding any other provision of this License, you have 601 | permission to link or combine any covered work with a work licensed 602 | under version 3 of the GNU Affero General Public License into a single 603 | combined work, and to convey the resulting work. The terms of this 604 | License will continue to apply to the part which is the covered work, 605 | but the special requirements of the GNU Affero General Public License, 606 | section 13, concerning interaction through a network will apply to the 607 | combination as such. 608 | 609 | 14. Revised Versions of this License. 610 | 611 | The Free Software Foundation may publish revised and/or new versions of 612 | the GNU General Public License from time to time. Such new versions will 613 | be similar in spirit to the present version, but may differ in detail to 614 | address new problems or concerns. 615 | 616 | Each version is given a distinguishing version number. If the 617 | Program specifies that a certain numbered version of the GNU General 618 | Public License "or any later version" applies to it, you have the 619 | option of following the terms and conditions either of that numbered 620 | version or of any later version published by the Free Software 621 | Foundation. If the Program does not specify a version number of the 622 | GNU General Public License, you may choose any version ever published 623 | by the Free Software Foundation. 624 | 625 | If the Program specifies that a proxy can decide which future 626 | versions of the GNU General Public License can be used, that proxy's 627 | public statement of acceptance of a version permanently authorizes you 628 | to choose that version for the Program. 629 | 630 | Later license versions may give you additional or different 631 | permissions. However, no additional obligations are imposed on any 632 | author or copyright holder as a result of your choosing to follow a 633 | later version. 634 | 635 | 15. Disclaimer of Warranty. 636 | 637 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 638 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 639 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 640 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 641 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 642 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 643 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 644 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 645 | 646 | 16. Limitation of Liability. 647 | 648 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 649 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 650 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 651 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 652 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 653 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 654 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 655 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 656 | SUCH DAMAGES. 657 | 658 | 17. Interpretation of Sections 15 and 16. 659 | 660 | If the disclaimer of warranty and limitation of liability provided 661 | above cannot be given local legal effect according to their terms, 662 | reviewing courts shall apply local law that most closely approximates 663 | an absolute waiver of all civil liability in connection with the 664 | Program, unless a warranty or assumption of liability accompanies a 665 | copy of the Program in return for a fee. 666 | 667 | END OF TERMS AND CONDITIONS 668 | 669 | How to Apply These Terms to Your New Programs 670 | 671 | If you develop a new program, and you want it to be of the greatest 672 | possible use to the public, the best way to achieve this is to make it 673 | free software which everyone can redistribute and change under these terms. 674 | 675 | To do so, attach the following notices to the program. It is safest 676 | to attach them to the start of each source file to most effectively 677 | state the exclusion of warranty; and each file should have at least 678 | the "copyright" line and a pointer to where the full notice is found. 679 | 680 | 681 | Copyright (C) 682 | 683 | This program is free software: you can redistribute it and/or modify 684 | it under the terms of the GNU General Public License as published by 685 | the Free Software Foundation, either version 3 of the License, or 686 | (at your option) any later version. 687 | 688 | This program is distributed in the hope that it will be useful, 689 | but WITHOUT ANY WARRANTY; without even the implied warranty of 690 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 691 | GNU General Public License for more details. 692 | 693 | You should have received a copy of the GNU General Public License 694 | along with this program. If not, see . 695 | 696 | Also add information on how to contact you by electronic and paper mail. 697 | 698 | If the program does terminal interaction, make it output a short 699 | notice like this when it starts in an interactive mode: 700 | 701 | Copyright (C) 702 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 703 | This is free software, and you are welcome to redistribute it 704 | under certain conditions; type `show c' for details. 705 | 706 | The hypothetical commands `show w' and `show c' should show the appropriate 707 | parts of the General Public License. Of course, your program's commands 708 | might be different; for a GUI interface, you would use an "about box". 709 | 710 | You should also get your employer (if you work as a programmer) or school, 711 | if any, to sign a "copyright disclaimer" for the program, if necessary. 712 | For more information on this, and how to apply and follow the GNU GPL, see 713 | . 714 | 715 | The GNU General Public License does not permit incorporating your program 716 | into proprietary programs. If your program is a subroutine library, you 717 | may consider it more useful to permit linking proprietary applications with 718 | the library. If this is what you want to do, use the GNU Lesser General 719 | Public License instead of this License. But first, please read 720 | . 721 | 722 | 723 | ``` -------------------------------------------------------------------------------- /FramlessWidget.pro.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | EnvironmentId 7 | {eda7cd6f-2aef-4031-b2c3-ee67f16d9857} 8 | 9 | 10 | ProjectExplorer.Project.ActiveTarget 11 | 0 12 | 13 | 14 | ProjectExplorer.Project.EditorSettings 15 | 16 | true 17 | false 18 | true 19 | 20 | Cpp 21 | 22 | CppGlobal 23 | 24 | 25 | 26 | QmlJS 27 | 28 | QmlJSGlobal 29 | 30 | 31 | 2 32 | UTF-8 33 | false 34 | 4 35 | false 36 | 80 37 | true 38 | true 39 | 1 40 | true 41 | false 42 | 0 43 | true 44 | true 45 | 0 46 | 8 47 | true 48 | 0 49 | true 50 | true 51 | true 52 | false 53 | 54 | 55 | 56 | ProjectExplorer.Project.PluginSettings 57 | 58 | 59 | 60 | ProjectExplorer.Project.Target.0 61 | 62 | Desktop Qt 5.6.2 MSVC2015 32bit 63 | Desktop Qt 5.6.2 MSVC2015 32bit 64 | qt.56.win32_msvc2015_kit 65 | 0 66 | 0 67 | 0 68 | 69 | F:/Qt/workspace/Test/build-testWidget-Desktop_Qt_5_6_2_MSVC2015_32bit-Debug 70 | 71 | 72 | true 73 | qmake 74 | 75 | QtProjectManager.QMakeBuildStep 76 | true 77 | 78 | false 79 | false 80 | false 81 | 82 | 83 | true 84 | Make 85 | 86 | Qt4ProjectManager.MakeStep 87 | 88 | false 89 | 90 | 91 | 92 | 2 93 | 构建 94 | 95 | ProjectExplorer.BuildSteps.Build 96 | 97 | 98 | 99 | true 100 | Make 101 | 102 | Qt4ProjectManager.MakeStep 103 | 104 | true 105 | clean 106 | 107 | 108 | 1 109 | 清理 110 | 111 | ProjectExplorer.BuildSteps.Clean 112 | 113 | 2 114 | false 115 | 116 | Debug 117 | 118 | Qt4ProjectManager.Qt4BuildConfiguration 119 | 2 120 | true 121 | 122 | 123 | F:/Qt/workspace/Test/build-testWidget-Desktop_Qt_5_6_2_MSVC2015_32bit-Release 124 | 125 | 126 | true 127 | qmake 128 | 129 | QtProjectManager.QMakeBuildStep 130 | false 131 | 132 | false 133 | false 134 | false 135 | 136 | 137 | true 138 | Make 139 | 140 | Qt4ProjectManager.MakeStep 141 | 142 | false 143 | 144 | 145 | 146 | 2 147 | 构建 148 | 149 | ProjectExplorer.BuildSteps.Build 150 | 151 | 152 | 153 | true 154 | Make 155 | 156 | Qt4ProjectManager.MakeStep 157 | 158 | true 159 | clean 160 | 161 | 162 | 1 163 | 清理 164 | 165 | ProjectExplorer.BuildSteps.Clean 166 | 167 | 2 168 | false 169 | 170 | Release 171 | 172 | Qt4ProjectManager.Qt4BuildConfiguration 173 | 0 174 | true 175 | 176 | 177 | F:/Qt/workspace/Test/build-testWidget-Desktop_Qt_5_6_2_MSVC2015_32bit-Profile 178 | 179 | 180 | true 181 | qmake 182 | 183 | QtProjectManager.QMakeBuildStep 184 | true 185 | 186 | false 187 | true 188 | false 189 | 190 | 191 | true 192 | Make 193 | 194 | Qt4ProjectManager.MakeStep 195 | 196 | false 197 | 198 | 199 | 200 | 2 201 | 构建 202 | 203 | ProjectExplorer.BuildSteps.Build 204 | 205 | 206 | 207 | true 208 | Make 209 | 210 | Qt4ProjectManager.MakeStep 211 | 212 | true 213 | clean 214 | 215 | 216 | 1 217 | 清理 218 | 219 | ProjectExplorer.BuildSteps.Clean 220 | 221 | 2 222 | false 223 | 224 | Profile 225 | 226 | Qt4ProjectManager.Qt4BuildConfiguration 227 | 0 228 | true 229 | 230 | 3 231 | 232 | 233 | 0 234 | 部署 235 | 236 | ProjectExplorer.BuildSteps.Deploy 237 | 238 | 1 239 | 在本地部署 240 | 241 | ProjectExplorer.DefaultDeployConfiguration 242 | 243 | 1 244 | 245 | 246 | false 247 | false 248 | 1000 249 | 250 | true 251 | 252 | false 253 | false 254 | false 255 | false 256 | true 257 | 0.01 258 | 10 259 | true 260 | 1 261 | 25 262 | 263 | 1 264 | true 265 | false 266 | true 267 | valgrind 268 | 269 | 0 270 | 1 271 | 2 272 | 3 273 | 4 274 | 5 275 | 6 276 | 7 277 | 8 278 | 9 279 | 10 280 | 11 281 | 12 282 | 13 283 | 14 284 | 285 | 2 286 | 287 | FramlessWidget 288 | FramlessWidget2 289 | Qt4ProjectManager.Qt4RunConfiguration:F:/Qt/workspace/qt_creator5/QSS/FrameLessWidget/FramlessWidget.pro 290 | true 291 | 292 | FramlessWidget.pro 293 | false 294 | 295 | F:/Qt/workspace/Test/build-testWidget-Desktop_Qt_5_6_2_MSVC2015_32bit-Debug 296 | 3768 297 | false 298 | true 299 | false 300 | false 301 | true 302 | 303 | 1 304 | 305 | 306 | 307 | ProjectExplorer.Project.Target.1 308 | 309 | Android for armeabi-v7a (GCC 4.9, Qt 5.6.2) 310 | Android for armeabi-v7a (GCC 4.9, Qt 5.6.2) 311 | {401b8076-2186-4b1b-9847-31bc6708d99d} 312 | 0 313 | 0 314 | -1 315 | 316 | F:/Qt/workspace/qt_creator5/QSS/build-FramlessWidget-Android_for_armeabi_v7a_GCC_4_9_Qt_5_6_2-Debug 317 | 318 | 319 | true 320 | qmake 321 | 322 | QtProjectManager.QMakeBuildStep 323 | true 324 | 325 | false 326 | false 327 | false 328 | 329 | 330 | true 331 | Make 332 | 333 | Qt4ProjectManager.MakeStep 334 | 335 | -w 336 | -r 337 | 338 | false 339 | 340 | 341 | 342 | 343 | true 344 | Copy application data 345 | 346 | Qt4ProjectManager.AndroidPackageInstallationStep 347 | 348 | 349 | android-17 350 | 351 | true 352 | Build Android APK 353 | 354 | QmakeProjectManager.AndroidBuildApkStep 355 | 2 356 | false 357 | false 358 | 359 | 4 360 | 构建 361 | 362 | ProjectExplorer.BuildSteps.Build 363 | 364 | 365 | 366 | true 367 | Make 368 | 369 | Qt4ProjectManager.MakeStep 370 | 371 | -w 372 | -r 373 | 374 | true 375 | clean 376 | 377 | 378 | 1 379 | 清理 380 | 381 | ProjectExplorer.BuildSteps.Clean 382 | 383 | 2 384 | false 385 | 386 | Debug 387 | 388 | Qt4ProjectManager.Qt4BuildConfiguration 389 | 2 390 | true 391 | 392 | 393 | F:/Qt/workspace/qt_creator5/QSS/build-FramlessWidget-Android_for_armeabi_v7a_GCC_4_9_Qt_5_6_2-Release 394 | 395 | 396 | true 397 | qmake 398 | 399 | QtProjectManager.QMakeBuildStep 400 | false 401 | 402 | false 403 | false 404 | false 405 | 406 | 407 | true 408 | Make 409 | 410 | Qt4ProjectManager.MakeStep 411 | 412 | -w 413 | -r 414 | 415 | false 416 | 417 | 418 | 419 | 420 | true 421 | Copy application data 422 | 423 | Qt4ProjectManager.AndroidPackageInstallationStep 424 | 425 | 426 | android-21 427 | 428 | true 429 | Build Android APK 430 | 431 | QmakeProjectManager.AndroidBuildApkStep 432 | 2 433 | false 434 | false 435 | 436 | 4 437 | 构建 438 | 439 | ProjectExplorer.BuildSteps.Build 440 | 441 | 442 | 443 | true 444 | Make 445 | 446 | Qt4ProjectManager.MakeStep 447 | 448 | -w 449 | -r 450 | 451 | true 452 | clean 453 | 454 | 455 | 1 456 | 清理 457 | 458 | ProjectExplorer.BuildSteps.Clean 459 | 460 | 2 461 | false 462 | 463 | Release 464 | 465 | Qt4ProjectManager.Qt4BuildConfiguration 466 | 0 467 | true 468 | 469 | 470 | F:/Qt/workspace/qt_creator5/QSS/build-FramlessWidget-Android_for_armeabi_v7a_GCC_4_9_Qt_5_6_2-Profile 471 | 472 | 473 | true 474 | qmake 475 | 476 | QtProjectManager.QMakeBuildStep 477 | true 478 | 479 | false 480 | true 481 | false 482 | 483 | 484 | true 485 | Make 486 | 487 | Qt4ProjectManager.MakeStep 488 | 489 | -w 490 | -r 491 | 492 | false 493 | 494 | 495 | 496 | 497 | true 498 | Copy application data 499 | 500 | Qt4ProjectManager.AndroidPackageInstallationStep 501 | 502 | 503 | android-21 504 | 505 | true 506 | Build Android APK 507 | 508 | QmakeProjectManager.AndroidBuildApkStep 509 | 2 510 | false 511 | false 512 | 513 | 4 514 | 构建 515 | 516 | ProjectExplorer.BuildSteps.Build 517 | 518 | 519 | 520 | true 521 | Make 522 | 523 | Qt4ProjectManager.MakeStep 524 | 525 | -w 526 | -r 527 | 528 | true 529 | clean 530 | 531 | 532 | 1 533 | 清理 534 | 535 | ProjectExplorer.BuildSteps.Clean 536 | 537 | 2 538 | false 539 | 540 | Profile 541 | 542 | Qt4ProjectManager.Qt4BuildConfiguration 543 | 0 544 | true 545 | 546 | 3 547 | 548 | 549 | 550 | true 551 | Deploy to Android device 552 | 553 | Qt4ProjectManager.AndroidDeployQtStep 554 | false 555 | 556 | 1 557 | 部署 558 | 559 | ProjectExplorer.BuildSteps.Deploy 560 | 561 | 1 562 | 部署到Android设备 563 | 部署到Android设备 564 | Qt4ProjectManager.AndroidDeployConfiguration2 565 | 566 | 1 567 | 568 | 0 569 | 570 | 571 | 572 | ProjectExplorer.Project.TargetCount 573 | 2 574 | 575 | 576 | ProjectExplorer.Project.Updater.FileVersion 577 | 18 578 | 579 | 580 | Version 581 | 18 582 | 583 | 584 | --------------------------------------------------------------------------------