octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #48446] uicontrols extent is incorrect


From: Pantxo Diribarne
Subject: [Octave-bug-tracker] [bug #48446] uicontrols extent is incorrect
Date: Sat, 8 Sep 2018 06:58:57 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0

Follow-up Comment #9, bug #48446 (project octave):

@gyom: My approach would be to add a virtual method to the BaseControl class
(e.g. BaseControl::update_text_extent) and let BaseControl::update call it
when the font changes and style specific StyleControl::update methods call it
when the string itself changes.

BaseControl::update_text_extent would use QFontMetrics::boundingRect [1] to
get the bounding box of the text contained in the "string" property and then
set the uicontrol object's "__extent__" property (which you should add in
graphics.in.h). If some special treatment is needed, depending on the
uicontrol style, then BaseControl::update_text_extent can be overloaded in the
style specific class (SliderControl, ToggleButtonControl, ...).

Then you could eliminate uicontrol::properties::update_text_extent() and let
uicontrol::properties::get_extent use __extent__ instead of extent.
 

[1] https://doc.qt.io/qt-5/qfontmetrics.html#boundingRect-1

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?48446>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]