目前還沒有達到自己滿意的地步,魔方別人寫的的,先提供參考,後面在加入新的東西
標頭檔案
#ifndef titlebar_hcpp檔案#define titlebar_h
#include class qlabel;
class qpushbutton;
class titlebar : public qwidget
;#endif // titlebar_h
#include "titlebar.h"使用#pragma comment(lib,"user32.lib")
#include #endif
titlebar::titlebar(qwidget *parent) : qwidget(parent)
titlebar::~titlebar()
void titlebar::mousedoubleclickevent(qmouseevent *event)
void titlebar::mousepressevent(qmouseevent *event)
}event->ignore();
#else
#endif
}bool titlebar::eventfilter(qobject *watched, qevent *event)
}case qevent::windowiconchange:
}case qevent::windowstatechange:
case qevent::resize:
}return qwidget::eventfilter(watched,event);
}void titlebar::onclicked()
else if(pbutton == m_pmaximizebutton)
else if(pbutton == m_pclosebutton)
}}void titlebar::updatemaximize()
else}}
#include "widget.h"這裡的效果還是有問題的,還在排錯中#include "ui_widget.h"
#include "titlebar.h"
#include #include widget::widget(qwidget *parent) :
qwidget(parent),
ui(new ui::widget)
widget::~widget()
QT 自定義標題欄
1 去除舊的標題欄 去除qdialog對話方塊有上角問號 qt windowflags flags qt dialog flags qt windowclosebuttonhint flags qt framelesswindowhint setwindowflags flags flags qt ...
QT自定義標題欄
ifndef dlgtitle h define dlgtitle h include enum buttontype class dlgtitle public qwidget endif dlgtitle h自定義標題欄類dlgtitle.cpp如下 include dlgtitle.h def...
android自定義標題欄
1.建立自定義標題欄的xml檔案,可以給標題欄加背景 引用或者在drawable檔案下通過xml檔案生成 2.在activity中通過requestwindowfeature window.feature custom title 宣告使用自定義標題 3.setcontentview r.layou...