Bug #13872
openWCompositeWidget does not Apply Style classes from Implementation class
0%
Description
Only Tested with WPanel implementation so far.
Making a WCompositeWidget implement a WPanel, the Panel Specific style classes are not added.
Making it collapsible: it works, but there is no indicator: the Collapse Button is not visible.
It does not even look like a WPanel or "card" at all.
Unless this is desired behaviour, but I do not think so
Sample Code WPanel in Contrast
Files
MV Updated by Matthias Van Ceulebroeck about 1 year ago
- Assignee set to Matthias Van Ceulebroeck
- Target version set to 4.12.3
Hello Christian,
this is a VERY good catch. No theming is ever applied to the WPanel.
This could be the case for any widget that is set as the WCompositeWidget's implementation. I am however sure I have seen this work for certain other widgets, and am curious as to what the discrepancy is.
CM Updated by Christian Meyer about 1 year ago
Hi Matthias
The Wt- Internal Composite Widgets (like WPanel) work as expected. Because they are a Special Type that is handled in the Theme.
It is different for User Generated Composites.
From what I could figure out, I wrote a Patch, but it really is not a longterm, global solution.
It just targets WBootstrap5Theme, making its apply() function a friend of WCompositeWidget, and in the apply() function, change the widget to the implementation() of the composite Widget.
CM Updated by Christian Meyer about 1 year ago
I made a way better patch...
I added a function to WCompositeWidget to check if the impl_ widget can be cast to a Type:
template <typename T>
bool canCastTo() const {
if (!impl_) {
return false; // Cannot cast if no implementation widget exists
}
// Perform the dynamic_cast and check if it succeeds
return dynamic_cast<T>(impl_.get()) != nullptr;
}
There are concepts for the future, and also static_asserts to make sure the type fits. (left out here)
Within the ::apply() functions of the Bootstrap and Css Theme Classes, I added a check to see if it is a composite:
WCompositeWidget *composite = dynamic_cast<WCompositeWidget*>(widget);
auto panel = dynami_cast<WPanel*>(widget);
if(panel || (composite && composite->canCastTo<WPanel*>()))
{
... // Apply Style
}
Updated the ::apply() Function for WCSSTheme as well as Bootstrap 2, 3 & 5
CM Updated by Christian Meyer about 1 year ago
Aparrently my last Patch had Windows Line Endings (CRLF), which failed my own patching...
converting to Linux Line Endings (LF) fixed that ...
CM Updated by Christian Meyer about 1 year ago
Fixed Patch for 4.12.0
With the support for native Style classes, my proposed solution does not work for DateEdit and TimeEdit Implementations anymore
RM Updated by Romain Mardulyn 7 months ago
- Target version changed from 4.12.3 to 4.12.4
RM Updated by Romain Mardulyn 6 months ago
- Target version changed from 4.12.4 to 4.12.6
RM Updated by Romain Mardulyn 6 months ago
- Target version changed from 4.12.6 to 4.13.0
RM Updated by Romain Mardulyn 5 months ago
- Target version changed from 4.13.0 to 4.14.0
RM Updated by Romain Mardulyn about 2 months ago
- Target version changed from 4.14.0 to 4.15.0
ED Updated by emil de keyser 29 days ago
- Assignee deleted (
Matthias Van Ceulebroeck)
ED Updated by emil de keyser 21 days ago
- Status changed from New to InProgress
- Assignee set to emil de keyser
ED Updated by emil de keyser 21 days ago
- Status changed from InProgress to Review
- Assignee deleted (
emil de keyser)
RM Updated by Romain Mardulyn 21 days ago
- Assignee set to Romain Mardulyn
RM Updated by Romain Mardulyn 1 day ago
- Status changed from Review to Resolved
- Assignee changed from Romain Mardulyn to emil de keyser
RM Updated by Romain Mardulyn 1 day ago
- Status changed from Resolved to InProgress
RM Updated by Romain Mardulyn 1 day ago
- Status changed from InProgress to Review
- Assignee changed from emil de keyser to Romain Mardulyn