mirror of
https://github.com/Quill-OS/quill.git
synced 2024-10-31 21:33:22 -07:00
More fixes
This commit is contained in:
parent
73ff36502e
commit
ddf9be2edd
2 changed files with 12 additions and 11 deletions
|
@ -17,7 +17,7 @@ egg::egg(QWidget *parent) :
|
|||
ui->contributorName->setFont(QFont("Inter"));
|
||||
|
||||
graphicsScene = new QGraphicsScene(this);
|
||||
changeIndex(index);
|
||||
QTimer::singleShot(500, this, SLOT(changeIndexSlot()));
|
||||
}
|
||||
|
||||
egg::~egg()
|
||||
|
@ -35,20 +35,16 @@ void egg::changeIndex(int index) {
|
|||
tux-linux (3)
|
||||
*/
|
||||
|
||||
if(firstRun == true) {
|
||||
firstRun = false;
|
||||
}
|
||||
else {
|
||||
graphicsScene->clear();
|
||||
ui->graphicsView->items().clear();
|
||||
}
|
||||
ui->graphicsView->items().clear();
|
||||
graphicsScene->clear();
|
||||
|
||||
QPixmap pixmap(":/resources/egg/" + QString::number(index) + ".jpg");
|
||||
graphicsScene->addPixmap(pixmap);
|
||||
ui->graphicsView->setScene(graphicsScene);
|
||||
// Shrinking scene if item is smaller than previous one
|
||||
QRectF rect = graphicsScene->itemsBoundingRect();
|
||||
graphicsScene->setSceneRect(rect);
|
||||
ui->graphicsView->setScene(graphicsScene);
|
||||
ui->graphicsView->fitInView(graphicsScene->sceneRect(), Qt::KeepAspectRatio);
|
||||
|
||||
// Contributor name
|
||||
QString name = "<div align='center'><b>";
|
||||
|
@ -68,6 +64,10 @@ void egg::changeIndex(int index) {
|
|||
ui->contributorName->setText(name);
|
||||
}
|
||||
|
||||
void egg::changeIndexSlot() {
|
||||
changeIndex(index);
|
||||
}
|
||||
|
||||
void egg::on_previousBtn_clicked()
|
||||
{
|
||||
if(index - 1 <= maximumIndex && index - 1 >= 0) {
|
||||
|
@ -94,4 +94,3 @@ void egg::on_quitBtn_clicked()
|
|||
{
|
||||
this->close();
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <QDialog>
|
||||
#include <QMessageBox>
|
||||
#include <QGraphicsScene>
|
||||
#include <QTimer>
|
||||
|
||||
#include "functions.h"
|
||||
|
||||
|
@ -21,11 +22,12 @@ public:
|
|||
int index = 0;
|
||||
const int maximumIndex = 3;
|
||||
bool firstRun = true;
|
||||
void changeIndex(int index);
|
||||
|
||||
private slots:
|
||||
void on_previousBtn_clicked();
|
||||
void on_nextBtn_clicked();
|
||||
void changeIndex(int index);
|
||||
void changeIndexSlot();
|
||||
void on_quitBtn_clicked();
|
||||
|
||||
private:
|
||||
|
|
Loading…
Reference in a new issue