QBarSet; SetLabelColor & SetLabelFont don't work. Qt failure?
-
Hello community, (I Use Qt 5.11.2 on Windows with msvc15)
I would like to adjust the Font style and the size in aQBarSet.
From the beginning the simplest settings don't workI tried the next code:
set2 = new QBarSet("MyText", this); QFont myDesiredText = QString("my_Desired_Text"); myDesiredText.setPointSize(2); myDesiredText.setBold(1); set2->setLabel("MySecondText"); //work set2->setLabelColor(Qt::red); //don't work set2->setLabelFont(myDesiredText); //don't workThe Label shoes at the end "MySecond text".
I think that's an issue in Qt or perhaps I did't make the things fine.
Please, could somebody show me how to configure the font type and its size in a QBarset?
(I googled, but not successfully)thanks in advance.
-
Hello community, (I Use Qt 5.11.2 on Windows with msvc15)
I would like to adjust the Font style and the size in aQBarSet.
From the beginning the simplest settings don't workI tried the next code:
set2 = new QBarSet("MyText", this); QFont myDesiredText = QString("my_Desired_Text"); myDesiredText.setPointSize(2); myDesiredText.setBold(1); set2->setLabel("MySecondText"); //work set2->setLabelColor(Qt::red); //don't work set2->setLabelFont(myDesiredText); //don't workThe Label shoes at the end "MySecond text".
I think that's an issue in Qt or perhaps I did't make the things fine.
Please, could somebody show me how to configure the font type and its size in a QBarset?
(I googled, but not successfully)thanks in advance.
Try to change the sequence and use use larger point size for a start e.g.:
set2 = new QBarSet("MyText", this); QFont myDesiredText = QString("my_Desired_Text"); myDesiredText.setPointSize(12); myDesiredText.setBold(true); set2->setLabelColor(Qt::red); set2->setLabelFont(myDesiredText); set2->setLabel("MySecondText"); -
Try to change the sequence and use use larger point size for a start e.g.:
set2 = new QBarSet("MyText", this); QFont myDesiredText = QString("my_Desired_Text"); myDesiredText.setPointSize(12); myDesiredText.setBold(true); set2->setLabelColor(Qt::red); set2->setLabelFont(myDesiredText); set2->setLabel("MySecondText");@koahnig Thank you very much
Sadly didn't work.
I tried:
set2 = new QBarSet("MyText", this); QFont myDesiredText = QString("my_Desired_Text"); myDesiredText.setPointSize(12); myDesiredText.setBold(true); set2->setLabelColor(Qt::red); set2->setLabelFont(myDesiredText);and the label shows "MyText" of the first line :-(
-
@koahnig Thank you very much
Sadly didn't work.
I tried:
set2 = new QBarSet("MyText", this); QFont myDesiredText = QString("my_Desired_Text"); myDesiredText.setPointSize(12); myDesiredText.setBold(true); set2->setLabelColor(Qt::red); set2->setLabelFont(myDesiredText);and the label shows "MyText" of the first line :-(
-
@koahnig Thank you very much
Sadly didn't work.
I tried:
set2 = new QBarSet("MyText", this); QFont myDesiredText = QString("my_Desired_Text"); myDesiredText.setPointSize(12); myDesiredText.setBold(true); set2->setLabelColor(Qt::red); set2->setLabelFont(myDesiredText);and the label shows "MyText" of the first line :-(
@Josz said in QBarSet; SetLabelColor & SetLabelFont don't work. Qt failure?:
QFont myDesiredText = QString("my_Desired_Text");
what do you expect that this line does?
Is there a font namedmy_Desired_Text?!Also you may want to try
setLabelBrush(Qt::red) -
@Josz said in QBarSet; SetLabelColor & SetLabelFont don't work. Qt failure?:
QFont myDesiredText = QString("my_Desired_Text");
what do you expect that this line does?
Is there a font namedmy_Desired_Text?!Also you may want to try
setLabelBrush(Qt::red)@raven-worx Thanks raven
I tried
set2 = new QBarSet("MyText", this); QFont *font = new QFont("Helvetica",13,13,true); //font->setPixelSize(2); set2->setLabelFont(*font); set2->setLabelBrush(Qt::red); set2->setLabel("MySecondText");don't works either :-(