// projectwindowpanel.cpp
// code in main panel with a view which extends QGraphcisView and a status bar
// sizeHint() of this view has be overrideed in order to show the full image
view = new ProjectView(project, this);
QSize viewSize
= view
->sizeHint
();
view->setGeometry(0, 0, viewSize.width(), viewSize.width());
statusBar->setGeometry(0, viewSize.height(), viewSize.width(), 15);
statusBar
->setStyleSheet
(QString("background-color: red"));
vbox->setMargin(0);
vbox->setSpacing(0);
vbox->addWidget(view, 0, Qt::AlignHCenter);
vbox->addWidget(statusBar);
setLayout(vbox);
// override sizeHint() in projectwindowpanel.cpp
QSize GPF
::ProjectWindowPanel::sizeHint() const {
return QSize(view
->sizeHint
().
width(), view
->sizeHint
().
height() + 15);
}
//======================
// projectwindow.cpp
// project window extends QMdiSubWindow with a minimum size
// and set project window panel as its centre widget
setMinimumSize(200, 200);
mainPanel = new ProjectWindowPanel(project, this);
setWidget(mainPanel);
// projectwindowpanel.cpp
// code in main panel with a view which extends QGraphcisView and a status bar
// sizeHint() of this view has be overrideed in order to show the full image
view = new ProjectView(project, this);
QSize viewSize = view->sizeHint();
view->setGeometry(0, 0, viewSize.width(), viewSize.width());
statusBar = new QStatusBar(this);
statusBar->setGeometry(0, viewSize.height(), viewSize.width(), 15);
statusBar->setStyleSheet(QString("background-color: red"));
QVBoxLayout *vbox = new QVBoxLayout;
vbox->setMargin(0);
vbox->setSpacing(0);
vbox->addWidget(view, 0, Qt::AlignHCenter);
vbox->addWidget(statusBar);
setLayout(vbox);
// override sizeHint() in projectwindowpanel.cpp
QSize GPF::ProjectWindowPanel::sizeHint() const
{
return QSize(view->sizeHint().width(), view->sizeHint().height() + 15);
}
//======================
// projectwindow.cpp
// project window extends QMdiSubWindow with a minimum size
// and set project window panel as its centre widget
setMinimumSize(200, 200);
mainPanel = new ProjectWindowPanel(project, this);
setWidget(mainPanel);
To copy to clipboard, switch view to plain text mode
Bookmarks