Hover over header of a tableView columns - hover

I have a simple TableView with 4 TableViewColumns, I'm not usually working with qml, so I'm not really sure how to work properly inside this code.
What I want is that I need a mouse-over the TableView headers (column names). I checked all over and did not found any of a certain simple solution to my problem.
I have tried to use a tool-tip inside the TableVIewColumn but it never shows up, and I have seen that Mouse Area is not supported inside the TableViewColumn. Maybe the solution is simple but I am not aware of it for
the moment.
Rectangle {
width: parent.width
height: parent.height
TableView {
id: table
width: parent.width
height: parent.height
headerVisible: true
TableViewColumn {
id: time
role: "t-stamp"
title: "Time"
width: 60
}
TableViewColumn {
id: d
role: "id"
title: "SignId"
width: 40
}
TableViewColumn {
id: sid
role: "s-id"
title: "StratId"
width: 50
}
TableViewColumn {
id: stratname
role: "strat_name"
title: "StratName"
width: 200
}
Connections{
target: MessageTabelModel
onUpdateView:{
table.resizeColumnsToContents()
}
}
model: MessageTabelModel
}
}

TableView has a headerDelegate property that contains mouse information:
In the header delegate you have access to the following special
properties:
styleData.value - the value or text for this item
styleData.column -
the index of the column
styleData.pressed - true when the column is
being pressed
styleData.containsMouse - true when the column is under
the mouse
styleData.textAlignment - the horizontal text alignment of
the column (since QtQuickControls 1.1)
So you can use styleData.containsMouse for your needs, for example with a simple basic text:
headerDelegate: Text {
color: styleData.containsMouse ? "red" : "black"
text: styleData.value
// ...
}
Or if you want more customization:
headerDelegate: Rectangle {
height: 20
implicitWidth: headerText.paintedWidth
border.color: "black"
// ...
Text {
id: headerText
color: styleData.containsMouse ? "red" : "black"
text: styleData.value
anchors.fill: parent
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
}
}

Related

Tippyjs initial placement is wrong

I'm using tippy to create responsive (position-aware) dropdowns. I have the following options:
tippy(this.inputEl, {
content: this.dropdown,
allowHtml: true,
trigger: 'manual',
...,
placement: 'bottom-start',
popperOptions: {
modifiers: [
{
name: 'flip',
fallbackPlacements: ['bottom-end', 'bottom-start', 'top-end', 'top-start']
}
]
}
});
The problem is that the initial placement is incorrect on small screens. It shows the dropdown always on bottom-start. After scrolling, it renders the dropdown correctly.
I tired to call update on the popperInstance after I show the dropdown, but it didn't work.

Why class returned in eventClassNames of V5 is not applied?

