From 3ce75bb5e326d268869ab1de2157334d8fdd9d2b Mon Sep 17 00:00:00 2001 From: gambas Date: Wed, 27 Jan 2021 02:38:59 +0100 Subject: [PATCH] Rework support of Background and Foreground colors. [GB.QT4] * BUG: Rework support of Background and Foreground colors. [GB.QT5] * BUG: Rework support of Background and Foreground colors. --- gb.qt4/src/CCheckBox.cpp | 2 +- gb.qt4/src/CRadioButton.cpp | 2 +- gb.qt4/src/CWidget.cpp | 48 +++++++------------------------------ 3 files changed, 10 insertions(+), 42 deletions(-) diff --git a/gb.qt4/src/CCheckBox.cpp b/gb.qt4/src/CCheckBox.cpp index a14b3ce41..adc14a746 100644 --- a/gb.qt4/src/CCheckBox.cpp +++ b/gb.qt4/src/CCheckBox.cpp @@ -83,7 +83,7 @@ BEGIN_METHOD(CCHECKBOX_new, GB_OBJECT parent) wid->setMinimumHeight(wid->sizeHint().height()); CWIDGET_new(wid, (void *)_object); - THIS->widget.flag.fillBackground = CSTYLE_fix_breeze; + THIS->widget.flag.fillBackground = true; //CSTYLE_fix_breeze; END_METHOD diff --git a/gb.qt4/src/CRadioButton.cpp b/gb.qt4/src/CRadioButton.cpp index 97028bdf9..5477dc72f 100644 --- a/gb.qt4/src/CRadioButton.cpp +++ b/gb.qt4/src/CRadioButton.cpp @@ -84,7 +84,7 @@ BEGIN_METHOD(RadioButton_new, GB_OBJECT parent) QObject::connect(wid, SIGNAL(toggled(bool)), &CRadioButton::manager, SLOT(clicked(bool))); CWIDGET_new(wid, (void *)_object); - THIS->widget.flag.fillBackground = CSTYLE_fix_breeze; + THIS->widget.flag.fillBackground = true; CSTYLE_fix_breeze; END_METHOD diff --git a/gb.qt4/src/CWidget.cpp b/gb.qt4/src/CWidget.cpp index da65b5de3..8a3ae88f1 100644 --- a/gb.qt4/src/CWidget.cpp +++ b/gb.qt4/src/CWidget.cpp @@ -138,40 +138,6 @@ static void set_mouse(QWidget *w, int mouse, void *cursor) } } -/*static void set_design_object(CWIDGET *_object) -{ - if (CWIDGET_test_flag(THIS, WF_DESIGN)) - return; - - //qDebug("%s %p (%p): DESIGN", GB.GetClassName(THIS), THIS, WIDGET); - CWIDGET_set_flag(THIS, WF_DESIGN); - - CWidget::removeFocusPolicy(WIDGET); - set_mouse(WIDGET, CMOUSE_DEFAULT, 0); - //THIS->flag.fillBackground = true; -} - -static void set_design_recursive(QWidget *w, bool set = false) -{ - QObjectList children; - int i; - QObject *child; - CWIDGET *ob = CWidget::getReal(w); - - if (ob) - set_design_object(ob); - - children = w->children(); - - for (i = 0; i < children.count(); i++) - { - child = children.at(i); - - if (child->isWidgetType()) - set_design_recursive((QWidget *)child, true); - } -}*/ - void CWIDGET_set_design(CWIDGET *_object, bool ignore) { if (THIS->flag.design) @@ -1496,7 +1462,7 @@ void CWIDGET_reset_color(CWIDGET *_object) if (!THIS_EXT || (THIS_EXT->bg == COLOR_DEFAULT && THIS_EXT->fg == COLOR_DEFAULT)) { w->setPalette(QPalette()); - w->setAutoFillBackground(!THIS->flag.noBackground && THIS->flag.fillBackground); + w->setAutoFillBackground(false); //!THIS->flag.noBackground && THIS->flag.fillBackground); } else { @@ -1553,22 +1519,24 @@ void CWIDGET_reset_color(CWIDGET *_object) palette.setColor(QPalette::Button, TO_QCOLOR(bg)); } else*/ - palette.setColor(w->backgroundRole(), TO_QCOLOR(bg)); + palette.setColor(w->backgroundRole(), TO_QCOLOR(bg)); + w->setAutoFillBackground(!THIS->flag.noBackground && (THIS->flag.fillBackground || w->backgroundRole() == QPalette::Window)); } + else + w->setAutoFillBackground(false); if (fg != COLOR_DEFAULT) { - if (GB.Is(THIS, CLASS_Container)) + //if (GB.Is(THIS, CLASS_Container)) { palette.setColor(QPalette::Text, TO_QCOLOR(fg)); palette.setColor(QPalette::WindowText, TO_QCOLOR(fg)); palette.setColor(QPalette::ButtonText, TO_QCOLOR(fg)); } - else - palette.setColor(w->foregroundRole(), TO_QCOLOR(fg)); + //else + //palette.setColor(w->foregroundRole(), TO_QCOLOR(fg)); } - w->setAutoFillBackground(!THIS->flag.noBackground && (THIS->flag.fillBackground || ((THIS_EXT && THIS_EXT->bg != COLOR_DEFAULT) && w->backgroundRole() == QPalette::Window))); w->setPalette(palette); }