【转载】关于graphicsview背景透明的问题
2013-09-17 12:53
991 查看
#include <QtGui>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QMainWindow window;
QGraphicsScene* scene = new QGraphicsScene(&window);
QGraphicsItem* item = scene->addText("QGraphicsTextItem");
item->setFlags(QGraphicsItem::ItemIsMovable);
QGraphicsView* view = new QGraphicsView(&window);
view->setStyleSheet("background: transparent"); //就是这句可以设置透明
view->setScene(scene);
window.setAttribute(Qt::WA_TranslucentBackground);
window.setWindowFlags( Qt::FramelessWindowHint) ;
window.setCentralWidget(view);
window.setStyleSheet("background: green");
window.show();
return app.exec();
}
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QMainWindow window;
QGraphicsScene* scene = new QGraphicsScene(&window);
QGraphicsItem* item = scene->addText("QGraphicsTextItem");
item->setFlags(QGraphicsItem::ItemIsMovable);
QGraphicsView* view = new QGraphicsView(&window);
view->setStyleSheet("background: transparent"); //就是这句可以设置透明
view->setScene(scene);
window.setAttribute(Qt::WA_TranslucentBackground);
window.setWindowFlags( Qt::FramelessWindowHint) ;
window.setCentralWidget(view);
window.setStyleSheet("background: green");
window.show();
return app.exec();
}
相关文章推荐
- 关于android中改变TextView背景颜色以及文字颜色的问题
- 关于使用了透明文字背景后,文字不能刷新而重叠在一起的问题
- 关于UITableView设置背景颜色无效的问题
- MFC 关于Static控件背景透明时文本覆盖重影的问题
- 关于imagic拼接透明背景图片的问题
- 关于surfaceview画背景格的几个问题
- 关于TextView和ImageView的背景及透明设置小结
- 关于IE7半透明背景问题
- UIKit和Cocos2d-x的整合使用;设置CCEAGLView背景为透明,来显示背后的UIView; 以及整合中遇到的问题的解决方案
- 关于TextView和ImageView的背景及透明设置小结
- 关于Static控件背景透明时文本覆盖重影的问题
- 关于Qt5 使用QQuickWidget加载QML背景设置透明的问题!
- 关于Static控件背景透明时文本覆盖重影的问题
- 关于TextView和ImageView的背景及透明
- 关于图片下载后保存背景透明变黑色的问题
- 关于使用了透明文字背景后,文字不能刷新而重叠在一起的问题
- 关于ListView中addHeaderView里面的ImageView的背景问题!
- [转载 js]一次性解决png在i6下的透明问题(包括做为img和背景的两种情况)
- [转载 js]一次性解决png在i6下的透明问题(包括做为img和背景的两种情况)
- android在滑动控件过程中动态设置view背景透明的问题