我创建了一个这样的弹出窗口:
QFileInfo FileA = "AAA";
QFileInfo FileB = "BBB";
if (fileA.exists() == false & (fileB.exists() == false))
{
QFrame* PopupWin = new QFrame(this, Qt::Popup | Qt::Window );
PopupWin->setGeometry(450,450, 400, 200);
PopupWin->setLineWidth ( 3 );
PopupWin->setMidLineWidth ( 1 );
PopupWin->setFrameStyle ( QFrame::Box | QFrame::Raised);
QLabel *message = new QLabel(PopupWin);
message->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
message->setGeometry(100,50, 200, 100);
message->setText("blaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
"bluuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu"
"bliiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii"
"bleeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
"bloooooooooooooooooooooooooooooooooooooooooooooo");
PopupProzess->show();
}
我有三个问题:
我在Qt Doc中搜索并搜索,但没有找到解决方案。问候
答案 0 :(得分:1)
为什么要创建QFrame
?你想要的是QDialog
。
QtDesigner
设计对话框QDialog
的类exec
以便以模态方式显示。 这样您的代码将更清晰,更易于阅读。
QDialog* pMyDialog = new MyDialog(this); // you have to delete it later...
if (fileA.exists() == false && (fileB.exists() == false))
{
pMyDialog->exec();
}
此外,没有理由对UI元素的几何进行硬编码。这是QtDesigner
的用途。
关于标签,正如spbots已经回答你必须设置wordWrap
属性。