:QWidget(parent, Qt
::FramelessWindowHint | Qt
::Dialog) {
//this->setAutoFillBackground(true); //if it is set the top-level window was not transparent
//if not, the child widget was not show correctly
this->setAttribute(Qt::WA_TranslucentBackground);
this->move(50, 50);
this->resize(420, 430);
this->Initialize();
}
DDialog::DDialog(QWidget* parent)
:QWidget(parent, Qt::FramelessWindowHint | Qt::Dialog)
{
//this->setAutoFillBackground(true); //if it is set the top-level window was not transparent
//if not, the child widget was not show correctly
this->setAttribute(Qt::WA_TranslucentBackground);
this->move(50, 50);
this->resize(420, 430);
this->Initialize();
}
To copy to clipboard, switch view to plain text mode
void DDialog::Initialize()
{
this->setLayout(layout);
layout->setMargin(0);
layout->setSpacing(0);
//TitleBar ZONE
this->m_titleBar = new DTitleBar(this);
layout->addWidget(m_titleBar);
this
->m_mainWidget
= new QWidget();
layout->addWidget(m_mainWidget);
m_mainWidget->setAutoFillBackground(true);
layout->addWidget(statusBar);
statusBar->setAutoFillBackground(true);
this->m_mainWidget->setLayout(centerLayout);
//TabWidget ZONE
this->m_tabWidget->setAttribute(Qt::WA_OpaquePaintEvent);
centerLayout->addWidget(this->m_tabWidget);
centerLayout->setMargin(10);
this->m_tabWidget->setAutoFillBackground(true);
m_tabWidget
->setGeometry
(QRect(20,
20,
381,
361));
this
->m_tabWidget
->setTabPosition
(QTabWidget::North);
this
->m_tabWidget
->setTabShape
(QTabWidget::Rounded);
this->m_tabWidget->setElideMode(Qt::ElideMiddle);
//TableView ZONE
this->m_bmpTableHView->setAutoFillBackground(true);
this->m_bmpTableIView->setAutoFillBackground(true);
this
->m_bmpTableHView
->setGeometry
(QRect(-10,
-10,
391,
351));
this
->m_bmpTableHView
->setFrameShadow
(QFrame::Sunken);
this->m_tabWidget->addTab(this->m_bmpTableHView, "BitMapHead");
this->m_tabWidget->addTab(this->m_bmpTableIView, "BitMapInfoHead");
//QStandardItemModel ZONE
this->m_tableHModel->setHeaderData(0, Qt::Horizontal, tr("Name"));
this->m_tableHModel->setHeaderData(1, Qt::Horizontal, tr("Bytes"));
this->m_tableHModel->setHeaderData(2, Qt::Horizontal, tr("Value"));
this->m_bmpTableHView->setModel(this->m_tableHModel);
this->m_tableIModel->setHeaderData(0, Qt::Horizontal, tr("Name"));
this->m_tableIModel->setHeaderData(1, Qt::Horizontal, tr("Bytes"));
this->m_tableIModel->setHeaderData(2, Qt::Horizontal, tr("Value"));
this->m_bmpTableIView->setModel(this->m_tableIModel);
//BUTTON ZONE
centerLayout->addLayout(buttomLayout);
this
->m_OK
->setGeometry
(QRect(230,
390,
77,
25));
this->m_OK->setText(tr("OK"));
buttomLayout->addWidget(m_OK, 0, Qt::AlignRight);
this
->m_Cancel
->setGeometry
(QRect(310,
390,
77,
25));
buttomLayout->addWidget(m_Cancel);
this->m_Cancel->setText(tr("Cancel"));
}
void DDialog::Initialize()
{
QVBoxLayout* layout = new QVBoxLayout(this);
this->setLayout(layout);
layout->setMargin(0);
layout->setSpacing(0);
//TitleBar ZONE
this->m_titleBar = new DTitleBar(this);
layout->addWidget(m_titleBar);
this->m_mainWidget = new QWidget();
layout->addWidget(m_mainWidget);
m_mainWidget->setAutoFillBackground(true);
QStatusBar* statusBar = new QStatusBar();
layout->addWidget(statusBar);
statusBar->setAutoFillBackground(true);
QVBoxLayout* centerLayout = new QVBoxLayout();
this->m_mainWidget->setLayout(centerLayout);
//TabWidget ZONE
this->m_tabWidget = new QTabWidget();
this->m_tabWidget->setAttribute(Qt::WA_OpaquePaintEvent);
centerLayout->addWidget(this->m_tabWidget);
centerLayout->setMargin(10);
this->m_tabWidget->setAutoFillBackground(true);
m_tabWidget->setGeometry(QRect(20, 20, 381, 361));
this->m_tabWidget->setTabPosition(QTabWidget::North);
this->m_tabWidget->setTabShape(QTabWidget::Rounded);
this->m_tabWidget->setElideMode(Qt::ElideMiddle);
//TableView ZONE
this->m_bmpTableHView = new QTableView();
this->m_bmpTableIView = new QTableView();
this->m_bmpTableHView->setAutoFillBackground(true);
this->m_bmpTableIView->setAutoFillBackground(true);
this->m_bmpTableHView->setGeometry(QRect(-10, -10, 391, 351));
this->m_bmpTableHView->setFrameShadow(QFrame::Sunken);
this->m_tabWidget->addTab(this->m_bmpTableHView, "BitMapHead");
this->m_tabWidget->addTab(this->m_bmpTableIView, "BitMapInfoHead");
//QStandardItemModel ZONE
this->m_tableHModel = new QStandardItemModel(4, 3, this);
this->m_tableHModel->setHeaderData(0, Qt::Horizontal, tr("Name"));
this->m_tableHModel->setHeaderData(1, Qt::Horizontal, tr("Bytes"));
this->m_tableHModel->setHeaderData(2, Qt::Horizontal, tr("Value"));
this->m_bmpTableHView->setModel(this->m_tableHModel);
this->m_tableIModel = new QStandardItemModel(4, 3, this);
this->m_tableIModel->setHeaderData(0, Qt::Horizontal, tr("Name"));
this->m_tableIModel->setHeaderData(1, Qt::Horizontal, tr("Bytes"));
this->m_tableIModel->setHeaderData(2, Qt::Horizontal, tr("Value"));
this->m_bmpTableIView->setModel(this->m_tableIModel);
//BUTTON ZONE
QHBoxLayout* buttomLayout = new QHBoxLayout();
centerLayout->addLayout(buttomLayout);
this->m_OK = new QPushButton();
this->m_OK->setGeometry(QRect(230, 390, 77, 25));
this->m_OK->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
this->m_OK->setText(tr("OK"));
buttomLayout->addWidget(m_OK, 0, Qt::AlignRight);
this->m_Cancel = new QPushButton();
this->m_Cancel->setGeometry(QRect(310, 390, 77, 25));
this->m_Cancel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
buttomLayout->addWidget(m_Cancel);
this->m_Cancel->setText(tr("Cancel"));
}
To copy to clipboard, switch view to plain text mode
Bookmarks