项目介绍

Jorgen-VikingGod/Qt-Frameless-Window-DarkStyle 是一个托管在 GitHub 上的开源项目,主要使用 C++ 编写,目前获得 1.2k 个 Star、270 次 Fork。

仓库全名
Jorgen-VikingGod/Qt-Frameless-Window-DarkStyle
Star 数
1.2k
Fork 数
270
未关闭 Issue
26

README 摘要

Qt Frameless Window with DarkStyle simple MainWindow class implementation with frameless window and custom dark style. It adds also support for titlebar and buttons (minimize, maximize, close) Look is based on the VS2013 application window (flat and frameless window) Screenshots mac enabled mac disabled Qt and OS tested with Qt5.5.0, Qt5.9.0 and Qt5.10.0 tested on Windows 7, Windows 10,MacOSX 10.12.5 and MacOS…

完整内容见 GitHub 原始 README 或本页 。

常见问题

Qt-Frameless-Window-DarkStyle 用什么语言开发?

主要使用 C++ 编写,目前有 1.2k 个 Star。

如何获取 Qt-Frameless-Window-DarkStyle 的源码?

可以直接克隆仓库:git clone https://github.com/Jorgen-VikingGod/Qt-Frameless-Window-DarkStyle.git,默认分支为 master;安装与运行步骤见仓库 README。

Qt-Frameless-Window-DarkStyle 最近还在维护吗?

仓库最近一次更新为 2022年12月15日,当前有 26 个未关闭 Issue;Star 数为 1.2k,可作为社区活跃度的参考。

简要分析

热度分
1814
价值分
818
活跃状态
活跃

语言占比

C++
QMake

README

Qt Frameless Window with DarkStyle

simple MainWindow class implementation with frameless window and custom dark style.

It adds also support for titlebar and buttons (minimize, maximize, close)

Look is based on the VS2013 application window (flat and frameless window)

Screenshots
mac enabledmac disabled

Qt and OS

  • tested with Qt5.5.0, Qt5.9.0 and Qt5.10.0
  • tested on Windows 7, Windows 10,MacOSX 10.12.5 and MacOS 10.13.2

PyQt5

Here is an unofficial Python port of my implementation.

Alternative Window class

How to use

  • add additional include plath to framelesswindow
  • add resources framelesswindow.qrc and darkstyle.qrc
  • add #include "framelesswindow.h" into main.cpp, create window FramelessWindow framelessWindow; and assign your mainwindow object as content framelessWindow.setContent(mainWindow); and show it framelessWindow.show();
  • add #include "DarkStyle.h" into main.cpp and call a.setStyle(new DarkStyle);
#include <QApplication>
#include "DarkStyle.h"
#include "framelesswindow.h"
#include "mainwindow.h"

int main(int argc, char *argv[])
{
  QApplication a(argc, argv);

  // style our application with custom dark style
  QApplication::setStyle(new DarkStyle);
  //QApplication::setPalette(QApplication::style()->standardPalette());

  // create frameless window (and set windowState or title)
  FramelessWindow framelessWindow;
  //framelessWindow.setWindowState(Qt::WindowMaximized);
  //framelessWindow.setWindowTitle("test title");
  //framelessWindow.setWindowIcon(a.style()->standardIcon(QStyle::SP_DesktopIcon));
  
  // create our mainwindow instance
  MainWindow *mainWindow = new MainWindow;

  // add the mainwindow to our custom frameless window
  framelessWindow.setContent(mainWindow);
  framelessWindow.show();

  return a.exec();
}

features

  • frameless window
  • custom dark style (based on Fusion style with dark palette and custom stylesheets)
  • title bar
  • buttons (minimize | restore | maximize | close)
  • move window by drag the title bar
  • dobule click title bar to toggle between window styte (maximize and normal)
  • use of native events, like minimizing or system menu

todo

thanks

Many thanks goes to the Qt Forum and especially to Chris Kawa for pointing me to some usual issues and hints of great must have features.

Licence

The MIT License

Copyright © 2018, Juergen Skrotzky (https://github.com/Jorgen-VikingGod, [email protected])

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

评论

暂无评论