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?

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
  • 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 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
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on 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
      4
      • SGaistS SGaist

        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 last edited by
        #3

        @SGaist v stands as Volts

        mrjjM 1 Reply Last reply
        0
        • T thippu

          @SGaist v stands as Volts

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on 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.HilkJ Offline
            J.HilkJ Offline
            J.Hilk
            Moderators
            wrote on 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.

            mrjjM 1 Reply Last reply
            2
            • J.HilkJ J.Hilk

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

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on 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
              1
              • mrjjM mrjj

                @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 last edited by
                #7

                thank u all

                1 Reply Last reply
                0

                • Login

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