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 display text and number on QLCDNumber class widget?
Forum Updated to NodeBB v4.3 + New Features

How to display text and number on QLCDNumber class widget?

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 4 Posters 5.3k Views 2 Watching
  • 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.
  • T Offline
    T Offline
    thippu
    wrote on 25 Apr 2018, 08:52 last edited by
    #1

    Hi,
    I have mainwindow.cpp
    In that I used QLCDNumber widget to display Number+Character.
    I want dispaly current value+'v'.
    But It does't display the characater 'v' what to do
    code:

    
    valx=new QLCDNumber(this);
       valx->setSegmentStyle(QLCDNumber::Flat);
       valx->setAutoFillBackground(true);
       valx->setFixedWidth(50);
       valx->setFixedHeight(25);
       valx->setFocusPolicy( Qt::WheelFocus );
       valx->setPalette(pal);
    
    //signals used to connect to display 
    connect(d_plot,SIGNAL( diffX(QString)),valx,SLOT(display(QString)));
       connect(d_plot,SIGNAL( diffY(QString)),valy,SLOT(display(QString)));
    
    

    plot.cpp code:

    //this methods are signalled to the mainwindow.cpp
     void Plot::calXY()
    {
         QPointF x1p=d_origin4->value();
         QPointF x2p=d_origin3->value();
         QPointF y1p=d_origin->value();
         QPointF y2p=d_origin2->value();
         diffX(QString::number((((x1p.x()))-((x2p.x())))));
         diffY((QString::number((((y1p.y()))-((y2p.y())))+'v')));//here 'v' concatinated to value  of the LCD label, SO why its not working?
    }
    
    
    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 25 Apr 2018, 09:57 last edited by
      #2

      Hi,

      QLCDNumber is designed to show numbers and only some letters as explained in the details of the class documentation. Therefore it might not be the best tool for your UI.

      What does your v letter stand for ?

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

      T 1 Reply Last reply 25 Apr 2018, 10:04
      4
      • S SGaist
        25 Apr 2018, 09:57

        Hi,

        QLCDNumber is designed to show numbers and only some letters as explained in the details of the class documentation. Therefore it might not be the best tool for your UI.

        What does your v letter stand for ?

        T Offline
        T Offline
        thippu
        wrote on 25 Apr 2018, 10:04 last edited by
        #3

        @SGaist v stands as Volts

        M 1 Reply Last reply 25 Apr 2018, 11:05
        0
        • T thippu
          25 Apr 2018, 10:04

          @SGaist v stands as Volts

          M Offline
          M Offline
          mrjj
          Lifetime Qt Champion
          wrote on 25 Apr 2018, 11:05 last edited by
          #4

          @thippu
          Hi
          its not using a font to draw the digits
          so its impossible for it to draw a V.
          You could just place a label close to it with the V.

          1 Reply Last reply
          4
          • J Offline
            J Offline
            J.Hilk
            Moderators
            wrote on 25 Apr 2018, 12:34 last edited by
            #5

            Or use an U that's a common smybol for the voltage as well, QLCDNumber should be able to display an U


            Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


            Q: What's that?
            A: It's blue light.
            Q: What does it do?
            A: It turns blue.

            M 1 Reply Last reply 25 Apr 2018, 12:52
            2
            • J J.Hilk
              25 Apr 2018, 12:34

              Or use an U that's a common smybol for the voltage as well, QLCDNumber should be able to display an U

              M Offline
              M Offline
              mrjj
              Lifetime Qt Champion
              wrote on 25 Apr 2018, 12:52 last edited by
              #6

              @J.Hilk
              It could look like that :)
              https://code.woboq.org/qt5/qtbase/src/widgets/widgets/qlcdnumber.cpp.html
              static const char *getSegments(char ch)

              T 1 Reply Last reply 26 Apr 2018, 04:48
              1
              • M mrjj
                25 Apr 2018, 12:52

                @J.Hilk
                It could look like that :)
                https://code.woboq.org/qt5/qtbase/src/widgets/widgets/qlcdnumber.cpp.html
                static const char *getSegments(char ch)

                T Offline
                T Offline
                thippu
                wrote on 26 Apr 2018, 04:48 last edited by
                #7

                thank u all

                1 Reply Last reply
                0

                1/7

                25 Apr 2018, 08:52

                • Login

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