mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Fix the size of the scene on screen and Background improvements.
It seems that I forgot to add the background pixmap, but this is being done right now by luisa. This patch fixes the size of the scene by scaling everything to the size of the viewport as soon as a resize is done, and it also fixes the size of the - to be included - background pixmap. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
816f6db356
commit
ff49cb1929
2 changed files with 18 additions and 0 deletions
|
@ -196,7 +196,24 @@ void ProfileWidget2::contextMenuEvent(QContextMenuEvent* event)
|
|||
|
||||
void ProfileWidget2::resizeEvent(QResizeEvent* event)
|
||||
{
|
||||
QGraphicsView::resizeEvent(event);
|
||||
fitInView(sceneRect(), Qt::IgnoreAspectRatio);
|
||||
|
||||
if(!stateMachine->configuration().count())
|
||||
return;
|
||||
|
||||
if ((*stateMachine->configuration().begin())->objectName() == "Empty State"){
|
||||
fixBackgroundPos();
|
||||
}
|
||||
}
|
||||
|
||||
void ProfileWidget2::fixBackgroundPos()
|
||||
{
|
||||
QPixmap p = QPixmap(":background").scaledToHeight(viewport()->height());
|
||||
int x = viewport()->width()/2 - p.width()/2;
|
||||
DivePixmapItem *bg = background;
|
||||
bg->setPixmap(p);
|
||||
bg->setX(mapToScene(x, 0).x());
|
||||
}
|
||||
|
||||
void ProfileWidget2::showEvent(QShowEvent* event)
|
||||
|
|
|
@ -26,6 +26,7 @@ struct QStateMachine;
|
|||
|
||||
class ProfileWidget2 : public QGraphicsView {
|
||||
Q_OBJECT
|
||||
void fixBackgroundPos();
|
||||
public:
|
||||
enum State{ EMPTY, PROFILE, EDIT, ADD, PLAN, INVALID };
|
||||
enum Items{BACKGROUND, PROFILE_Y_AXIS, GAS_Y_AXIS, TIME_AXIS, DEPTH_CONTROLLER, TIME_CONTROLLER, COLUMNS};
|
||||
|
|
Loading…
Add table
Reference in a new issue