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. Text obscured after I reimplement QDoubleSpinBox::sizeHint() and QDoubleSpinBox::minimumSizeHint()
Forum Updated to NodeBB v4.3 + New Features

Text obscured after I reimplement QDoubleSpinBox::sizeHint() and QDoubleSpinBox::minimumSizeHint()

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 661 Views 1 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.
  • G Offline
    G Offline
    GriffithLea
    wrote on last edited by
    #1

    I have come across a class derived from QDoubleSpinBox that in its ctor sets the range to negative max double <-> positive max double. I could change that, but it means I will have to test thousands of instances of this class. The problem is when this class is used in Qt5.4.0, the width component of the sizeHint() of the spinbox is thousands of pixels wide. This is not the case in Qt4. I guess it's because of the setRange to include all possible doubles.

    I reimplemented sizeHint() and minimumSizeHint(), and that works great, EXCEPT that now, when the user spins the box or types in values, the resulting value disappears. It will reappear if you use left/right arrow or click with the mouse.

    Is there a non-invasive solution to this secondary problem?

    1 Reply Last reply
    0
    • G Offline
      G Offline
      GriffithLea
      wrote on last edited by
      #2

      Ha! I figured out the problem. This effort is all part of a port from Qt4 to Qt5, and there are other issues beside the one I was addressing. What I was seeing must be some issue with style (I had already noticed I wasn't getting the style I expected) and the text was being rendered white on a white background when the underlying QLineEdit's selectAll() slot was called.

      So, my reimplementation of sizeHint() and minimumSizeHint() are fine, and had nothing to do with the effect I was seeing (I was able to replicate it without my fix). My fix in Qt4 works fine, but of course isn't necessary there.

      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