how to keep good quality of label in terms of pixel while changing the font Size?
-
Hi,
What font are you using ?
How are you using it ?
What version of Qt ?
What platform are you running on ? -
@SGaist Hi,
I am using font Segoe UI. I am working on Qt 5.6.0 & visual studio 2017 with window 64 bit system.
Here the code which I use for setting label of graph.
static QFont axisTitleFont("Segoe UI"); if (axisTitleFont.pixelSize() == -1) { axisTitleFont.setPixelSize(14); } axisTitleFont.setBold(false);
// create the Plot object.
QwtPlot *plot = OBJ_NAME(new QwtPlot(), "qwt-plot");
// set the label of yLeft axis
QwtText title; title.setFont(axisTitleFont); title.setText("Cuurent (mA)"); plot->setAxisTitle(QwtPlot::yLeft, title);
// change the font size
plotHandler.plotTabConnections << QObject::connect(m_mainWindow, &MainWindow::AxisFontSizeChange, [=](int fontSize) { axisTitleFont.setPixelSize(fontSize); //use for setting the lable on axis QwtText title; title.setFont(axisTitleFont); //set the lable on Y axis title.setText("Current(mA)"); handler.plot->setAxisTitle(QwtPlot::yLeft, title); });
-
In that case, you should rather contact the authors of the Qwt library. They will be likely better suited to answer this question.
-
@SGaist said in how to keep good quality of label in terms of pixel while changing the font Size?:
In that case, you should rather contact the authors of the Qwt library. They will be likely better suited to answer this question.
Ah no - this question goes to the font engine and how texts are rendered inside of Qt. The same issue will be there, when drawing with QPainter without Qwt.
-
@uwer fair enough, better first rule out that this comes from there :) This allows us to concentrate on the problem at hand.
@Yash001 First thing, can you test that on a more recent version of Qt ? Qt 5.6.0 is pretty old and not supported anymore so it would good to first check whether it's something that was fixed in between. If you need a LTS release for your project then please use Qt 5.9.
-
hi
I dont know about QWt but if we are talking QPainter
it really looks like its missing
painter.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing);
? -
Testing on a more recent version doesn't mean that you have to remove your current version.