DialogDemo Example

#include <QApplication>
#include <QScreen>
#include <qevent.h>
#include <QLayout>
#include <QPushButton>
#include "mainwindow.h"

/* MainDialog */
MainDialog::MainDialog(QWidget* parent)
    : QDialog(parent)
{
    WindowTitleBar::get(this)->setVisible(true);
    m_dlgRibbonBar = new RibbonBar(this);
    m_dlgRibbonBar->addPage(QObject::tr("Home"));

    QLayout* layout = new QVBoxLayout();
    layout->setSpacing(0);
    layout->setContentsMargins(0, 0, 0, 0);
    layout->addWidget(m_dlgRibbonBar);
    layout->setAlignment(m_dlgRibbonBar, Qt::AlignTop);
    this->setLayout(layout);

#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
    const QRect availableGeometry = screen()->availableGeometry();
    resize(availableGeometry.width() / 2, availableGeometry.height() / 2);
    move((availableGeometry.width() - width()) / 2, (availableGeometry.height() - height()) / 2);
#else
    resize(800, 640); move(200, 200);
#endif
}

MainDialog::~MainDialog()
{
}