modificada informationLabel (3 tama?os y aliniamiento a esquina superior derecha)

This commit is contained in:
Luis Ángel San Martín 2013-02-11 11:40:28 +01:00
parent e5391ab2ea
commit 0b01645729
5 changed files with 26 additions and 9 deletions

View File

@ -36,6 +36,8 @@
<file>../images/alwaysOnTop.png</file>
<file>../images/adjustToFullSize.png</file>
<file>../images/numPagesLabel.png</file>
<file>../images/numPagesLabelMedium.png</file>
<file>../images/numPagesLabelBig.png</file>
<file>../images/imgTopLeft.png</file>
<file>../images/imgTopMiddle.png</file>
<file>../images/imgTopRight.png</file>

View File

@ -3,22 +3,37 @@
#include <QLabel>
#include <QHBoxLayout>
#include <QPropertyAnimation>
#include <QApplication>
#include <QDesktopWidget>
PageLabelWidget::PageLabelWidget(QWidget * parent)
:QWidget(parent)
{
animation = new QPropertyAnimation(this,"pos");
animation->setDuration(150);
int verticalRes = QApplication::desktop()->screenGeometry().height();
imgLabel = new QLabel(this);
QPixmap p(":/images/numPagesLabel.png");
QPixmap p;
if (verticalRes <= 1024)
p.load(":/images/numPagesLabel.png");
else if (verticalRes <= 1200)
p.load(":/images/numPagesLabelMedium.png");
else
p.load(":/images/numPagesLabelBig.png");
imgLabel->resize(p.size());
imgLabel->setPixmap(p);
textLabel = new QLabel(this);
textLabel->setAlignment(Qt::AlignVCenter|Qt::AlignHCenter);
textLabel->setStyleSheet("QLabel { color : white; }");
if(verticalRes <= 1024)
textLabel->setStyleSheet("QLabel { color : white; padding-left:8px; }");
else if (verticalRes <= 1200)
textLabel->setStyleSheet("QLabel { color : white; font-size:16px; padding-left:8px;}");
else
textLabel->setStyleSheet("QLabel { color : white; font-size:20px; padding-left:8px; }");
//informationLabel->setAutoFillBackground(true);
//textLabel->setFont(QFont("courier new bold", 12));
//textLabel->resize(100,25);
@ -50,8 +65,8 @@ void PageLabelWidget::show()
//connect(animation,SIGNAL(finished()),this,SLOT(QWidget::hide()));
animation->disconnect();
animation->setStartValue(QPoint((parent->geometry().size().width()-this->width())/2,-this->height()));
animation->setEndValue(QPoint((parent->geometry().size().width()-this->width())/2,0));
animation->setStartValue(QPoint((parent->geometry().size().width()-this->width()),-this->height()));
animation->setEndValue(QPoint((parent->geometry().size().width()-this->width()),0));
animation->start();
}
}
@ -67,8 +82,8 @@ void PageLabelWidget::hide()
return;
}
//connect(animation,SIGNAL(finished()),this,SLOT(setHidden()));
animation->setStartValue(QPoint((parent->geometry().size().width()-this->width())/2,0));
animation->setEndValue(QPoint((parent->geometry().size().width()-this->width())/2,-this->height()));
animation->setStartValue(QPoint((parent->geometry().size().width()-this->width()),0));
animation->setEndValue(QPoint((parent->geometry().size().width()-this->width()),-this->height()));
animation->start();
}
}
@ -78,7 +93,7 @@ void PageLabelWidget::setText(const QString & text)
textLabel->setText(text);
QRect geom = imgLabel->geometry();
QSize size = geom.size();
size.setHeight(size.height() - 10); //TODO remove this amazing magic number
size.setHeight(size.height() - 10);//TODO remove this amazing magic number
geom.setSize(size);
textLabel->setGeometry(geom);
}
@ -95,5 +110,5 @@ void PageLabelWidget::updatePosition()
{
return;
}
move(QPoint((parent->geometry().size().width()-this->width())/2,this->pos().y()));
move(QPoint((parent->geometry().size().width()-this->width()),this->pos().y()));
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 710 B

After

Width:  |  Height:  |  Size: 569 B

BIN
images/numPagesLabelBig.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 609 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 612 B