SwiftUI search scope on macOS - search

I try to use search scopes in SwiftUI.
NavigationSplitView {
RoundsListView(viewModel: RoundsListViewModel(repElem: self.search))
#if os(tvOS)
.searchable(text: searchText,
placement: .automatic)
#else // not tvOS (iOS, macOS, Catalyst)
.searchable(text: searchText,
placement: .sidebar)
.searchScopes(searchScope) {
Text("All").tag(Search.Scope.all)
Text("Entry").tag(Search.Scope.entry)
}
#endif
#if os(iOS)
.navigationBarTitle("Search", displayMode: .inline)
#endif
} detail: {
EmptyView()
}
It works fine in iOS (though the scopes only show when there is a text in the search field, which could be seen as strange), but I can't get to have those scope buttons on macOS, should that be directly on macOS or Catalyst on Mac.
How to get the scope buttons on Mac ?

Related

React Hide Component when Mobile Keyboard open

I'm wondering if there is a way to hide React components (Ex. Bottom Navigation Bar Component) while the mobile (Andriod, iOS, etc. ) Keyboard is open on the screen.
Currently I'm doing it with a:
#media (max-height: 400px) {
.navclass {
display: none;
}
}
but am wondering if there is a JS Event or similar.
When am input element is focused on devices of inbuilt keyboards, the keyboards pops up.
ReactJS allows you to write Normal JavaScript in your code.so what you can do is to
this.state = {
isNavVisible: true
}
You can now pass this dynamically as a prop on the components and set it to the style of the wrappers element as an inline style in the components main file.
You can then write a function on your inputs or elements that takes focus:
const disableNav = () => {
if(windows.innerWidth <= 400){
this.setState({isNavVisible: false})
}
}

QtQuick: Creating menu from ListModel

i am new to the forum and i started designing several things in QtQuick.
I am still exploring and learning the basic stuff and i stumbled upon the following problem.
When i try to create a menu (menubar) from a ListModel using Listview, i simply dont get any menu at all.
Maybe i have still an misunderstanding about the principles and you can help me.
Here is my basic code:
import QtQuick 2.12
import QtQuick.Window 2.14
import QtQuick.Layouts 1.12
import QtQuick.Dialogs 1.3
import QtQuick.Controls 2.14
MenuBar{
id: menuBarId
ListModel{
id: listModelMenuId
ListElement {menuname: "Test1"}
ListElement {menuname: "Test2"}
}
ListView{
id: listViewMenuId
model: listModelMenuId
delegate: Menu {
id: menu
title: model.menuname
Action { text: qsTr("Tool Bar"); checkable: true }
Action { text: qsTr("Side Bar"); checkable: true; checked: true }
Action { text: qsTr("Status Bar"); checkable: true; checked: true;}
MenuSeparator {
contentItem: Rectangle {
implicitWidth: 200
implicitHeight: 1
color: "#21be2b"
}
}
Menu {
title: qsTr("Advanced")
}
topPadding: 2
bottomPadding: 2
// delegate: mydelegateid
background: Rectangle {
implicitWidth: 200
implicitHeight: 40
color: "#ffffff"
border.color: "#21be2b"
radius: 2
}
}} }
I got my sample from the qt site and tampered with it by adding the ListModel.
Also interesting is that if i want to refactor the original coding by using a component where i pack up the MenuItem and call the compoenent it also not works. Can it be that menus in general work different thand other Items?
If i left something important out just tell me, i'll add more information.
Best regards!
i resolved the issue.
Example to delegate your style in a MenuBar
This resolved the problem in general. However, i still wonder why i can not encapsulate the MenuItem into a component and use the components id to delegate the style for the items....
Regards,
Seryoga

Change color of selected TopTab border color

How can I change the color of this border.
I have tried using the following in options but that doesn't work.
topBar: {
borderColor: "white"
}
Which did try operation system ? ( Android / iOS ) (I'm using PhpStorm because I'm Full-Stack developer, highly recommend.) By selecting topBar you can go to the source with ctrl+b.
Options.ts
/**
* Change the navbar border color
* #### (Android specific)
*/
borderColor?: Color;
If not both, set the borderHeight. So like this; (from my code)
stack:{
children:[
{
component:{
name: 'app.Main.Shop',
options:{
topBar:{
borderColor:'blue',
borderHeight:2
},
},
}
}
],
options: {..}
}
Result like this;

MS Edge 14+ CSS helper does not work

I want to change CSS specific to MS Edge. I tried some method introduced in this website (browser strangeness) but it doesn't work.
Please check my sample in codepen.
html
<div class='test'>ahahaha</div>
css
.test {
color : blue;
}
/* MS Edge */
#supports (-ms-ime-align:auto)
and (not (-ms-accelerator:true))
and (not (-webkit-text-stroke:initial)) {
.test { color : red; } }
/* IE 10+ */
#media all and (-ms-high-contrast: none), (-ms-high-contrast: active)
{ .test { color : red; } }
As I'm a Mac user, I use browserstack extention to check IE and Edge. With above code, IE works fine but Edge does not.
Is there anyway to specify Edge in CSS?
Thanks.

What's the substitute for ::shadow and /deep/?

The two shadow-piercing combinators have been deprecated as stated in https://www.chromestatus.com/features/6750456638341120Then what's the substitude for achieving the same thing, or this shadow-piercing feature has been completely abandoned?
::shadow and /deep/ were removed for breaking encapsulation.
The substitutes are:
CSS variables.
It already works natively with the recently launched Google Chrome 49. Read here:
http://www.html5rocks.com/en/tutorials/webcomponents/shadowdom-201/
https://developers.google.com/web/updates/2016/02/css-variables-why-should-you-care?hl=en
http://blog.chromium.org/2016/02/chrome-49-beta-css-custom-properties.html
:host-context. Read here: http://www.html5rocks.com/en/tutorials/webcomponents/shadowdom-201/
As of Polymer 2:
::shadow (shadow-piercing selectors) - there is no direct substitute. Instead a custom CSS properties has to be used. Polymer 2: Custom CSS Properties
/deep/ - there is some sort of replacement by defining :host > * { ... } (applies a ruleset to all of the top-level children in the host's shadow tree, which doesn't conflict with the rule in the main document).
For more detailed information check Polymer 2 Upgrade Notes
At the time of writing you can try ::part and ::theme with Chrome 73 and above:
https://www.chromestatus.com/feature/5763933658939392
<submit-form>
#shadow-root
<x-form exportparts="some-input, some-box">
#shadow-root
<x-bar exportparts="some-input, some-box">
#shadow-root
<x-foo part="some-input, some-box"></x-foo>
</x-bar>
</x-form>
</submit-form>
<x-form></x-form>
<x-bar></x-bar>
You can style all the inputs with:
:root::part(some-input) { ... }
There is the full documentation how it works:
https://github.com/fergald/docs/blob/master/explainers/css-shadow-parts-1.md
This somehow can solve your problem, but I still miss the days how I styled embedded tweets with ::shadow.
"::v-deep" is working for me. For example:
.menu {
// stuff
}
/deep/.sub-menu { // override submenu
.sub-menu__mini {
//stuff
}
a, a:hover {
//stuff
}
}
}
becomes:
.menu {
// stuff
}
::v-deep .sub-menu { // override submenu
.sub-menu__mini {
//stuff
}
a, a:hover {
//stuff
}
}
}

Resources