With fullcalendar v5.7.2 in Alpinejs 2 app I want to set different color for cells depending
on some property and reading here https://fullcalendar.io/docs/classname-input
I catch event :
dayMaxEvents: true,
views: {
dayGridMonth: {
editable: false
}
},
events: function (info, successCallback, failureCallback) { //get data from db for selected dates
self.select_year = parseInt(moment(info.start).format('YYYY'))
self.select_month = parseInt(moment(info.start).format('MM'))
var dataArray = {
'_token': '{{ $csrf_token }}',
'start': moment(info.start).format('YYYY-MM-DD'),
'end': moment(info.end).format('YYYY-MM-DD'),
'ad_categories': self.searchSelectedCategoryIds,
'users': self.searchSelectedUserIds,
'status': self.searchStatus,
'text': self.searchText
}
window.axios.post('/admin/get_ad_events', dataArray).then((response) => {
successCallback(response.data.events);
}).catch((error) => {
console.error(error)
failureCallback(error)
popupAlert('Calendar', 'Run time error : ' + getErrorMessage(error), 'error')
});
}, // events: function(info, successCallback, failureCallback) { //get data from db for selected dates
eventClassNames: function(arg) {
// return 'fullcalendar_nearest_days'; // if to uncomment this line it does not work anyway
if (arg.event.extendedProps.is_past) {
return [ 'fullcalendar_nearest_days' ]
} else {
return [ 'normal' ]
}
I check and see that fullcalendar_nearest_days is returned, but it is's properties are not applied
and checking events code I do not see “fullcalendar_nearest_days” in events styling...
Which way is correct ?
MODIFIED:
fullcalendar_nearest_days is defined as :
.fullcalendar_nearest_days {
background-color: red !important;
color: yellow !important;
font-weight: bold;
}
and looking at generated code I found that fullcalendar_nearest_days is the latest class in "a" tag class definition:
<div class="fc-daygrid-event-harness fc-daygrid-event-harness-abs"
style="visibility: hidden; top: 0px; left: 0px; right: 0px;"><a
class="fc-daygrid-event fc-daygrid-dot-event fc-event fc-event-draggable fc-event-resizable fc-event-start fc-event-end fc-event-past fullcalendar_nearest_days"
data-id="undefined"><span class="flex flex-nowrap"><
Can it be that properties of fullcalendar_nearest_days are not applied as they are overwritten by fc-daygrid-event fc-daygrid-dot-event fc-event fc-event-draggable fc-event-resizable fc-event-start fc-event-end fc-event-past ?
Can I remove all/part of these classes in "a" tag class definition for some dates?
Thanks!
I made a demo using your CSS - https://codepen.io/ADyson82/pen/zYwYxRp . There doesn't seem to be a problem for timed events, the class is applied to the correct events and the colours change as you'd expect.
However on all-day events the yellow colour is not applied. If you use the element inspector in your browser you can see what CSS rules are applied to each element and what is overriding them. You can see that the title is inside another div within the main element, which has fc-event-main class on it, and that class has a rule which overrides the color property again.
Fortunately we can solve this easily by adjusting the CSS rule to deal with that situation specifically:
.fullcalendar_nearest_days, .fullcalendar_nearest_days .fc-event-main {
background-color: red !important;
color: yellow !important;
font-weight: bold;
}
Working demo: https://codepen.io/ADyson82/pen/OJmJPEP

Stack extruded polygons in 3D with the ArcGIS API for JavaScript

I have polygon geometries and visualize them in 3D using a ExtrudeSymbol3DLayer, as described in the SDK documentation and the sample:
var symbol = {
type: "polygon-3d", // autocasts as new PolygonSymbol3D()
symbolLayers: [{
type: "extrude", // autocasts as new ExtrudeSymbol3DLayer()
size: 5, // 5 meters in height
material: { color: "red" }
}]
};
Is there any way to stack these 3D extrusions on top of each other? For example, if I have a geometry for New York City, I want to extrude from the bottom to about 5m in one color, and 5m to 10m in one color, etc etc. Kind of like making a stacked bar chart, but in a more geographic way. Any input would be appreciated!
This is possible by extruding the geometries and placing them at a certain height using the elevationInfo property on the layer. The below example is assuming you have a layer (e.g. FeatureLayer or GeoJSONLayer) with polygon geometries.
For the extrusion, tell the layer to render the polygons with a ExtrudeSymbol3DLayer. In the below code snippet, all polygons will have a height of 5 meters.
layer.renderer = {
type: "simple",
symbol: {
type: "polygon-3d",
symbolLayers: [
{
type: "extrude",
size: 5, // height in meters
material: {
color: "red"
}
}
]
}
}
After that you can make your extruded polygons fly by placing them at a certain elevation relative-to-ground. The below example will renderer all polygons 10 meters above ground.
layer.elevationInfo = {
mode: "relative-to-ground",
offset: 10,
unit: "meters"
}
The polygons will not yet appear stacked as they all have the same color, height and elevation from the ground. We basically want to have different values in the above code snippets for each of the polygons.
The following example code achieves this by adding
an Arcade expression for the elevationInfo
a VisualVariable for the extruded height of the polygon
a UniqueValueRenderer to use a different color for each polygon
They all depend on the attributes of the polygon feature and can therefore be tweaked by changing the values of the attributes.
// Make elevation offset depend on the attribute "elevation"
layer.elevationInfo = {
mode: "relative-to-ground",
featureExpressionInfo: {
expression: "$feature.elevation"
},
unit: "meters"
};
layer.renderer = {
type: "unique-value",
visualVariables: [
// Make the extrusion height depend on the attribute "height"
{
type: "size",
valueExpression: "$feature.height",
valueUnit: "meters"
}
],
// Make the color depend on the attribute "usage"
field: "usage",
uniqueValueInfos: [
{
value: "office",
symbol: {
type: "polygon-3d",
symbolLayers: [
{
type: "extrude",
material: {
color: "#D06152"
}
}
]
}
},
... // Add unique value info for each usage
]
};
Here is a running example showing a few extruded polygons in Central Park, NY.
https://codepen.io/arnofiva/pen/4071d4e79a3cb921f42d6a9e83f5b418?editors=1010

Widget for a foldable container in qml

What qml widget should I use to create a foldable container? I can't find it.
Example (from Qt Creator):
There is no out of the box widget in QML for that but it should be fairly easy to create it yourself. This is just a primitive example to show how easy it could be to do it but a proper reusable control might be implementend similar like https://doc.qt.io/qt-5/qml-qtquick-controls2-tabbar.html:
import QtQuick 2.11
Column {
width: 600
height: 600
Rectangle {
width: parent.width
height: 50
color: "darkgrey"
MouseArea {
anchors.fill: parent
onClicked: container.height = container.height ? 0 : 500
}
}
Rectangle {
id: container
width: parent.width
height: 500
color: "grey"
}
}

jqplot graph text color

I am working with jqplot and I am trying to achieve couple of things
I am trying to change the text color that appears along side x and y axis.
I am trying to remove the graph border (Top border and Right border only)
This is what my graph looks like
On xaxis you will notice the numbers 30 - 90 I need that to be in white and on y axis you will notice dates, i need that to be in white as well
This is what my JS looks like
var line2 = [
['1/1/2008', 42],
['2/14/2008', 56],
['3/7/2008', 39],
['4/22/2008', 81]
];
var plot2 = $.jqplot('progress_chart', [line2], {
seriesColors: [ "#F2A809"],
series:[
{
// Change our line width and use a diamond shaped marker.
lineWidth:5,
markerOptions: { style:'circle' }
}
],
grid:{
background: 'transparent', // CSS color spec for background color of grid.
borderColor: '#ffffff', // CSS color spec for border around grid.
borderWidth: 2.0 // pixel width of border around grid.
},
axes: {
xaxis: {
renderer: $.jqplot.DateAxisRenderer,
labelRenderer: $.jqplot.CanvasAxisLabelRenderer,
tickRenderer: $.jqplot.CanvasAxisTickRenderer,
shadowAlpha : '0.1',
tickOptions: {
// labelPosition: 'middle',
angle: 15,
showGridline: false,
color: '#ffffff'
}
},
yaxis: {
label: '',
labelRenderer: $.jqplot.CanvasAxisLabelRenderer,
tickOptions: {
showGridline: false
}
}
}
});
I will really appreciate any assistance here.
UPDATE
Thanks to #redditor answer I got it to work, however that was causing everything graph x and y axis text to turn white. This particular graph was inside another div called tab-inner-content so I got it to work using the following CSS.
.tab-inner-content .jqplot-target {
color:#ffffff !important;
}
replace
tickOptions: {
// labelPosition: 'middle',
angle: 15,
showGridline: false,
color: '#ffffff'
}
by
tickOptions: {
// labelPosition: 'middle',
angle: 15,
showGridline: false,
textColor: '#ffffff'
}
jqplot uses several CSS rules to create the various graph styles. It looks like the labels are controlled by the jqplot-target class, so you need something like:
.jqplot-target {
color:#fff;
}