diff --git a/Graphs/gGraphView.cpp b/Graphs/gGraphView.cpp index 4fe7bd53..66f26ce4 100644 --- a/Graphs/gGraphView.cpp +++ b/Graphs/gGraphView.cpp @@ -1175,9 +1175,9 @@ void gGraph::qglColor(QColor col) m_graphview->qglColor(col); } -void gGraph::renderText(QString text, int x,int y, float angle, QColor color, QFont *font) +void gGraph::renderText(QString text, int x,int y, float angle, QColor color, QFont *font,bool antialias) { - m_graphview->AddTextQue(text,x,y,angle,color,font); + m_graphview->AddTextQue(text,x,y,angle,color,font,antialias); } void gGraph::paint(int originX, int originY, int width, int height) @@ -2252,7 +2252,7 @@ void gGraphView::DrawTextQue() painter.begin(pm); // Hmmm.. Maybe I need to be able to turn this on/off? - painter.setRenderHint(QPainter::TextAntialiasing, true); + painter.setRenderHint(QPainter::TextAntialiasing, q.antialias); QBrush b(q.color); @@ -2344,7 +2344,7 @@ void gGraphView::DrawTextQue() m_textque_items=0; } -void gGraphView::AddTextQue(QString & text, short x, short y, float angle, QColor color, QFont * font) +void gGraphView::AddTextQue(QString & text, short x, short y, float angle, QColor color, QFont * font,bool antialias) { #ifdef ENABLED_THREADED_DRAWING text_mutex.lock(); @@ -2362,6 +2362,7 @@ void gGraphView::AddTextQue(QString & text, short x, short y, float angle, QColo q.angle=angle; q.color=color; q.font=font; + q.antialias=antialias; } void gGraphView::addGraph(gGraph *g,short group) diff --git a/Graphs/gGraphView.h b/Graphs/gGraphView.h index 68aeedb1..53e7422e 100644 --- a/Graphs/gGraphView.h +++ b/Graphs/gGraphView.h @@ -249,6 +249,8 @@ struct TextQue QColor color; //! \variable a pointer to the QFont to use to draw this text QFont *font; + //! \variable whether to use antialiasing to draw this text + bool antialias; }; /*! \class MyScrollBar @@ -578,7 +580,7 @@ public: void qglColor(QColor col); //! \brief Queues text for gGraphView object to draw it. - void renderText(QString text, int x,int y, float angle=0.0, QColor color=Qt::black, QFont *font=defaultfont); + void renderText(QString text, int x,int y, float angle=0.0, QColor color=Qt::black, QFont *font=defaultfont,bool antialias=true); //! \brief Rounds Y scale values to make them look nice.. Applies the Graph Preference min/max settings. void roundY(EventDataType &miny, EventDataType &maxy); @@ -908,7 +910,7 @@ public: void selectionTime(); //! \brief Add the Text information to the Text Drawing Queue (called by gGraphs renderText method) - void AddTextQue(QString & text, short x, short y, float angle=0.0, QColor color=Qt::black, QFont * font=defaultfont); + void AddTextQue(QString & text, short x, short y, float angle=0.0, QColor color=Qt::black, QFont * font=defaultfont, bool antialias=true); //! \brief Draw all Text in the text drawing queue, via QPainter void DrawTextQue(); diff --git a/Graphs/gSegmentChart.cpp b/Graphs/gSegmentChart.cpp index 41c4cbe4..baa69108 100644 --- a/Graphs/gSegmentChart.cpp +++ b/Graphs/gSegmentChart.cpp @@ -145,7 +145,7 @@ void gSegmentChart::paint(gGraph & w,int left, int top, int width, int height) QString a=m_names[m]; //QString::number(floor(100.0/m_total*data),'f',0)+"%"; int x,y; GetTextExtent(a,x,y); - w.renderText(a,tpx-(x/2.0),(tpy+y/2.0)); + w.renderText(a,tpx-(x/2.0),(tpy+y/2.0),0,Qt::black,defaultfont,false); // antialiasing looks like crap here.. } sum=q;