WindowTitleBar Class

Provides customization APIs for the top-level window title bar. More...

Header: #include <WindowTitleBar>
Inherits: QObject

Public Functions

int borderThickness() const
void setBorderThickness(int thickness)
void setTitleHeight(int height)
int titleHeight() const
void update()

Detailed Description

The customization allows you specify the colors for title bar buttons, control the thickness of the frame or the height of the title bar, add custom QWidget to the title bar and even extend window content into the title bar area.

QMainWindow window;

QLineEdit* edit = new QLineEdit();
edit->setAttribute(Qt::WA_NoSystemBackground, true);
edit->setContentsMargins(0, 3, 0, 3);
edit->setPlaceholderText("Search here...");
#ifdef Q_OS_WIN
edit->setFrame(false);
#endif

Qtitan::WindowTitleBar* titleBar = Qtitan::WindowTitleBar::get(&window);
titleBar->setSysButtonKind(WindowTitleBar::BackButton);
titleBar->setWidget(edit, WindowTitleBar::AlignRight);
titleBar->show();

window.show();

Member Function Documentation

int WindowTitleBar::borderThickness() const

Returns the window non-client area frame thickness.

See also setBorderThickness().

void WindowTitleBar::setBorderThickness(int thickness)

Sets the frame thickness of the window non-client area. If the value is not specified, then the thickness will be equal to the thickness of the system window frame. If the styledFrame() property returns true, the border thickness will be retrieved from the window style using the QStyle::PM_MdiSubWindowFrameWidth metric.

See also borderThickness().

void WindowTitleBar::setTitleHeight(int height)

Sets the height of the title bar (top part of the window non-client area). If the value is not specified, then the height of the title bar will be equal to the height of the system title bar. If the styledFrame() property returns true, the height of the title bar will be retrieved from the window style using the QStyle::PM_TitleBarHeight metric.

See also titleHeight().

int WindowTitleBar::titleHeight() const

Returns the height of the title bar.

See also setTitleHeight().

void WindowTitleBar::update()

Updates for repaint the non-client area of the window.