All Projects → Bringer-of-Light → Qt Nice Frameless Window

Bringer-of-Light / Qt Nice Frameless Window

Licence: other
Qt Frameless Window for both Windows and OS X, support Aero Snap, drop shadow on Windows, and support Native Style such as round corner, drop shadow on OS X. Based on QMainWindow.

Projects that are alternatives of or similar to Qt Nice Frameless Window

Arcgis Appstudio Samples
Collection of samples available in AppStudio for ArcGIS desktop to learn and help build your next app.
Stars: ✭ 78 (-81.86%)
Mutual labels:  cross-platform, qt, native
Project lemonlime
为了 OI 比赛而生的基于 Lemon + LemonPlus 的轻量评测系统 | 三大桌面系统支持
Stars: ✭ 255 (-40.7%)
Mutual labels:  cross-platform, qt
jsPanel3
A jQuery Plugin to create highly configurable floating panels, modals, tooltips, hints/notifiers or contextmenus for use in a backend solution and other web applications.
Stars: ✭ 89 (-79.3%)
Mutual labels:  draggable, resizable
Eiskaltdcpp
File sharing program using DC and ADC protocols
Stars: ✭ 277 (-35.58%)
Mutual labels:  cross-platform, qt
vue-smart-widget
🗃️Smart widget is a flexible and extensible content container component for Vue2.x / Vue3.x in Next branch.
Stars: ✭ 110 (-74.42%)
Mutual labels:  draggable, resizable
TNImageView-Android
Android Library for making scale-able and rotatable image views or giving this power to your own image view. This repo has been depreciated.
Stars: ✭ 18 (-95.81%)
Mutual labels:  draggable, resizable
Toou 2d
基于Qt Quick(Qml) 跨平台技术打造的2D框架
Stars: ✭ 413 (-3.95%)
Mutual labels:  cross-platform, qt
react-mops
🐶 Modify Orientation Position Size
Stars: ✭ 40 (-90.7%)
Mutual labels:  draggable, resizable
Symphytum
Symphytum Personal Database Software
Stars: ✭ 311 (-27.67%)
Mutual labels:  cross-platform, qt
Lan Share
Cross platform LAN File transfer application built with Qt C++ framework
Stars: ✭ 317 (-26.28%)
Mutual labels:  cross-platform, qt
Mbpmid2010 gpufix
MBPMid2010_GPUFix is an utility program that allows to fix MacBook Pro (15-inch, Mid 2010) intermittent black screen or loss of video. The algorithm is based on a solution provided by user fabioroberto on MacRumors forums.
Stars: ✭ 334 (-22.33%)
Mutual labels:  osx, qt
vue-drag-resize-rotate
一个Vue组件,支持拖拽,拉伸,旋转,放缩,自动对齐;A Vue component that supports dragging, stretching, rotating, scaling, and auto-alignment;
Stars: ✭ 42 (-90.23%)
Mutual labels:  draggable, resizable
react-web-editor
The react-web-editor is a WYSIWYG editor library. you can resize and drag your component. It also has simple rich text editor
Stars: ✭ 191 (-55.58%)
Mutual labels:  draggable, resizable
react-qml
Build native, high-performance, cross-platform applications through a React (and/or QML) syntax
Stars: ✭ 90 (-79.07%)
Mutual labels:  qt, native
vue-drr
A Vue2 component for draggable, resizable, rotatable elements
Stars: ✭ 34 (-92.09%)
Mutual labels:  draggable, resizable
Angular2 Draggable
Angular directive (for version >= 2.x ) that makes the DOM element draggable and resizable
Stars: ✭ 270 (-37.21%)
Mutual labels:  draggable, resizable
Psi
XMPP client
Stars: ✭ 337 (-21.63%)
Mutual labels:  cross-platform, qt
Mason
Cross platform package manager for C/C++ apps
Stars: ✭ 230 (-46.51%)
Mutual labels:  cross-platform, osx
Qhotkey
A global shortcut/hotkey for Desktop Qt-Applications
Stars: ✭ 234 (-45.58%)
Mutual labels:  cross-platform, qt
Orion
Cross platform Twitch.tv client
Stars: ✭ 298 (-30.7%)
Mutual labels:  cross-platform, osx

Qt-Nice-Frameless-Window

Qt Frameless Window for both Windows and OS X, support Aero Snap, drop shadow on Windows, and support Native Style such as round corner, drop shadow on OS X. Based on QMainWindow.

基于 QMainWindow 实现的效果很好的 Qt 无边框窗口,支持 Windows 和 OS X 系统。在 Windows 上,支持窗口阴影、Aero 效果等;在 OS X 上,支持原生窗口样式,比如窗口圆角、窗口阴影、三个系统按钮(关闭、最小化、最大化)等。

