mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-06 05:38:51 -04:00
fixed display of about widget
This commit is contained in:
parent
1cdb970e23
commit
0774f08933
2 changed files with 53 additions and 15 deletions
|
@ -68,7 +68,7 @@ void AboutWidget::installAWidget() {
|
||||||
AWidget* aWidget = new AWidget();
|
AWidget* aWidget = new AWidget();
|
||||||
QVBoxLayout* l = (QVBoxLayout*)frame->layout();
|
QVBoxLayout* l = (QVBoxLayout*)frame->layout();
|
||||||
l->insertWidget(0, aWidget);
|
l->insertWidget(0, aWidget);
|
||||||
// l->setStretchFactor(aWidget, 100);
|
l->setStretchFactor(aWidget, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AboutWidget::installTWidget() {
|
void AboutWidget::installTWidget() {
|
||||||
|
@ -151,7 +151,8 @@ void AboutWidget::keyPressEvent(QKeyEvent *e) {
|
||||||
QWidget::keyPressEvent(e);
|
QWidget::keyPressEvent(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AboutWidget::mousePressEvent(QMouseEvent *e) {
|
void AboutWidget::mousePressEvent(QMouseEvent *e)
|
||||||
|
{
|
||||||
QPoint globalPos = mapToGlobal(e->pos());
|
QPoint globalPos = mapToGlobal(e->pos());
|
||||||
QPoint framePos = frame->mapFromGlobal(globalPos);
|
QPoint framePos = frame->mapFromGlobal(globalPos);
|
||||||
if (frame->contentsRect().contains(framePos)) {
|
if (frame->contentsRect().contains(framePos)) {
|
||||||
|
@ -166,37 +167,65 @@ void AboutWidget::on_help_button_clicked()
|
||||||
helpdlg.exec();
|
helpdlg.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
AWidget::AWidget() {
|
void AWidget::resizeEvent(QResizeEvent *e)
|
||||||
setMouseTracking(true);
|
{
|
||||||
|
mImagesReady = false ;
|
||||||
|
}
|
||||||
|
|
||||||
QImage image(":/images/logo/logo_info.png");
|
void AWidget::initImages()
|
||||||
QPainter p(&image);
|
{
|
||||||
|
if(width() == 0) return ;
|
||||||
|
if(height() == 0) return ;
|
||||||
|
|
||||||
|
image1 = QImage(width(),height(),QImage::Format_ARGB32);
|
||||||
|
image1.fill(palette().color(QPalette::Background));
|
||||||
|
|
||||||
|
std::cerr << "width=" << width() << ", height=" << height() << std::endl;
|
||||||
|
|
||||||
|
//QImage image(":/images/logo/logo_info.png");
|
||||||
|
QPixmap image(":/images/logo/logo_splash.png");
|
||||||
|
QPainter p(&image1);
|
||||||
p.setPen(Qt::black);
|
p.setPen(Qt::black);
|
||||||
QFont font = p.font();
|
QFont font = p.font();
|
||||||
font.setBold(true);
|
font.setBold(true);
|
||||||
font.setPointSizeF(font.pointSizeF() + 2);
|
font.setPointSizeF(font.pointSizeF() + 2);
|
||||||
p.setFont(font);
|
p.setFont(font);
|
||||||
|
|
||||||
|
//p.drawPixmap(QRect(10, 10, width()-10, 60), image);
|
||||||
|
|
||||||
/* Draw RetroShare version */
|
/* Draw RetroShare version */
|
||||||
p.drawText(QRect(10, 10, width()-10, 60), QString("%1 : \n%2").arg(tr("RetroShare version"), Rshare::retroshareVersion(true)));
|
p.drawText(QPointF(10, 50), QString("%1 : %2").arg(tr("RetroShare version"), Rshare::retroshareVersion(true)));
|
||||||
|
|
||||||
/* Draw Qt's version number */
|
/* Draw Qt's version number */
|
||||||
p.drawText(QRect(10, 50, width()-10, 60), QString("Qt %1 : \n%2").arg(tr("version"), QT_VERSION_STR));
|
p.drawText(QPointF(10, 90), QString("Qt %1 : %2").arg(tr("version"), QT_VERSION_STR));
|
||||||
|
|
||||||
p.end();
|
p.end();
|
||||||
|
|
||||||
image1 = image2 = image;
|
// setFixedSize(image1.size());
|
||||||
setFixedSize(image1.size());
|
|
||||||
|
image2 = image1 ;
|
||||||
|
|
||||||
int w = image1.width();
|
int w = image1.width();
|
||||||
int h = image1.height();
|
int h = image1.height();
|
||||||
|
|
||||||
|
heightField1.clear();
|
||||||
|
heightField2.clear();
|
||||||
|
|
||||||
heightField1.resize(w*h);
|
heightField1.resize(w*h);
|
||||||
heightField2.resize(w*h);
|
heightField2.resize(w*h);
|
||||||
|
|
||||||
density = 5;
|
mImagesReady = true ;
|
||||||
page = 0;
|
update() ;
|
||||||
|
}
|
||||||
|
|
||||||
startTimer(15);
|
AWidget::AWidget() {
|
||||||
|
// setMouseTracking(true);
|
||||||
|
|
||||||
|
density = 5;
|
||||||
|
page = 0;
|
||||||
|
mImagesReady = false ;
|
||||||
|
|
||||||
|
// startTimer(15);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -218,11 +247,15 @@ void AWidget::timerEvent(QTimerEvent* e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AWidget::paintEvent(QPaintEvent* e) {
|
void AWidget::paintEvent(QPaintEvent* e)
|
||||||
|
{
|
||||||
QWidget::paintEvent(e);
|
QWidget::paintEvent(e);
|
||||||
|
|
||||||
|
if(!mImagesReady)
|
||||||
|
initImages();
|
||||||
|
|
||||||
QPainter p(this);
|
QPainter p(this);
|
||||||
p.drawImage(0, 0, image2);
|
p.drawImage(0, 0, image1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AWidget::mouseMoveEvent(QMouseEvent* e) {
|
void AWidget::mouseMoveEvent(QMouseEvent* e) {
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "ui_AboutWidget.h"
|
#include "ui_AboutWidget.h"
|
||||||
|
|
||||||
#include <QBasicTimer>
|
#include <QBasicTimer>
|
||||||
|
#include <QResizeEvent>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
@ -80,8 +81,10 @@ protected:
|
||||||
void timerEvent(QTimerEvent* e);
|
void timerEvent(QTimerEvent* e);
|
||||||
void paintEvent(QPaintEvent* e);
|
void paintEvent(QPaintEvent* e);
|
||||||
void mouseMoveEvent(QMouseEvent* e);
|
void mouseMoveEvent(QMouseEvent* e);
|
||||||
|
void resizeEvent(QResizeEvent *);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void initImages();
|
||||||
void calcWater(int npage, int density);
|
void calcWater(int npage, int density);
|
||||||
|
|
||||||
void addBlob(int x, int y, int radius, int height);
|
void addBlob(int x, int y, int radius, int height);
|
||||||
|
@ -100,6 +103,8 @@ private:
|
||||||
QVector<int> heightField2;
|
QVector<int> heightField2;
|
||||||
QImage image1;
|
QImage image1;
|
||||||
QImage image2;
|
QImage image2;
|
||||||
|
|
||||||
|
bool mImagesReady ;
|
||||||
};
|
};
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue