Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. how to keep good quality of label in terms of pixel while changing the font Size?

how to keep good quality of label in terms of pixel while changing the font Size?

Scheduled Pinned Locked Moved Unsolved General and Desktop
qlabelqwtqfontqstyleqstylesheet
11 Posts 4 Posters 2.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    Y Offline
    Yash001
    wrote on 2 Jul 2018, 18:14 last edited by Yash001 7 Feb 2018, 18:20
    #1

    The pixel of the axis label is broken while set specific size of the label font size.
    How can I set the label, which is look good at any size of the font?

    font size :18px;
    0_1530554500033_088872a0-0263-43f3-b9da-6ced42da81e4-image.png

    fontsize:19px;
    0_1530554822665_8e50d215-906c-45af-abf8-aa1268948672-image.png

    font size :17px
    0_1530555107240_ce69be76-518e-4051-a688-949a578258d3-image.png

    font size: 14px;
    0_1530555168013_d9dad9b9-f5f4-4900-80cd-cc0d9ea7a0a9-image.png

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 2 Jul 2018, 20:11 last edited by
      #2

      Hi,

      What font are you using ?
      How are you using it ?
      What version of Qt ?
      What platform are you running on ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      Y 1 Reply Last reply 2 Jul 2018, 20:42
      0
      • S SGaist
        2 Jul 2018, 20:11

        Hi,

        What font are you using ?
        How are you using it ?
        What version of Qt ?
        What platform are you running on ?

        Y Offline
        Y Offline
        Yash001
        wrote on 2 Jul 2018, 20:42 last edited by Yash001 7 Feb 2018, 20:42
        #3

        @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);
        		
        	});
        
        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 2 Jul 2018, 22:03 last edited by
          #4

          In that case, you should rather contact the authors of the Qwt library. They will be likely better suited to answer this question.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          Y U 2 Replies Last reply 2 Jul 2018, 22:31
          1
          • S SGaist
            2 Jul 2018, 22:03

            In that case, you should rather contact the authors of the Qwt library. They will be likely better suited to answer this question.

            Y Offline
            Y Offline
            Yash001
            wrote on 2 Jul 2018, 22:31 last edited by
            #5

            @SGaist Thank You Sir. I will contact Qwt library authors.

            1 Reply Last reply
            0
            • S SGaist
              2 Jul 2018, 22:03

              In that case, you should rather contact the authors of the Qwt library. They will be likely better suited to answer this question.

              U Offline
              U Offline
              uwer
              wrote on 3 Jul 2018, 05:58 last edited by
              #6

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

              1 Reply Last reply
              1
              • S Offline
                S Offline
                SGaist
                Lifetime Qt Champion
                wrote on 3 Jul 2018, 21:32 last edited by
                #7

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

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                Y 1 Reply Last reply 3 Jul 2018, 23:27
                0
                • M Offline
                  M Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on 3 Jul 2018, 22:17 last edited by
                  #8

                  hi
                  I dont know about QWt but if we are talking QPainter
                  it really looks like its missing
                  painter.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing);
                  ?

                  1 Reply Last reply
                  1
                  • S SGaist
                    3 Jul 2018, 21:32

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

                    Y Offline
                    Y Offline
                    Yash001
                    wrote on 3 Jul 2018, 23:27 last edited by
                    #9

                    @SGaist I can not update the QT version for window system. But I will update Qt version for MAC system and let you know.

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on 4 Jul 2018, 22:08 last edited by
                      #10

                      Testing on a more recent version doesn't mean that you have to remove your current version.

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      Y 1 Reply Last reply 6 Jul 2018, 00:23
                      3
                      • S SGaist
                        4 Jul 2018, 22:08

                        Testing on a more recent version doesn't mean that you have to remove your current version.

                        Y Offline
                        Y Offline
                        Yash001
                        wrote on 6 Jul 2018, 00:23 last edited by Yash001 7 Jun 2018, 00:24
                        #11

                        @SGaist got it.

                        1 Reply Last reply
                        0

                        10/11

                        4 Jul 2018, 22:08

                        • Login

                        • Login or register to search.
                        10 out of 11
                        • First post
                          10/11
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved