mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-11-26 13:27:05 +08:00
update
This commit is contained in:
parent
07de3b82b1
commit
644a0e509f
@ -261,16 +261,16 @@ FluContentPage{
|
||||
FluComboBox {
|
||||
anchors.fill: parent
|
||||
focus: true
|
||||
currentIndex: display
|
||||
editText: display
|
||||
editable: true
|
||||
model: ListModel {
|
||||
ListElement { text: 100 }
|
||||
ListElement { text: 300 }
|
||||
ListElement { text: 500 }
|
||||
ListElement { text: 1000 }
|
||||
ListElement { text: "100" }
|
||||
ListElement { text: "300" }
|
||||
ListElement { text: "500" }
|
||||
ListElement { text: "1000" }
|
||||
}
|
||||
Component.onCompleted: {
|
||||
currentIndex=[100,300,500,1000].findIndex((element) => element === Number(display))
|
||||
currentIndex=["100","300","500","1000"].findIndex((element) => element === display)
|
||||
selectAll()
|
||||
}
|
||||
onCommit: {
|
||||
|
@ -261,16 +261,16 @@ FluContentPage{
|
||||
FluComboBox {
|
||||
anchors.fill: parent
|
||||
focus: true
|
||||
currentIndex: display
|
||||
editText: display
|
||||
editable: true
|
||||
model: ListModel {
|
||||
ListElement { text: 100 }
|
||||
ListElement { text: 300 }
|
||||
ListElement { text: 500 }
|
||||
ListElement { text: 1000 }
|
||||
ListElement { text: "100" }
|
||||
ListElement { text: "300" }
|
||||
ListElement { text: "500" }
|
||||
ListElement { text: "1000" }
|
||||
}
|
||||
Component.onCompleted: {
|
||||
currentIndex=[100,300,500,1000].findIndex((element) => element === Number(display))
|
||||
currentIndex=["100","300","500","1000"].findIndex((element) => element === display)
|
||||
selectAll()
|
||||
}
|
||||
onCommit: {
|
||||
|
@ -207,8 +207,3 @@ void Log::setup(const QString &app,int level)
|
||||
qInfo()<<"[LOG_PATH]"<<g_file_path;
|
||||
qInfo()<<"===================================================";
|
||||
}
|
||||
|
||||
void Log::teardown()
|
||||
{
|
||||
qInstallMessageHandler(0);
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ namespace Log
|
||||
{
|
||||
QString prettyProductInfoWrapper();
|
||||
void setup(const QString &app,int level = 4);
|
||||
void teardown();
|
||||
}
|
||||
|
||||
#endif // LOG_H
|
||||
|
@ -82,6 +82,5 @@ int main(int argc, char *argv[])
|
||||
if (exec == 931) {
|
||||
QProcess::startDetached(qApp->applicationFilePath(), QStringList());
|
||||
}
|
||||
Log::teardown();
|
||||
return exec;
|
||||
}
|
||||
|
@ -177,15 +177,12 @@ Rectangle {
|
||||
onCanceled: {
|
||||
d.rowHoverIndex = -1
|
||||
}
|
||||
ScrollView{
|
||||
anchors.fill: parent
|
||||
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
||||
ScrollBar.vertical.policy: ScrollBar.AlwaysOff
|
||||
TableView {
|
||||
id:table_view
|
||||
ListModel{
|
||||
id:model_columns
|
||||
}
|
||||
anchors.fill: parent
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
syncView: header_horizontal
|
||||
syncDirection: Qt.Horizontal
|
||||
@ -210,23 +207,53 @@ Rectangle {
|
||||
closeEditor()
|
||||
}
|
||||
delegate: MouseArea{
|
||||
id:item_table_mouse
|
||||
property var rowObject : control.getRow(row)
|
||||
property var itemModel: model
|
||||
property bool editVisible: {
|
||||
if(d.editPosition === undefined){
|
||||
return false
|
||||
}
|
||||
if(d.editPosition._key === rowObject._key && d.editPosition.column === column){
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
hoverEnabled: true
|
||||
implicitHeight: 40
|
||||
implicitWidth: {
|
||||
var w = columnSource[column].width
|
||||
if(!w){
|
||||
w = columnSource[column].minimumWidth
|
||||
}
|
||||
if(!w){
|
||||
w = d.defaultItemWidth
|
||||
}
|
||||
return w
|
||||
}
|
||||
onEntered: {
|
||||
d.rowHoverIndex = row
|
||||
}
|
||||
onWidthChanged: {
|
||||
if(editVisible){
|
||||
updateEditPosition()
|
||||
}
|
||||
}
|
||||
onHeightChanged: {
|
||||
if(editVisible){
|
||||
updateEditPosition()
|
||||
}
|
||||
}
|
||||
onXChanged: {
|
||||
if(editVisible){
|
||||
updateEditPosition()
|
||||
}
|
||||
}
|
||||
onYChanged: {
|
||||
if(editVisible){
|
||||
updateEditPosition()
|
||||
}
|
||||
}
|
||||
function updateEditPosition(){
|
||||
var obj = {}
|
||||
obj._key = rowObject._key
|
||||
obj.column = column
|
||||
obj.row = row
|
||||
obj.x = item_table_mouse.x
|
||||
obj.y = item_table_mouse.y + 1
|
||||
obj.width = item_table_mouse.width
|
||||
obj.height = item_table_mouse.height - 2
|
||||
d.editPosition = obj
|
||||
}
|
||||
Rectangle{
|
||||
id:item_table
|
||||
anchors.fill: parent
|
||||
@ -263,7 +290,8 @@ Rectangle {
|
||||
return
|
||||
}
|
||||
d.editDelegate = d.getEditDelegate(column)
|
||||
d.editPosition = {"_key":rowObject._key,"column":column}
|
||||
updateEditPosition()
|
||||
loader_edit.display = display
|
||||
}
|
||||
onClicked:
|
||||
(event)=>{
|
||||
@ -291,29 +319,6 @@ Rectangle {
|
||||
return com_text
|
||||
}
|
||||
}
|
||||
FluLoader{
|
||||
property var display: itemModel.display
|
||||
property int column: item_table.position.x
|
||||
property int row: item_table.position.y
|
||||
property var tableView: control
|
||||
signal editTextChaged(string text)
|
||||
anchors.fill: parent
|
||||
onEditTextChaged:
|
||||
(text)=>{
|
||||
var obj = control.getRow(row)
|
||||
obj[columnSource[column].dataIndex] = text
|
||||
control.setRow(row,obj)
|
||||
}
|
||||
sourceComponent: {
|
||||
if(d.editPosition === undefined){
|
||||
return undefined
|
||||
}
|
||||
if(d.editPosition._key === rowObject._key && d.editPosition.column === column){
|
||||
return d.editDelegate
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
Item{
|
||||
anchors.fill: parent
|
||||
visible: item_table.isRowSelected
|
||||
@ -346,7 +351,58 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FluLoader{
|
||||
id:loader_edit
|
||||
property var tableView: control
|
||||
property var display
|
||||
property int column: {
|
||||
if(d.editPosition){
|
||||
return d.editPosition.column
|
||||
}
|
||||
return 0
|
||||
}
|
||||
property int row: {
|
||||
if(d.editPosition){
|
||||
return d.editPosition.row
|
||||
}
|
||||
return 0
|
||||
}
|
||||
signal editTextChaged(string text)
|
||||
sourceComponent: d.editPosition ? d.editDelegate : undefined
|
||||
onEditTextChaged:
|
||||
(text)=>{
|
||||
var obj = control.getRow(row)
|
||||
obj[columnSource[column].dataIndex] = text
|
||||
control.setRow(row,obj)
|
||||
}
|
||||
width: {
|
||||
if(d.editPosition){
|
||||
return d.editPosition.width
|
||||
}
|
||||
return 0
|
||||
}
|
||||
height: {
|
||||
if(d.editPosition){
|
||||
return d.editPosition.height
|
||||
}
|
||||
return 0
|
||||
}
|
||||
x:{
|
||||
if(d.editPosition){
|
||||
return d.editPosition.x
|
||||
}
|
||||
return 0
|
||||
}
|
||||
y:{
|
||||
if(d.editPosition){
|
||||
return d.editPosition.y
|
||||
}
|
||||
return 0
|
||||
}
|
||||
z:999
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Component{
|
||||
|
@ -178,15 +178,12 @@ Rectangle {
|
||||
onCanceled: {
|
||||
d.rowHoverIndex = -1
|
||||
}
|
||||
ScrollView{
|
||||
anchors.fill: parent
|
||||
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
||||
ScrollBar.vertical.policy: ScrollBar.AlwaysOff
|
||||
TableView {
|
||||
id:table_view
|
||||
ListModel{
|
||||
id:model_columns
|
||||
}
|
||||
anchors.fill: parent
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
syncView: header_horizontal
|
||||
syncDirection: Qt.Horizontal
|
||||
@ -211,23 +208,53 @@ Rectangle {
|
||||
closeEditor()
|
||||
}
|
||||
delegate: MouseArea{
|
||||
id:item_table_mouse
|
||||
property var rowObject : control.getRow(row)
|
||||
property var itemModel: model
|
||||
property bool editVisible: {
|
||||
if(d.editPosition === undefined){
|
||||
return false
|
||||
}
|
||||
if(d.editPosition._key === rowObject._key && d.editPosition.column === column){
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
hoverEnabled: true
|
||||
implicitHeight: 40
|
||||
implicitWidth: {
|
||||
var w = columnSource[column].width
|
||||
if(!w){
|
||||
w = columnSource[column].minimumWidth
|
||||
}
|
||||
if(!w){
|
||||
w = d.defaultItemWidth
|
||||
}
|
||||
return w
|
||||
}
|
||||
onEntered: {
|
||||
d.rowHoverIndex = row
|
||||
}
|
||||
onWidthChanged: {
|
||||
if(editVisible){
|
||||
updateEditPosition()
|
||||
}
|
||||
}
|
||||
onHeightChanged: {
|
||||
if(editVisible){
|
||||
updateEditPosition()
|
||||
}
|
||||
}
|
||||
onXChanged: {
|
||||
if(editVisible){
|
||||
updateEditPosition()
|
||||
}
|
||||
}
|
||||
onYChanged: {
|
||||
if(editVisible){
|
||||
updateEditPosition()
|
||||
}
|
||||
}
|
||||
function updateEditPosition(){
|
||||
var obj = {}
|
||||
obj._key = rowObject._key
|
||||
obj.column = column
|
||||
obj.row = row
|
||||
obj.x = item_table_mouse.x
|
||||
obj.y = item_table_mouse.y + 1
|
||||
obj.width = item_table_mouse.width
|
||||
obj.height = item_table_mouse.height - 2
|
||||
d.editPosition = obj
|
||||
}
|
||||
Rectangle{
|
||||
id:item_table
|
||||
anchors.fill: parent
|
||||
@ -264,7 +291,8 @@ Rectangle {
|
||||
return
|
||||
}
|
||||
d.editDelegate = d.getEditDelegate(column)
|
||||
d.editPosition = {"_key":rowObject._key,"column":column}
|
||||
updateEditPosition()
|
||||
loader_edit.display = display
|
||||
}
|
||||
onClicked:
|
||||
(event)=>{
|
||||
@ -292,29 +320,6 @@ Rectangle {
|
||||
return com_text
|
||||
}
|
||||
}
|
||||
FluLoader{
|
||||
property var display: itemModel.display
|
||||
property int column: item_table.position.x
|
||||
property int row: item_table.position.y
|
||||
property var tableView: control
|
||||
signal editTextChaged(string text)
|
||||
anchors.fill: parent
|
||||
onEditTextChaged:
|
||||
(text)=>{
|
||||
var obj = control.getRow(row)
|
||||
obj[columnSource[column].dataIndex] = text
|
||||
control.setRow(row,obj)
|
||||
}
|
||||
sourceComponent: {
|
||||
if(d.editPosition === undefined){
|
||||
return undefined
|
||||
}
|
||||
if(d.editPosition._key === rowObject._key && d.editPosition.column === column){
|
||||
return d.editDelegate
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
Item{
|
||||
anchors.fill: parent
|
||||
visible: item_table.isRowSelected
|
||||
@ -347,7 +352,58 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FluLoader{
|
||||
id:loader_edit
|
||||
property var tableView: control
|
||||
property var display
|
||||
property int column: {
|
||||
if(d.editPosition){
|
||||
return d.editPosition.column
|
||||
}
|
||||
return 0
|
||||
}
|
||||
property int row: {
|
||||
if(d.editPosition){
|
||||
return d.editPosition.row
|
||||
}
|
||||
return 0
|
||||
}
|
||||
signal editTextChaged(string text)
|
||||
sourceComponent: d.editPosition ? d.editDelegate : undefined
|
||||
onEditTextChaged:
|
||||
(text)=>{
|
||||
var obj = control.getRow(row)
|
||||
obj[columnSource[column].dataIndex] = text
|
||||
control.setRow(row,obj)
|
||||
}
|
||||
width: {
|
||||
if(d.editPosition){
|
||||
return d.editPosition.width
|
||||
}
|
||||
return 0
|
||||
}
|
||||
height: {
|
||||
if(d.editPosition){
|
||||
return d.editPosition.height
|
||||
}
|
||||
return 0
|
||||
}
|
||||
x:{
|
||||
if(d.editPosition){
|
||||
return d.editPosition.x
|
||||
}
|
||||
return 0
|
||||
}
|
||||
y:{
|
||||
if(d.editPosition){
|
||||
return d.editPosition.y
|
||||
}
|
||||
return 0
|
||||
}
|
||||
z:999
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Component{
|
||||
|
Loading…
Reference in New Issue
Block a user