3

I do have the following code:

  Address = new QLCDNumber(this);
  Address->setDigitCount(4);
  Address->setSegmentStyle(QLCDNumber::Flat);
  Address->display(mValue);
  mainLayout->addWidget(Address);

  Value = new QLCDNumber(this);
  Value->setDigitCount(8);
  Value->setSegmentStyle(QLCDNumber::Flat);
  Value->display(mValue);
  mainLayout->addWidget(Value);

And the result is shown below. I see the only difference in the number of digits. If I change the number of digits for the first QLCDNumber to 6, it also gets thinner. How can I make the second, 8-digit number better visible?

enter image description here

Tarod
  • 6,732
  • 5
  • 44
  • 50
katang
  • 2,474
  • 5
  • 24
  • 48
  • 2
    If it is possible in your design, you could try to change the size of `Value`. It has the same size as `Address` but it can show more digits so Qt resize the digits accordingly. For example, try this: `Value->setMinimumSize(QSize(200,200));` – Tarod Mar 03 '16 at 13:32
  • I defined the size !only! defining the number of the digits, and expected that Qt will do the rest. – katang Mar 03 '16 at 14:02
  • Well, Qt resizes the widgets depending on your layouts if you don't set the size. [Example](https://gist.github.com/ftena/dd803188d027a7b40058). – Tarod Mar 03 '16 at 14:24

1 Answers1

2
  Value = new QLCDNumber(this);
  Value->setMinimumWidth(Value->width()+1);

solves the problem, so I guess it is a kind of rounding error in the QLCDNumber size (or segment shape?) calculating algorithm.

katang
  • 2,474
  • 5
  • 24
  • 48