首页| 论坛| 消息

标题:请问 Qt 运行在 frambuffer 时无法显示窗体是什么原因
作者:鱼香肉狮
日期:2016-12-27 17:15
内容:

QT-5.5.1,程序在 x86 + disktop 下运行正常,但在 frambuffer 下(没有任何桌面环境,类似 ubuntu server textonly)无法显示 widget / dialog 的外部窗体结构,具体如下图所示,看起来与执行了 setWindowFlags(Qt::FramelessWindowHint) 效果一样,请问这是因为没有桌面环境导致的么?除了安装桌面环境外还有什么解决办法?

同一份程序,在有桌面的环境下就显示正常:


在 frambuffer 环境下就没有外边框了。。。


源码如下:
QString noticeStr = "Sorry, --------------------------------------.";
QMessageBox::information(this, "Note", noticeStr);

也尝试过重写 MessageBox ,但是依然没有效果,源码如下:
DialogMessageBox *noteBox = new DialogMessageBox();
noteBox->setModal(true);
noteBox->setTitle("Note");
noteBox->setContext("Sorry, please select the disk you want to backup.");
noteBox->setButtonText("OK");

DialogMessageBox.cpp:
DialogMessageBox::DialogMessageBox(QWidget *parent)
: QDialog(parent)
{
this->setFixedSize((Global::global_values.width_unit*13), (Global::global_values.height_unit*3));
this->move(((Global::global_values.width - (Global::global_values.width_unit*13))/2),
((Global::global_values.height - (Global::global_values.height_unit*3))/2));
m_labIcon = new QLabel();
m_labIcon->setScaledContents(true);
m_labIcon->resize((Global::global_values.width_unit*1), (Global::global_values.height_unit*1));
m_labIcon->setPixmap(QPixmap(":icon"));
m_labIcon->show();
m_labText = new QLabel();
m_labText->setWordWrap(true);
m_labText- ..


#1 [鱼香肉狮 01-03 11:30]
自己顶一下

回复 发表
主题 版块