diff --git a/src/mainwindow.ui b/src/mainwindow.ui index ce6be1e..06e5617 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -27,10 +27,25 @@ + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + - 2 + 0 QLayout::SetDefaultConstraint @@ -56,7 +71,7 @@ - 2 + 0 @@ -66,6 +81,9 @@ 5 + + IBeamCursor + @@ -81,6 +99,15 @@ 0 + + + Consolas + 10 + 50 + false + false + + ArrowCursor @@ -96,6 +123,12 @@ Start + + false + + + false + false @@ -112,6 +145,9 @@ Stop and Reset + + false + false @@ -120,7 +156,7 @@ - false + true font: 10pt "Consolas"; @@ -128,11 +164,29 @@ Pause + + false + + + false + + true + + + + Consolas + 10 + 50 + false + false + + + false @@ -141,6 +195,12 @@ Resume + + false + + + false + diff --git a/src/pentagonGen.cpp b/src/pentagonGen.cpp index 75a587c..0b72b18 100644 --- a/src/pentagonGen.cpp +++ b/src/pentagonGen.cpp @@ -8,6 +8,7 @@ pentagonGen::pentagonGen(QWidget* parent) : QWidget(parent) // start, it has something to draw Line line(Point(0, 0), Point(0, 0)); this->current_pentagon.push_back(line); + this->pixel_scaling = 0; } void pentagonGen::paintEvent(QPaintEvent* e) @@ -19,11 +20,12 @@ void pentagonGen::paintEvent(QPaintEvent* e) } // Make custom pen QPen pen; - pen.setWidth(3); + pen.setWidth(this->pixel_scaling); pen.setColor(QColor(42, 161, 152)); // Now draw the line to widget QPainter painter(this); - painter.fillRect(e->rect(), QColor(238, 232, 213)); // Background color + // painter.fillRect(e->rect(), QColor(238, 232, 213)); // Background color + painter.setRenderHint(QPainter::Antialiasing); painter.translate(150, 20); painter.setPen(pen); painter.drawLines(qtLines); @@ -34,6 +36,7 @@ void pentagonGen::updateLine(std::vector pentagon) /** * Update the current line so it can drawn on to the widget */ + this->pixel_scaling = 5; this->current_pentagon = pentagon; this->update(); // This function is inherited from Qt and it // repaints the widget automatically diff --git a/src/pentagonGen.hpp b/src/pentagonGen.hpp index 9ffa465..c78dadf 100644 --- a/src/pentagonGen.hpp +++ b/src/pentagonGen.hpp @@ -16,6 +16,7 @@ class pentagonGen : public QWidget private: std::vector current_pentagon; + int pixel_scaling; protected: void paintEvent(QPaintEvent* e) override; diff --git a/src/run_gui.cpp b/src/run_gui.cpp index 3fc25a2..73815df 100644 --- a/src/run_gui.cpp +++ b/src/run_gui.cpp @@ -9,17 +9,17 @@ int main(int argc, char* argv[]) { - qRegisterMetaType>("std::vector"); // This is very important, this is done to Make emitting Line possible - qRegisterMetaType>("std::list"); // This is very important, this is done to Make emitting Line possible + // Emitted types are registered here to make queued connections possible + qRegisterMetaType>("std::vector"); + qRegisterMetaType>("std::list"); + QApplication a(argc, argv); MainWindow w; - // Window settings w.setWindowTitle("Pentagonal Tiling - Visulization"); w.setWindowIcon(QIcon("favicon.ico")); - w.setStyleSheet("QMainWindow {background: rgb(147,161,161);}"); // Set background color - // After all this time w.show(); return a.exec(); + // Always } diff --git a/src/tilingGen.cpp b/src/tilingGen.cpp index 9c325b0..7ddf713 100644 --- a/src/tilingGen.cpp +++ b/src/tilingGen.cpp @@ -18,17 +18,19 @@ void tilingGen::paintEvent(QPaintEvent* e) { // Make custom pen QPen pen; - pen.setWidth(7); // Set width with floating point precision - pen.setColor(QColor(42, 161, 152)); + // pen.setWidthF(0.3); // Set width with floating point precision + pen.setWidth(7); + pen.setColor(QColor(211, 54, 130)); // Make a brush to fill the polygon QBrush fill; fill.setColor(QColor(148, 208, 203)); fill.setStyle(Qt::SolidPattern); QPainterPath canvas; QPainter painter(this); - painter.fillRect(e->rect(), QColor(238, 232, 213)); + // painter.fillRect(e->rect(), QColor(238, 232, 213)); + painter.setRenderHint(QPainter::Antialiasing); painter.setPen(pen); - painter.translate(100,100); + painter.translate(100, 100); painter.scale(0.6, 0.6); size_t count = 0; // Count the number of points appended to the polygon QPolygon polygon;