标签:qml 透明背景 最小化
qml中的背景透明设置:
view.setStyleSheet("background:transparent;");
view.setAttribute(Qt::WA_TranslucentBackground);
qml中设置背景透明后showMinimized()(最小化)不好用解决方案是:
对qml的焦点事件重载
头文件:
#ifndef QML_WIDGET_SET_H
#define QML_WIDGET_SET_H
#include <QDeclarativeView>
class qml_widget : public QDeclarativeView
{
Q_OBJECT
public:
explicit qml_widget(QDeclarativeView *parent = 0);
signals:
public slots:
virtual void focusInEvent(QFocusEvent *event);
};
#endif // QML_WIDGET_SET_H
cpp文件:
#include "qml_widget.h"
qml_widget::qml_widget(QDeclarativeView *parent) :
QDeclarativeView(parent)
{
}
void qml_widget::focusInEvent(QFocusEvent *event)
{
repaint();
}
main函数:
#include <QtGui/QApplication> #include <QResource> #include <QDeclarativeView> #include <QDeclarativeContext> #include <QTextCodec> #include <QDebug> #include "qml_widget.h"int main(int argc, char *argv[])
注:信号min()是qml页面中的发送的
标签:qml 透明背景 最小化
原文地址:http://sysq2012cto.blog.51cto.com/8202674/1568705