This repository contains a basic template for a custom title bar in a C++ Qt application. The custom title bar provides essential functionality, such as hiding, dragging, maximizing, and closing the window. You can use this template as a starting point in your real projects to create a more personalized and visually appealing title bar for your Qt applications.
- 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.
- 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.
- Right-Click Menu on Header: Right-clicking the header brings up a context menu with an "Exit" option to close the window.
#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();
}