Перегрузка SetColor для возможности использования констант из Qt

main
Артём Проскурнёв 3 years ago
parent 57b25940b8
commit c9e5b07b94
  1. 2
      main.cpp
  2. 3
      qtSimpleGraph.pro
  3. 3
      qtSimpleGraph_ru_RU.ts
  4. 11
      qtsgraph.cpp
  5. 3
      qtsgraph.h
  6. BIN
      screenshots/line-color-penstyle.png

@ -1,6 +1,4 @@
#include "qtsgraph.h"
using namespace Qt;
using namespace std;
int main(int argc, char *argv[])
{

@ -17,8 +17,7 @@ HEADERS += \
FORMS +=
TRANSLATIONS += \
qtSimpleGraph_ru_RU.ts
TRANSLATIONS +=
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin

@ -1,3 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="qtSimpleGraph_ru_RU"></TS>

@ -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));
}

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Loading…
Cancel
Save