23 #if defined (HAVE_CONFIG_H) 27 #include <QAbstractButton> 28 #include <QButtonGroup> 32 #include <QMouseEvent> 33 #include <QRadioButton> 53 if (pp.bordertype_is (
"none"))
54 return QFrame::NoFrame;
55 else if (pp.bordertype_is (
"etchedin"))
56 return (QFrame::Box | QFrame::Sunken);
57 else if (pp.bordertype_is (
"etchedout"))
58 return (QFrame::Box | QFrame::Raised);
59 else if (pp.bordertype_is (
"beveledin"))
60 return (QFrame::Panel | QFrame::Sunken);
61 else if (pp.bordertype_is (
"beveledout"))
62 return (QFrame::Panel | QFrame::Raised);
64 return (QFrame::Panel | QFrame::Plain);
70 p.setColor (QPalette::Window,
72 p.setColor (QPalette::WindowText,
74 p.setColor (QPalette::Light,
76 p.setColor (QPalette::Dark,
85 if (! pp.bordertype_is (
"none"))
88 if (pp.bordertype_is (
"etchedin") || pp.bordertype_is (
"etchedout"))
106 QFrame *
frame =
new QFrame (container);
116 :
Object (go,
frame), m_hiddenbutton(nullptr), m_container (nullptr),
117 m_title (nullptr), m_blockUpdates (
false)
121 frame->setObjectName (
"UIButtonGroup");
122 frame->setAutoFillBackground (
true);
128 QPalette pal =
frame->palette ();
130 frame->setPalette (pal);
139 if (
frame->hasMouseTracking ())
142 w->setMouseTracking (
true);
144 w->setMouseTracking (
true);
148 if (! title.isEmpty ())
151 m_title->setAutoFillBackground (
true);
152 m_title->setContentsMargins (4, 0, 4, 0);
157 frame->installEventFilter (
this);
160 if (pp.is_visible ())
162 QTimer::singleShot (0,
frame, SLOT (show (
void)));
163 QTimer::singleShot (0, buttongroup, SLOT (show (
void)));
182 switch (xevent->type ())
194 Utils::properties<uibuttongroup> (go);
196 if (pp.fontunits_is (
"normalized"))
198 QFrame *
frame = qWidget<QFrame> ();
201 (pp,
frame->height ()));
210 case QEvent::MouseButtonPress:
212 QMouseEvent *m =
dynamic_cast<QMouseEvent *
> (xevent);
214 if (m->button () == Qt::RightButton)
229 switch (xevent->type ())
232 if (qWidget<QWidget> ()->isVisible ())
253 QFrame *
frame = qWidget<QFrame> ();
259 case uibuttongroup::properties::ID_POSITION:
269 case uibuttongroup::properties::ID_BORDERWIDTH:
274 case uibuttongroup::properties::ID_BACKGROUNDCOLOR:
275 case uibuttongroup::properties::ID_FOREGROUNDCOLOR:
276 case uibuttongroup::properties::ID_HIGHLIGHTCOLOR:
277 case uibuttongroup::properties::ID_SHADOWCOLOR:
279 QPalette pal =
frame->palette ();
282 frame->setPalette (pal);
288 case uibuttongroup::properties::ID_TITLE:
292 if (title.isEmpty ())
302 QPalette pal =
frame->palette ();
305 m_title->setAutoFillBackground (
true);
306 m_title->setContentsMargins (4, 0, 4, 0);
321 case uibuttongroup::properties::ID_TITLEPOSITION:
325 case uibuttongroup::properties::ID_BORDERTYPE:
330 case uibuttongroup::properties::ID_FONTNAME:
331 case uibuttongroup::properties::ID_FONTSIZE:
332 case uibuttongroup::properties::ID_FONTWEIGHT:
333 case uibuttongroup::properties::ID_FONTANGLE:
342 case uibuttongroup::properties::ID_VISIBLE:
343 frame->setVisible (pp.is_visible ());
347 case uibuttongroup::properties::ID_SELECTEDOBJECT:
391 QFrame *
frame = qWidget<QFrame> ();
411 if (pp.titleposition_is (
"lefttop"))
413 else if (pp.titleposition_is (
"righttop"))
415 else if (pp.titleposition_is (
"leftbottom"))
417 else if (pp.titleposition_is (
"rightbottom"))
419 frame->height () -
sz.height ());
420 else if (pp.titleposition_is (
"centertop"))
422 else if (pp.titleposition_is (
"centerbottom"))
424 frame->height () -
sz.height ());
439 connect (btn, SIGNAL (toggled (
bool)), SLOT (
buttonToggled (
bool)));
453 QAbstractButton *checkedBtn =
m_buttongroup->checkedButton ();
459 newValue = checkedObj->
properties ().get___myhandle__ ();
462 if (oldValue != newValue)
478 QAbstractButton *checkedBtn =
m_buttongroup->checkedButton ();
482 if (oldValue != newValue)
485 eventData.
setfield (
"OldValue", oldValue.as_octave_value ());
487 eventData.
setfield (
"Source", bp.get___myhandle__ ().as_octave_value ());
488 eventData.
setfield (
"EventName",
"SelectionChanged");
492 selectionChangedEventObject);
static void setupPalette(const uibuttongroup::properties &pp, QPalette &p)
static void post_callback(const graphics_handle &h, const std::string &name, const octave_value &data=Matrix())
virtual void set(const caseless_str &, const octave_value &)
static int frameStyleFromProperties(const uibuttongroup::properties &pp)
QString fromStdString(const std::string &s)
void setfield(const std::string &key, const octave_value &val)
static Object * parentObject(const graphics_object &go)
virtual Container * innerContainer(void)=0
static int borderWidthFromProperties(const uibuttongroup::properties &pp)
void redraw(bool sync=false)
virtual void update_boundingbox(void)
static void executeAt(const base_properties &props, const QPoint &pt)
QColor fromRgb(const Matrix &rgb)
bool valid_object(void) const
template QFont computeFont< uibuttongroup >(const uibuttongroup::properties &props, int height)
std::complex< double > w(std::complex< double > z, double relerr=0)
octave_value as_octave_value(void) const
static Object * fromQObject(QObject *obj)
base_properties & get_properties(void)
octave_handle graphics_handle
virtual QObject * qObject(void)
graphics_object object(void) const
octave::unwind_protect frame
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))
static Object * toolkitObject(const graphics_object &go)
static graphics_object get_object(double val)
Canvas * canvas(const graphics_handle &handle, bool create=true)
base_properties & properties(void)
static void post_set(const graphics_handle &h, const std::string &name, const octave_value &value, bool notify_toolkit=true)