Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,56 @@ 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.
![](screenshots/screenshot_step_20.png)
2. Add these lines to myproject.pro, then run qmake.

if you have qmake file:
```
HEADERS += \
framelesswindow.h

win32{
SOURCES += \
framelesswindow.cpp
LIBS += -lDwmapi -luser32
}
macx{
OBJECTIVE_SOURCES += \
framelesswindow.mm
LIBS += -framework Cocoa
}
```

if you have cmake file:
```
cmake_minimum_required(VERSION 3.16)

set(NiceFrameless_dir ${CMAKE_CURRENT_SOURCE_DIR}/Thirdparty/NiceFramelessWindow/framelesswindow) # path to your submodule

if(WIN32)
set(MySource_files
${NiceFrameless_dir}/framelesswindow.cpp
)
set(THIRD_LIBS
# to drawing shadow from Windows API when using mingw
Dwmapi
user32
)
endif()

if(APPLE)
set(MySource_files
${NiceFrameless_dir}/framelesswindow.mm
)
set(THIRD_LIBS
"-framework Cocoa"
)
# from cmake 3.16 we have objc, objcxx
enable_language(OBJC)
enable_language(OBJCXX)
endif()


# now add the ${MySource_files} to your project sources and ${THIRD_LIBS} to your target link libraries.
```
3. Use class "CFramelessWindow" as the base class instead of QMainWindow.

| 1 | 2 |
Expand Down
2 changes: 1 addition & 1 deletion framelesswindow/framelesswindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <dwmapi.h>
#include <objidl.h> // Fixes error C2504: 'IUnknown' : base class undefined
#include <gdiplus.h>
#include <GdiPlusColor.h>
#include <gdiplus/gdipluscolor.h>
#pragma comment (lib,"Dwmapi.lib") // Adds missing library, fixes error LNK2019: unresolved external symbol __imp__DwmExtendFrameIntoClientArea
#pragma comment (lib,"user32.lib")

Expand Down