#include "updatewindow.h" #include #include UpdateWindow::UpdateWindow(QWidget *parent) : QWidget(parent) { browser = new QTextBrowser; browser->setReadOnly(true); browser->setAcceptDrops(false); browser->setOpenExternalLinks(true); button = new QPushButton(QString::fromWCharArray(L"´Ý±â(&C)")); QVBoxLayout *layout = new QVBoxLayout; layout->addWidget(browser); layout->addWidget(button); setLayout(layout); setMinimumSize(250, 300); setAttribute(Qt::WA_DeleteOnClose, true); setWindowFlags(Qt::SubWindow | Qt::WindowStaysOnTopHint | windowFlags()); connect(button, SIGNAL(clicked()), this, SLOT(close())); } void UpdateWindow::setHtml(QString &html) { browser->setHtml(html); } void UpdateWindow::showEvent(QShowEvent *event) { Q_UNUSED(event); QDesktopWidget *desktop = QApplication::desktop(); QRect window = geometry(); QRect available = desktop->availableGeometry(); QPoint position; position.setX(available.width() / 2 - window.width() / 2); position.setY(available.height() / 2 - window.height() / 2); move(position); }