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->setText("");
- m_btnOK = new QPushButton();
- connect(m_btnOK, SIGNAL(clicked(bool)), this, SLOT(slotBtnOKClicked()));
- m_gridLayout = new QGridLayout();
- m_gridLayout->setSpacing(1);
- m_gridLayout->addWidget(m_labIcon, 0, 0, 1, 1);
- m_gridLayout->addWidget(m_labText, 0, 4, 2, 9);
- m_gridLayout->addWidget(m_btnOK, 2, 11, 1, 2);
- this->setLayout(m_gridLayout);
- this->show();
- }