diff --git a/main.cpp b/main.cpp index 2647b84..881215d 100644 --- a/main.cpp +++ b/main.cpp @@ -1,6 +1,4 @@ #include "qtsgraph.h" -using namespace Qt; -using namespace std; int main(int argc, char *argv[]) { diff --git a/qtSimpleGraph.pro b/qtSimpleGraph.pro index fd94d6c..8cb006a 100644 --- a/qtSimpleGraph.pro +++ b/qtSimpleGraph.pro @@ -17,8 +17,7 @@ HEADERS += \ FORMS += -TRANSLATIONS += \ - qtSimpleGraph_ru_RU.ts +TRANSLATIONS += # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin diff --git a/qtSimpleGraph_ru_RU.ts b/qtSimpleGraph_ru_RU.ts deleted file mode 100644 index 892d343..0000000 --- a/qtSimpleGraph_ru_RU.ts +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/qtsgraph.cpp b/qtsgraph.cpp index d9b8819..8dac4a3 100644 --- a/qtsgraph.cpp +++ b/qtsgraph.cpp @@ -70,6 +70,10 @@ QTSGraph::QTSGraph(int w, int h, int x, int y, QWidget *parent) y = center.y() - h / 2; } this->setGeometry(x, y, w, h); + this->setMinimumHeight(h); + this->setMinimumWidth(w); + this->setMaximumHeight(h); + this->setMaximumWidth(w); this->setWindowTitle("Рисунок"); Canvas = QPixmap(w, h); Canvas.fill(Qt::white); @@ -171,7 +175,12 @@ void QTSGraph::Rectangle(int x1, int y1, int x2, int y2) update(); } -void QTSGraph::SetColor(QRgb c) +void QTSGraph::SetColor(const QColor &c) +{ + Pen.setColor(c); +} + +void QTSGraph::SetColor(const QRgb c) { Pen.setColor(QColor(c)); } diff --git a/qtsgraph.h b/qtsgraph.h index 7610e50..1c3cd11 100644 --- a/qtsgraph.h +++ b/qtsgraph.h @@ -81,7 +81,8 @@ public: int ReadKey(); int ReadMouseButton(); void Rectangle(int x1, int y1, int x2, int y2); - void SetColor(QRgb c); + void SetColor(const QColor &c = Qt::black); + void SetColor(const QRgb c = 0x00000000); void SetFillStyle(int Pattern, QRgb Color); // Стиль и цвет заливки /* 0 - NoBrush diff --git a/screenshots/line-color-penstyle.png b/screenshots/line-color-penstyle.png new file mode 100644 index 0000000..8aee6bb Binary files /dev/null and b/screenshots/line-color-penstyle.png differ