查看完整版本: [-- Ubuntu下用qss方式显示背景图片没效果 --]

QTCN开发网 -> Qt嵌入式开发 -> Ubuntu下用qss方式显示背景图片没效果 [打印本页] 登录 -> 注册 -> 回复主题 -> 发表主题

z644846309 2016-09-03 22:03

Ubuntu下用qss方式显示背景图片没效果

采用qss的方式,使登录界面显示背景图片,编译后没有错误,运行后没有出现背景图片,效果如下:
[attachment=15717]
我的welcome.cpp中设置如下:
#include <QtGui/QApplication>
#include "welcome.h"
#include "ui_welcome.h"
#include <QFile>
#include <QFrame>
welcome::welcome(QWidget *parent) :
    QFrame(parent),
    ui(new Ui::welcome)
{
    ui->setupUi(this);
    Warning = new warning;
    smartHome = new smarthome ;
}
....


welcome.h设置如下:
#ifndef WELCOME_H
#define WELCOME_H
#include <QFrame>
#include <smarthome.h>
#include <warning.h>
namespace Ui {
class welcome;
}

class welcome : public QFrame
{
    Q_OBJECT

public:
    explicit welcome(QWidget *parent = 0);
    ~welcome();
...


welcome.ui如下:
[attachment=15716]

请问怎么把右边welcome的class变成QFrame?


hehui 2017-02-25 19:16
直接用文本编辑器打开UI文件,改QWidget为QFrame就行了


查看完整版本: [-- Ubuntu下用qss方式显示背景图片没效果 --] [-- top --]



Powered by phpwind v8.7 Code ©2003-2011 phpwind
Gzip disabled