资源简介

以上代码用Qt实现了自定义窗口标题栏,非常实用,提供了窗口图标、窗口标题、最小化、最大化、关闭按钮等几个部分。可以应用到每一个窗口中去,保持每个窗口外观的一致性,同时自定义的标题栏也比系统自带的漂亮很多。

资源截图

代码片段和文件信息

#include “basewindow.h“
#include 
#include 
#include 
#include 

baseWindow::baseWindow(QWidget *parent)
: QWidget(parent)
{
// framelessWindowHint属性设置窗口去除边框;
// WindowMinimizeButtonHint 属性设置在窗口最小化时,点击任务栏窗口可以显示出原窗口;
this->setWindowFlags(Qt::framelessWindowHint | Qt::WindowMinimizeButtonHint);
// 设置窗口背景透明;
setAttribute(Qt::WA_TranslucentBackground);
// 初始化标题栏;
inittitleBar();
}

baseWindow::~baseWindow()
{

}

void baseWindow::inittitleBar()
{
m_titleBar = new MytitleBar(this);
m_titleBar->move(0 0);

connect(m_titleBar SIGNAL(signalButtonMinClicked()) this SLOT(onButtonMinClicked()));
connect(m_titleBar SIGNAL(signalButtonRestoreClicked()) this SLOT(onButtonRestoreClicked()));
connect(m_titleB

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       2715  2016-12-07 16:08  CustomtitleDemoV1.0\Customtitle\basewindow.cpp

     文件        541  2016-12-07 16:08  CustomtitleDemoV1.0\Customtitle\basewindow.h

     文件        160  2016-12-07 09:23  CustomtitleDemoV1.0\Customtitle\customtitle.cpp

     文件        302  2016-12-07 09:23  CustomtitleDemoV1.0\Customtitle\customtitle.h

     文件        339  2016-12-07 09:27  CustomtitleDemoV1.0\Customtitle\customtitle.qrc

     文件        810  2016-12-07 09:23  CustomtitleDemoV1.0\Customtitle\customtitle.ui

     文件      18179  2016-12-07 17:01  CustomtitleDemoV1.0\Customtitle\Customtitle.vcxproj

     文件       4325  2016-12-07 17:01  CustomtitleDemoV1.0\Customtitle\Customtitle.vcxproj.filters

     文件        659  2016-12-07 11:14  CustomtitleDemoV1.0\Customtitle\Customtitle.vcxproj.user

     文件       4060  2016-12-07 17:01  CustomtitleDemoV1.0\Customtitle\GeneratedFiles\Debug\moc_basewindow.cpp

     文件       2737  2016-12-07 17:01  CustomtitleDemoV1.0\Customtitle\GeneratedFiles\Debug\moc_customtitle.cpp

     文件       6756  2016-12-07 17:01  CustomtitleDemoV1.0\Customtitle\GeneratedFiles\Debug\moc_mytitlebar.cpp

     文件       2772  2016-12-07 17:01  CustomtitleDemoV1.0\Customtitle\GeneratedFiles\Debug\moc_nofocuswidget.cpp

     文件     160743  2016-12-07 17:01  CustomtitleDemoV1.0\Customtitle\GeneratedFiles\qrc_customtitle.cpp

     文件       2323  2016-12-07 17:01  CustomtitleDemoV1.0\Customtitle\GeneratedFiles\ui_customtitle.h

     文件       6326  2016-12-07 17:01  CustomtitleDemoV1.0\Customtitle\GeneratedFiles\ui_nofocuswidget.h

     文件        211  2016-12-07 09:25  CustomtitleDemoV1.0\Customtitle\main.cpp

     文件       7554  2016-12-07 16:23  CustomtitleDemoV1.0\Customtitle\mytitlebar.cpp

     文件       2354  2016-12-07 16:21  CustomtitleDemoV1.0\Customtitle\mytitlebar.h

     文件        548  2016-12-07 17:03  CustomtitleDemoV1.0\Customtitle\nofocuswidget.cpp

     文件        382  2016-12-07 17:01  CustomtitleDemoV1.0\Customtitle\nofocuswidget.h

     文件       4727  2016-12-06 10:39  CustomtitleDemoV1.0\Customtitle\nofocuswidget.ui

     文件       2767  2016-02-15 09:27  CustomtitleDemoV1.0\Customtitle\Resources\Mytitle\close.png

     文件       1338  2012-09-20 19:21  CustomtitleDemoV1.0\Customtitle\Resources\Mytitle\max.png

     文件       1391  2016-02-15 09:26  CustomtitleDemoV1.0\Customtitle\Resources\Mytitle\min.png

     文件       1375  2012-09-20 19:21  CustomtitleDemoV1.0\Customtitle\Resources\Mytitle\restore.png

     文件       1371  2016-12-07 09:26  CustomtitleDemoV1.0\Customtitle\Resources\Mytitle.css

     文件      21867  2016-02-03 09:50  CustomtitleDemoV1.0\Customtitle\Resources\titleicon.png

     文件        979  2016-12-07 09:23  CustomtitleDemoV1.0\Customtitle.sln

    ..A..H.     29696  2016-12-07 17:04  CustomtitleDemoV1.0\Customtitle.v12.suo

............此处省略16个文件信息

评论

共有 条评论