996.icu LICENSE

Screenshots

Windows OS X
screenshot on Windows screenshot on OS X

How to use

Just use class "CFramelessWindow" as the base class instead of QMainWindow, and Enjoy!

Method 1

If you want to create a new project, then method 1 should be used.

  1. Create a new Qt subproject project say myproject.pro, just like Qt-Nice-Frameless-Window.pro.

  2. Copy folder "framelesswindow" and "projectinclude" to myproject path, the project directory structure should be looked like this:
    -myproject/
      -myproject.pro
      -myproject.pro.user
      -framelesswindow/
      -projectinclude/

  3. Add "SUBDIRS += framelesswindow" in myproject.pro and run qmake.

  4. Add a sub project say myapp.pro to myproject.

1 2
  1. Add "myapp.depends = framelesswindow" in myproject.pro and run qmake.
  2. Add "include (../projectinclude/common.pri)" in myapp.pro and run qmake.
  3. Right click on myapp.pro, and click "add library", a dialog will pop up, choose "interal library" and click next step again and again.
1 2 3
  1. After step 7 is done, something will be added into the myapp.pro file automaticly, run qmake again.
  2. Use class "CFramelessWindow" as the base class instead of QMainWindow.

Method 2

If you already have a project say myproject.pro, then method 2 should be used.

  1. Copy file "framelesswindow.h" and "framelesswindow.cpp" and "framelesswindow.mm" to myproject path.
  2. Add these lines to myproject.pro, then run qmake.
HEADERS += \
    framelesswindow.h

win32{
	SOURCES += \
		framelesswindow.cpp
}
macx{
    OBJECTIVE_SOURCES += \
		framelesswindow.mm
    LIBS += -framework Cocoa
}
  1. Use class "CFramelessWindow" as the base class instead of QMainWindow.
1 2

Windows Specific

  • The window have no title bar by default, so we can not move the window around with mouse. Inorder to make the window moveable, protected member function setTitleBar(QWidget* titlebar) should be called in the MainWindow's Constructor, the widget "titlebar" should be a child widget of MainWindow, and it will act exactly same as SYSTEM Title Bar.

  • Widget "titlebar" may has its own child widget, such as "close button" and "max button", and we can NOT move the window with "close button", which is what we want. However, a label widget "label1" on "titlebar" should not cover the moveable functionality, the protected member function addIgnoreWidget(QWidget* widget) is designed to deal with this kind of situation, just call addIgnoreWidget(ui->label1) in MainWindow's Constructor.

  • setResizeableAreaWidth(int width = 5) can set width of an invisible border aera, inside this aera, window can be resized by mouse.

  • setResizeable(bool resizeable) can set whether the window can be resized by mouse or not.

  • Exampleforwindows shows the general usage.

  • WARNING: resize()/geometry()/setGeometry()/frameGeometry()/frameSize()/x()/y()/.etc function will not works right when the Window is Maximized, try not to use any of these function when the Window is Maximized (If you really want to fix these bugs, feel free to contact Bringer-of-Light) . But these function setContentsMargins()/contentsMargins()/getContentsMargins/contentsRect() can always works right, so you can use them anytime. Generally , it's always a good idea to use Qt Layout Management System instead of hard-code layout Management to avoid potential size-like/pos-like issue.

OS X Specific

  • The whole window is draggable by default. setDraggableAreaHeight(int height) can set the draggable area height, in draggable area, window can be moved by mouse, (height = 0) means that the whole window is draggable.

  • Native style(three system button/ round corner/ drop shadow) works only on OS X 10.10 and later. If isNativeStyleOK() return false, we should implement three custom button(close/ min/ max).

  • If Native style is OK, three system button is provided by OS X. On OS X 10.10 and later, the default behavior of Zoom Button(Green Button) is to FullScreen the window, and this will cause some anoying issue: when the window returns to normal size from fullscreen state, the System Title Bar show again! As a result, CFramelessWindow override the behavior of Zoom Button to Maximized (Not FullScreen) the window.

  • If Native style is OK, the default behavior of close button is to quit the application. If we want to hide the app instead of quit, use setCloseBtnQuit(false). Be carefull that after set this to false, we can NOT revert it to true again! And this funciton should NOT be called more than once!

  • If Native style is OK, all there system button can be disabled by setCloseBtnEnabled(false), setMinBtnEnabled(false), setZoomBtnEnabled(false).

  • Exampleformac shows the general usage.

Platform

  • Tested with Qt5.9.2.
  • Tested on Windows 7 (with visual studio 2015) , Windows 10 (with visual studio 2015), OS X 10.10.2.

Acknowledge

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].