Skip to content

Commit

Permalink
add proggress to smal form
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonMrt committed Nov 21, 2024
1 parent aa5ac78 commit e89f353
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 2 additions & 0 deletions gui/cool_progressbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ void coolProgressBar::paintEvent(QPaintEvent* event) {
}

void coolProgressBar::showEvent(QShowEvent* event) {
qDebug()<<width();
m_movingSquare->setGeometry(0, 0, width() / 2, height());
qDebug()<<"blue - "<<m_movingSquare->geometry();
}

11 changes: 9 additions & 2 deletions gui/davis_gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include <QTimer>
#include <QtConcurrent/QtConcurrent>
#include "json_utils.h"
#include "cool_progressbar.h"


const int ANIMATION_DURATION = 300;

Expand Down Expand Up @@ -137,7 +137,7 @@ DavisGUI::DavisGUI(QWidget* parent)
hbl->addWidget(qpbExit);
this->setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);

coolProgressBar* barCool = new coolProgressBar(QColor(52, 52, 52), QColor(42, 130, 218), 2500, this);
barCool = new coolProgressBar(QColor(52, 52, 52), QColor(42, 130, 218), 2500, this);
barCool->setGeometry(70, 220, 270, 2);
this->layout()->addWidget(barCool);
connect(this, &DavisGUI::showProgressBar, barCool, &coolProgressBar::startAnimation);
Expand All @@ -156,6 +156,7 @@ DavisGUI::DavisGUI(QWidget* parent)

connect(qpbOpen, &QPushButton::released, this, &DavisGUI::selectAndShowFiles);
connect(qpbBuffer, &QPushButton::released, this, &DavisGUI::pasteFromClipboard);
//emit showProgressBar();
}

DavisGUI::~DavisGUI() {
Expand All @@ -174,6 +175,7 @@ void DavisGUI::hideElementsDuringResize() {
ui->label_text->setVisible(false);
qpbBuffer->setVisible(false);
qpbOpen->setVisible(false);
barCool->setVisible(false);
update();
}

Expand Down Expand Up @@ -207,6 +209,9 @@ void DavisGUI::setMaxStyleWindow(int animDuration) {
ui->label_arrow->setGeometry(170, 90, 50, 50);
ui->label_graph->setGeometry(210, 70, 81, 81);
ui->label_text->setGeometry(0, 230, 391, 111);
//barCool->setGeometry(70, 220, 270, 2);
barCool->setGeometry(97, 155, 187, 2);
//barCool->setVisible(true); // important after barCool->setGeometry, not vice versa
update();
});

Expand Down Expand Up @@ -242,6 +247,8 @@ void DavisGUI::setMinStyleWindow(int animDuration) {
ui->label_doc->setGeometry(30, 60, 41, 41);
ui->label_arrow->setGeometry(60, 60, 41, 41);
ui->label_graph->setGeometry(90, 60, 41, 41);
barCool->setGeometry(35, 105, 90, 2);
//barCool->setVisible(true);
update();
});
QParallelAnimationGroup* group = new QParallelAnimationGroup;
Expand Down
2 changes: 2 additions & 0 deletions gui/davis_gui.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "about_window.h"
#include "QAction"
#include "animated_button.h"
#include "cool_progressbar.h"

QT_BEGIN_NAMESPACE
namespace Ui { class DavisGUI; }
Expand Down Expand Up @@ -57,5 +58,6 @@ class DavisGUI : public QMainWindow {
bool m_isMinStyleWindow;
AnimatedButton* qpbBuffer;
AnimatedButton* qpbOpen;
coolProgressBar* barCool;
};
#endif // DAVISGUI_H

0 comments on commit e89f353

Please sign in to comment.