2014-11-09 63 views
2

我有下面的例子(来自GlassWire),我知道它是用Qt构建的,但我似乎无法弄清楚如何将东西放入“Windows标题栏”窗框的半透明部分。就像在这个例子中,我们有一个QPushButton GlassWire按钮,然后我们有4个选项卡,都在正常的Windows框架中。Qt你如何添加到Windows标题栏?

我似乎无法弄清楚如何做这样的事情。任何想法,例如,我可以在栏中添加一个QPushButton?

如果我在Qt之外这样做,我会做类似http://msdn.microsoft.com/en-us/library/windows/desktop/bb688195(v=vs.85).aspx的事情。

Example

回答

3

我设法得到它做这样做:

#include "mainwindow.h" 
#include "ui_mainwindow.h" 
#include <QtWin> 

MainWindow::MainWindow(QWidget *parent) : 
    QMainWindow(parent), 
    ui(new Ui::MainWindow) 
{ 
    ui->setupUi(this); 

#ifdef Q_OS_WIN 
    this->setAttribute(Qt::WA_TranslucentBackground); 
    QtWin::enableBlurBehindWindow(this); 
    QtWin::extendFrameIntoClientArea(this, -1, -1, -1, -1); 
#endif 
} 

MainWindow::~MainWindow() 
{ 
    delete ui; 
}