• 3429阅读
  • 1回复

Ubuntu下用qss方式显示背景图片没效果 [复制链接]

上一主题 下一主题
离线z644846309
 

只看楼主 倒序阅读 楼主  发表于: 2016-09-03
采用qss的方式,使登录界面显示背景图片编译没有错误,运行后没有出现背景图片,效果如下:

我的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如下:


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

离线hehui

只看该作者 1楼 发表于: 2017-02-25
直接用文本编辑器打开UI文件,改QWidget为QFrame就行了
快速回复
限100 字节
 
上一个 下一个