How to sort TableModel QML Type

2020-10-17 Thread chiasa.men
Is there a way to sort a TableModel without relying on c++ code?




Re: How is that border color defined? (system color schemes)

2020-10-14 Thread chiasa.men
On Mittwoch, 14. Oktober 2020 08:13:43 CEST Noah Davis wrote:
> KColorUtils::mix( palette.color( QPalette::Window ), palette.color(
> QPalette::WindowText ), 0.25 )
>
> On Tue, Oct 13, 2020 at 2:25 PM chiasa.men  wrote:
> > https://pasteboard.co/JvupDV3.png
> >
> > Per trial and error I assumed the line (border of list view (vertical
> > right
> > under the cursor)) color: #bcbebf is defined by a combination of Window
> > Text and Window Background (at least it changes if one of the colors is
> > changed) - but how is it determined exactly?

Thanks! I checked Oxygen Cold Color Scheme - there it seems to be only Window
Background. So, is the use of mix() a breeze only thing?




How is that border color defined? (system color schemes)

2020-10-13 Thread chiasa.men
https://pasteboard.co/JvupDV3.png

Per trial and error I assumed the line (border of list view (vertical right
under the cursor)) color: #bcbebf is defined by a combination of Window Text
and Window Background (at least it changes if one of the colors is changed) -
but how is it determined exactly?







TableView (QtQuick 2) with alternating row colors (DelegateChooser)

2020-10-13 Thread chiasa.men
// code
import QtQuick 2.15
import QtQuick.Window 2.15

import QtQuick 2.12
import QtQuick.Controls 2.5
import Qt.labs.qmlmodels 1.0

ApplicationWindow {
width: 400
height: 400
visible: true

TableView {
anchors.fill: parent
columnSpacing: 1
rowSpacing: 1
boundsBehavior: Flickable.StopAtBounds

model: TableModel {
TableModelColumn { display: "checked" }
TableModelColumn { display: "amount" }
TableModelColumn { display: "fruitType" }
TableModelColumn { display: "fruitName" }
TableModelColumn { display: "fruitPrice" }

// Each row is one type of fruit that can be ordered
rows: [
{
// Each property is one cell/column.
checked: false,
amount: 1,
fruitType: "Apple",
fruitName: "Granny Smith",
fruitPrice: 1.50
},
{
checked: true,
amount: 4,
fruitType: "Orange",
fruitName: "Navel",
fruitPrice: 2.50
},
{
checked: false,
amount: 1,
fruitType: "Banana",
fruitName: "Cavendish",
fruitPrice: 3.50
}
]
}
delegate: DelegateChooser {
DelegateChoice {
column: 0
delegate: CheckBox {
checked: model.display
onToggled: model.display = checked
}
}
DelegateChoice {
column: 1
delegate: SpinBox {
value: model.display
onValueModified: model.display = value
}
}
DelegateChoice {
delegate: TextField {
text: model.display
selectByMouse: true
implicitWidth: 140
onAccepted: model.display = text
}
}
}
}
}
//code end


Thats the example from 
https://doc.qt.io/qt-5/qml-qt-labs-qmlmodels-tablemodel.html - Using 
DelegateChooser with TableModel

I wonder how to enable alternating row colors. Usually in all Quick 2 Table
codes Ive seen so far the background color is determined by a Rectangle in
delegate.

Furthermore: I want to use the TableView in a plasmoid configurtation.
There the hierarchy lacks of an ApplicationWindow with specific height and
width. Instead the TableView is wrapped by an Item.
Is there a way to let the TableView fill the whole configuration window?
At the moment I have to use:
   Layout.preferredWidth:600
   Layout.preferredHeight:400
in order to show anything.

  Layout.fillHeight: true
  Layout.fillWidth: true
Would not show anything






IconDialog customLocation

2020-10-08 Thread chiasa.men
My plasmoid provides icons. I want to use an IconPicker so that the user can
decide which icon to use. Therefore Im using the following snippet:
import org.kde.kquickcontrolsaddons 2.0 as KQuickAddons
...
KQuickAddons.IconDialog {
id: iconDialog
onIconNameChanged: {
iconPreview.source = iconName
iconChanged(iconName)
}
customLocation:'/absolute/path/to/images/'
}

Which works, but only if the user clicks manually within the IconDialog on
"Other Icons:" radio button. By default "System Icons:" radio button is
checked.

How can I change the default setting in order to present the user
automatically the delivered icons?