Skip to content

imitatehappiness/QtCustomTitleBar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 

Repository files navigation

Custom Title Bar Template for C++ Qt

GitHub stars GitHub forks GitHub followers

Qt version MinGW version

About project

In standard C++/Qt applications, the window's title bar is managed by the operating system, which imposes limitations on customization.

This repository provides a template for creating a custom title bar in a C++ Qt application. The custom title bar replicates essential window functionality, including hiding, dragging, maximizing, and closing the window. It serves as an excellent starting point for developers looking to design a more personalized and visually appealing title bar for their Qt applications.

Features

1. Interactive Window Controls

  • Collapse Button: Toggles between collapsing and expanding the window body.
  • Minimize Button: Minimizes the window to the taskbar.
  • Maximize/Restore Button: Allows the window to switch between maximized and normal states.
  • Close Button: Closes the window.

2. Draggable Header

  • Move Window: The window can be dragged and moved around the screen by clicking and holding the left mouse button on the header.
  • Double-Click to Maximize/Restore: Double-clicking the header toggles between maximized and restored states.

3. Context Menu

  • Right-Click Menu on Header: Right-clicking the header brings up a context menu.
Preview

Basic usage

#include "mainwindow.h"
#include "windowframe.h"

#include <QApplication>

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

    WindowFrame w(nullptr, new MainWindow());
    w.show();
    return a.exec();

}

UI Demonstration

demo.mp4

About

🔲 Custom Title Bar Template for C++ Qt

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published