11#include " ui.h"
22
3- #include < QtWidgets/QMainWindow>
4- #include < QtWidgets/QMenuBar>
5- #include < QtWidgets/QMenu>
6- #include < QtWidgets/QAction>
7-
8- #include < QtWidgets/QApplication>
9- #include < QtWidgets/QLabel>
10- #include < QtGui/QDragEnterEvent>
11- #include < QtGui/QDropEvent>
12- #include < QtCore/QMimeData>
13- #include < QtCore/QDebug>
14- #include < QtCore/QFileInfo>
15- #include < QtCore/QProcess>
16-
173#include " processing.h"
184
195DropArea::DropArea () {
20- setAcceptDrops (true );
21- setText (" Drag & drop files here" ); // Set text
22- setAlignment (Qt::AlignCenter); // Set alignment to center
6+ QVBoxLayout* layout = new QVBoxLayout;
7+ QLabel* label = new QLabel (" Drag & drop files here" );
238
249 QFont font = this ->font ();
2510 font.setPointSize (16 );
26- setFont (font);
11+ label->setFont (font);
12+
13+ label->setAlignment (Qt::AlignCenter); // Set alignment to center
14+
15+ layout->addWidget (label, 0 , Qt::AlignCenter);
16+
17+ setLayout (layout);
18+ setAcceptDrops (true );
2719}
2820
2921void DropArea::dragEnterEvent (QDragEnterEvent* event) {
@@ -36,13 +28,6 @@ void DropArea::dropEvent(QDropEvent* event) {
3628 return ;
3729 }
3830
39- // QString fileName = urls.first().toLocalFile();
40- // if (fileName.isEmpty()) {
41- // return;
42- // }
43-
44- // Processing
45-
4631 bool success = doProcessing (urls);
4732
4833 qDebug () << " Done!" ;
@@ -51,12 +36,31 @@ void DropArea::dropEvent(QDropEvent* event) {
5136}
5237
5338MainWindow::MainWindow () {
54- DropArea* dropArea = new DropArea;
55- dropArea->setFixedSize (400 , 400 ); // Set the size of the drop area
56- setCentralWidget (dropArea);
39+ QVBoxLayout* layout = new QVBoxLayout; // Create a vertical layout
5740
58- setWindowFlags (Qt::WindowStaysOnTopHint);
59- setWindowTitle (" Solidify 1.22" );
41+ DropArea* dropArea = new DropArea;
42+ // dropArea->setFixedSize(400, 380); // Set the size of the drop area
43+ // set size of drop area to fill layout area
44+ dropArea->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Expanding);
45+ dropArea->setAutoFillBackground (true ); // Fill the background with the color below
46+ dropArea->setStyleSheet (" border-radius: 3px; background-color: #E0E0E0; margin-bottom: 4px;" );
47+
48+ layout->addWidget (dropArea); // Add the drop area to the layout
49+
50+ QProgressBar* progressBar = new QProgressBar;
51+ progressBar->setFixedHeight (20 );
52+ progressBar->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Fixed);
53+ progressBar->setRange (0 , 100 );
54+ // progressBar->setValue(75);
55+ progressBar->setTextVisible (false );
56+ progressBar->setStyleSheet (
57+ " QProgressBar {border: 0px solid black; border-radius: 3px; background-color: white; color: black;}"
58+ " QProgressBar::chunk {background-color: #05B8CC;}" );
59+ layout->addWidget (progressBar); // Add the progress bar to the layout
60+
61+ QWidget* centralWidget = new QWidget;
62+ centralWidget->setLayout (layout); // Set the layout for the central widget
63+ setCentralWidget (centralWidget); // Set the central widget of the MainWindow
6064
6165 QMenuBar* menuBar = new QMenuBar;
6266 QMenu* f_menu = new QMenu (" Files" , menuBar);
@@ -69,6 +73,10 @@ MainWindow::MainWindow() {
6973 menuBar->addMenu (r_menu);
7074 setMenuBar (menuBar);
7175
76+ setWindowFlags (Qt::WindowStaysOnTopHint);
77+ setWindowTitle (" Solidify 1.22" );
78+ setFixedSize (400 , 400 );
79+
7280 // Connect the Exit action's triggered signal to QApplication's quit slot
7381 connect (f_Exit, &QAction::triggered, qApp, &QApplication::quit);
7482
0 commit comments