mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-11-23 11:17:15 +08:00
update
This commit is contained in:
parent
099e966d9b
commit
d420282dd8
@ -199,12 +199,13 @@
|
|||||||
<file>qml/page/T_SplitLayout.qml</file>
|
<file>qml/page/T_SplitLayout.qml</file>
|
||||||
<file>qml/window/FluentInitalizrWindow.qml</file>
|
<file>qml/window/FluentInitalizrWindow.qml</file>
|
||||||
<file>res/template/CMakeLists.txt.in</file>
|
<file>res/template/CMakeLists.txt.in</file>
|
||||||
<file>res/template/App.qml.in</file>
|
<file>res/template/src/App.qml.in</file>
|
||||||
<file>res/template/logo.ico.in</file>
|
<file>res/template/src/CMakeLists.txt.in</file>
|
||||||
<file>res/template/main.cpp.in</file>
|
<file>res/template/src/en_US.ts.in</file>
|
||||||
<file>res/template/main.qml.in</file>
|
<file>res/template/src/logo.ico.in</file>
|
||||||
<file>res/template/qml.qrc.in</file>
|
<file>res/template/src/main.cpp.in</file>
|
||||||
<file>res/template/en_US.ts.in</file>
|
<file>res/template/src/main.qml.in</file>
|
||||||
<file>res/template/zh_CN.ts.in</file>
|
<file>res/template/src/qml.qrc.in</file>
|
||||||
|
<file>res/template/src/zh_CN.ts.in</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
@ -1,90 +1,9 @@
|
|||||||
cmake_minimum_required(VERSION 3.20)
|
cmake_minimum_required(VERSION 3.20)
|
||||||
|
|
||||||
project(%1 VERSION 0.1 LANGUAGES CXX)
|
project(%1 VERSION 1.0)
|
||||||
|
|
||||||
set(CMAKE_AUTOUIC ON)
|
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core)
|
||||||
set(CMAKE_AUTOMOC ON)
|
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core)
|
||||||
set(CMAKE_AUTORCC ON)
|
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
||||||
|
|
||||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
||||||
set(APPLICATION_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/debug)
|
|
||||||
else()
|
|
||||||
set(APPLICATION_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/release)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(APPLE)
|
|
||||||
set(APPLICATION_REAL_PATH ${APPLICATION_OUTPUT_DIRECTORY}/${PROJECT_NAME}.app/Contents/MacOS)
|
|
||||||
else()
|
|
||||||
set(APPLICATION_REAL_PATH ${APPLICATION_OUTPUT_DIRECTORY})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Quick)
|
|
||||||
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Quick)
|
|
||||||
|
|
||||||
find_program(QT_LUPDATE NAMES lupdate)
|
|
||||||
find_program(QT_LRELEASE NAMES lrelease)
|
|
||||||
if (NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/${PROJECT_NAME}_en_US.qm)
|
|
||||||
execute_process(COMMAND ${QT_LUPDATE} ${CMAKE_CURRENT_LIST_DIR} -ts ${PROJECT_NAME}_en_US.ts WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})
|
|
||||||
execute_process(COMMAND ${QT_LRELEASE} ${PROJECT_NAME}_en_US.ts WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})
|
|
||||||
endif ()
|
|
||||||
if (NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/${PROJECT_NAME}_zh_CN.qm)
|
|
||||||
execute_process(COMMAND ${QT_LUPDATE} ${CMAKE_CURRENT_LIST_DIR} -ts ${PROJECT_NAME}_zh_CN.ts WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})
|
|
||||||
execute_process(COMMAND ${QT_LRELEASE} ${PROJECT_NAME}_zh_CN.ts WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
file(GLOB QM_FILE_PATHS ${CMAKE_CURRENT_LIST_DIR}/ *.qm)
|
|
||||||
file(COPY ${QM_FILE_PATHS} DESTINATION ${APPLICATION_REAL_PATH}/i18n)
|
|
||||||
|
|
||||||
|
|
||||||
set(PROJECT_SOURCES
|
|
||||||
main.cpp
|
|
||||||
qml.qrc
|
|
||||||
)
|
|
||||||
|
|
||||||
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
|
|
||||||
qt_add_executable(${PROJECT_NAME}
|
|
||||||
MANUAL_FINALIZATION
|
|
||||||
${PROJECT_SOURCES}
|
|
||||||
)
|
|
||||||
else()
|
|
||||||
add_executable(${PROJECT_NAME}
|
|
||||||
${PROJECT_SOURCES}
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
|
||||||
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${APPLICATION_OUTPUT_DIRECTORY}"
|
|
||||||
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${APPLICATION_OUTPUT_DIRECTORY}"
|
|
||||||
)
|
|
||||||
|
|
||||||
target_link_libraries(${PROJECT_NAME} PRIVATE
|
|
||||||
Qt${QT_VERSION_MAJOR}::Core
|
|
||||||
Qt${QT_VERSION_MAJOR}::Quick
|
|
||||||
fluentuiplugin
|
|
||||||
)
|
|
||||||
|
|
||||||
if(${QT_VERSION} VERSION_LESS 6.1.0)
|
|
||||||
set(BUNDLE_ID_OPTION MACOSX_BUNDLE_GUI_IDENTIFIER com.example.${PROJECT_NAME})
|
|
||||||
endif()
|
|
||||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
|
||||||
${BUNDLE_ID_OPTION}
|
|
||||||
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
|
|
||||||
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
|
|
||||||
MACOSX_BUNDLE TRUE
|
|
||||||
WIN32_EXECUTABLE TRUE
|
|
||||||
)
|
|
||||||
|
|
||||||
add_subdirectory(FluentUI)
|
add_subdirectory(FluentUI)
|
||||||
|
add_subdirectory(src)
|
||||||
include(GNUInstallDirs)
|
|
||||||
install(TARGETS ${PROJECT_NAME}
|
|
||||||
BUNDLE DESTINATION .
|
|
||||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
|
||||||
|
|
||||||
if(QT_VERSION_MAJOR EQUAL 6)
|
|
||||||
qt_import_qml_plugins(${PROJECT_NAME})
|
|
||||||
qt_finalize_executable(${PROJECT_NAME})
|
|
||||||
endif()
|
|
88
example/res/template/src/CMakeLists.txt.in
Normal file
88
example/res/template/src/CMakeLists.txt.in
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.20)
|
||||||
|
|
||||||
|
project(%1 VERSION 0.1 LANGUAGES CXX)
|
||||||
|
|
||||||
|
set(CMAKE_AUTOUIC ON)
|
||||||
|
set(CMAKE_AUTOMOC ON)
|
||||||
|
set(CMAKE_AUTORCC ON)
|
||||||
|
|
||||||
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
|
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
|
set(APPLICATION_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/debug)
|
||||||
|
else()
|
||||||
|
set(APPLICATION_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/release)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(APPLE)
|
||||||
|
set(APPLICATION_REAL_PATH ${APPLICATION_OUTPUT_DIRECTORY}/${PROJECT_NAME}.app/Contents/MacOS)
|
||||||
|
else()
|
||||||
|
set(APPLICATION_REAL_PATH ${APPLICATION_OUTPUT_DIRECTORY})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Quick)
|
||||||
|
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Quick)
|
||||||
|
|
||||||
|
find_program(QT_LUPDATE NAMES lupdate)
|
||||||
|
find_program(QT_LRELEASE NAMES lrelease)
|
||||||
|
if (NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/${PROJECT_NAME}_en_US.qm)
|
||||||
|
execute_process(COMMAND ${QT_LUPDATE} ${CMAKE_CURRENT_LIST_DIR} -ts ${PROJECT_NAME}_en_US.ts WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})
|
||||||
|
execute_process(COMMAND ${QT_LRELEASE} ${PROJECT_NAME}_en_US.ts WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})
|
||||||
|
endif ()
|
||||||
|
if (NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/${PROJECT_NAME}_zh_CN.qm)
|
||||||
|
execute_process(COMMAND ${QT_LUPDATE} ${CMAKE_CURRENT_LIST_DIR} -ts ${PROJECT_NAME}_zh_CN.ts WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})
|
||||||
|
execute_process(COMMAND ${QT_LRELEASE} ${PROJECT_NAME}_zh_CN.ts WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
file(GLOB QM_FILE_PATHS ${CMAKE_CURRENT_LIST_DIR}/ *.qm)
|
||||||
|
file(COPY ${QM_FILE_PATHS} DESTINATION ${APPLICATION_REAL_PATH}/i18n)
|
||||||
|
|
||||||
|
|
||||||
|
set(PROJECT_SOURCES
|
||||||
|
main.cpp
|
||||||
|
qml.qrc
|
||||||
|
)
|
||||||
|
|
||||||
|
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
|
||||||
|
qt_add_executable(${PROJECT_NAME}
|
||||||
|
MANUAL_FINALIZATION
|
||||||
|
${PROJECT_SOURCES}
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
add_executable(${PROJECT_NAME}
|
||||||
|
${PROJECT_SOURCES}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||||
|
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${APPLICATION_OUTPUT_DIRECTORY}"
|
||||||
|
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${APPLICATION_OUTPUT_DIRECTORY}"
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(${PROJECT_NAME} PRIVATE
|
||||||
|
Qt${QT_VERSION_MAJOR}::Core
|
||||||
|
Qt${QT_VERSION_MAJOR}::Quick
|
||||||
|
fluentuiplugin
|
||||||
|
)
|
||||||
|
|
||||||
|
if(${QT_VERSION} VERSION_LESS 6.1.0)
|
||||||
|
set(BUNDLE_ID_OPTION MACOSX_BUNDLE_GUI_IDENTIFIER com.example.${PROJECT_NAME})
|
||||||
|
endif()
|
||||||
|
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||||
|
${BUNDLE_ID_OPTION}
|
||||||
|
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
|
||||||
|
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
|
||||||
|
MACOSX_BUNDLE TRUE
|
||||||
|
WIN32_EXECUTABLE TRUE
|
||||||
|
)
|
||||||
|
|
||||||
|
include(GNUInstallDirs)
|
||||||
|
install(TARGETS ${PROJECT_NAME}
|
||||||
|
BUNDLE DESTINATION .
|
||||||
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
|
|
||||||
|
if(QT_VERSION_MAJOR EQUAL 6)
|
||||||
|
qt_import_qml_plugins(${PROJECT_NAME})
|
||||||
|
qt_finalize_executable(${PROJECT_NAME})
|
||||||
|
endif()
|
Before Width: | Height: | Size: 116 KiB After Width: | Height: | Size: 116 KiB |
@ -50,6 +50,10 @@ void InitalizrHelper::templateToFile(const QString& source,const QString& dest,A
|
|||||||
QTextStream in(&file);
|
QTextStream in(&file);
|
||||||
QString content = in.readAll().arg(std::forward<Args>(args)...);
|
QString content = in.readAll().arg(std::forward<Args>(args)...);
|
||||||
file.close();
|
file.close();
|
||||||
|
QDir outputDir = QFileInfo(dest).absoluteDir();
|
||||||
|
if(!outputDir.exists()){
|
||||||
|
outputDir.mkpath(outputDir.absolutePath());
|
||||||
|
}
|
||||||
QFile outputFile(dest);
|
QFile outputFile(dest);
|
||||||
if (outputFile.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
if (outputFile.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||||
QTextStream out(&outputFile);
|
QTextStream out(&outputFile);
|
||||||
@ -92,12 +96,13 @@ void InitalizrHelper::generate(const QString& name,const QString& path){
|
|||||||
QDir fluentDir(projectDir.filePath("FluentUI"));
|
QDir fluentDir(projectDir.filePath("FluentUI"));
|
||||||
copyDir(QDir(QGuiApplication::applicationDirPath()+"/source"),fluentDir);
|
copyDir(QDir(QGuiApplication::applicationDirPath()+"/source"),fluentDir);
|
||||||
templateToFile(":/example/res/template/CMakeLists.txt.in",projectDir.filePath("CMakeLists.txt"),name);
|
templateToFile(":/example/res/template/CMakeLists.txt.in",projectDir.filePath("CMakeLists.txt"),name);
|
||||||
templateToFile(":/example/res/template/main.cpp.in",projectDir.filePath("main.cpp"),name);
|
templateToFile(":/example/res/template/src/CMakeLists.txt.in",projectDir.filePath("src/CMakeLists.txt"),name);
|
||||||
templateToFile(":/example/res/template/main.qml.in",projectDir.filePath("main.qml"),name);
|
templateToFile(":/example/res/template/src/main.cpp.in",projectDir.filePath("src/main.cpp"),name);
|
||||||
templateToFile(":/example/res/template/en_US.ts.in",projectDir.filePath(name+"_en_US.ts"),name);
|
templateToFile(":/example/res/template/src/main.qml.in",projectDir.filePath("src/main.qml"),name);
|
||||||
templateToFile(":/example/res/template/zh_CN.ts.in",projectDir.filePath(name+"_zh_CN.ts"),name);
|
templateToFile(":/example/res/template/src/en_US.ts.in",projectDir.filePath("src/"+name+"_en_US.ts"),name);
|
||||||
copyFile(":/example/res/template/App.qml.in",projectDir.filePath("App.qml"));
|
templateToFile(":/example/res/template/src/zh_CN.ts.in",projectDir.filePath("src/"+name+"_zh_CN.ts"),name);
|
||||||
copyFile(":/example/res/template/qml.qrc.in",projectDir.filePath("qml.qrc"));
|
copyFile(":/example/res/template/src/App.qml.in",projectDir.filePath("src/App.qml"));
|
||||||
copyFile(":/example/res/template/logo.ico.in",projectDir.filePath("logo.ico"));
|
copyFile(":/example/res/template/src/qml.qrc.in",projectDir.filePath("src/qml.qrc"));
|
||||||
|
copyFile(":/example/res/template/src/logo.ico.in",projectDir.filePath("src/logo.ico"));
|
||||||
return this->success(projectPath);
|
return this->success(projectPath);
|
||||||
}
|
}
|
||||||
|
@ -7,16 +7,44 @@ FluTextBox{
|
|||||||
property var items:[]
|
property var items:[]
|
||||||
property string emptyText: qsTr("No results found")
|
property string emptyText: qsTr("No results found")
|
||||||
property int autoSuggestBoxReplacement: FluentIcons.Search
|
property int autoSuggestBoxReplacement: FluentIcons.Search
|
||||||
|
property var filter: function(item){
|
||||||
|
if(item.title.indexOf(control.text)!==-1){
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
signal itemClicked(var data)
|
signal itemClicked(var data)
|
||||||
signal handleClicked
|
|
||||||
id:control
|
id:control
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
loadData()
|
d.loadData()
|
||||||
}
|
}
|
||||||
Item{
|
Item{
|
||||||
id:d
|
id:d
|
||||||
property bool flagVisible: true
|
property bool flagVisible: true
|
||||||
property var window : Window.window
|
property var window : Window.window
|
||||||
|
function handleClick(modelData){
|
||||||
|
control_popup.visible = false
|
||||||
|
control.itemClicked(modelData)
|
||||||
|
d.updateText(modelData.title)
|
||||||
|
}
|
||||||
|
function updateText(text){
|
||||||
|
d.flagVisible = false
|
||||||
|
control.text = text
|
||||||
|
d.flagVisible = true
|
||||||
|
}
|
||||||
|
function loadData(){
|
||||||
|
var result = []
|
||||||
|
if(items==null){
|
||||||
|
list_view.model = result
|
||||||
|
return
|
||||||
|
}
|
||||||
|
items.map(function(item){
|
||||||
|
if(control.filter(item)){
|
||||||
|
result.push(item)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
list_view.model = result
|
||||||
|
}
|
||||||
}
|
}
|
||||||
onActiveFocusChanged: {
|
onActiveFocusChanged: {
|
||||||
if(!activeFocus){
|
if(!activeFocus){
|
||||||
@ -66,7 +94,7 @@ FluTextBox{
|
|||||||
height: 38
|
height: 38
|
||||||
width: control.width
|
width: control.width
|
||||||
onClicked:{
|
onClicked:{
|
||||||
handleClick(modelData)
|
d.handleClick(modelData)
|
||||||
}
|
}
|
||||||
background: Rectangle{
|
background: Rectangle{
|
||||||
FluFocusRectangle{
|
FluFocusRectangle{
|
||||||
@ -96,7 +124,7 @@ FluTextBox{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
onTextChanged: {
|
onTextChanged: {
|
||||||
loadData()
|
d.loadData()
|
||||||
if(d.flagVisible){
|
if(d.flagVisible){
|
||||||
var pos = control.mapToItem(null, 0, 0)
|
var pos = control.mapToItem(null, 0, 0)
|
||||||
if(d.window.height>pos.y+control.height+container.implicitHeight){
|
if(d.window.height>pos.y+control.height+container.implicitHeight){
|
||||||
@ -109,27 +137,4 @@ FluTextBox{
|
|||||||
control_popup.visible = true
|
control_popup.visible = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function handleClick(modelData){
|
|
||||||
control_popup.visible = false
|
|
||||||
control.itemClicked(modelData)
|
|
||||||
updateText(modelData.title)
|
|
||||||
}
|
|
||||||
function updateText(text){
|
|
||||||
d.flagVisible = false
|
|
||||||
control.text = text
|
|
||||||
d.flagVisible = true
|
|
||||||
}
|
|
||||||
function loadData(){
|
|
||||||
var result = []
|
|
||||||
if(items==null){
|
|
||||||
list_view.model = result
|
|
||||||
return
|
|
||||||
}
|
|
||||||
items.map(function(item){
|
|
||||||
if(item.title.indexOf(control.text)!==-1){
|
|
||||||
result.push(item)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
list_view.model = result
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -6,16 +6,44 @@ FluTextBox{
|
|||||||
property var items:[]
|
property var items:[]
|
||||||
property string emptyText: qsTr("No results found")
|
property string emptyText: qsTr("No results found")
|
||||||
property int autoSuggestBoxReplacement: FluentIcons.Search
|
property int autoSuggestBoxReplacement: FluentIcons.Search
|
||||||
|
property var filter: function(item){
|
||||||
|
if(item.title.indexOf(control.text)!==-1){
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
signal itemClicked(var data)
|
signal itemClicked(var data)
|
||||||
signal handleClicked
|
|
||||||
id:control
|
id:control
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
loadData()
|
d.loadData()
|
||||||
}
|
}
|
||||||
Item{
|
Item{
|
||||||
id:d
|
id:d
|
||||||
property bool flagVisible: true
|
property bool flagVisible: true
|
||||||
property var window : Window.window
|
property var window : Window.window
|
||||||
|
function handleClick(modelData){
|
||||||
|
control_popup.visible = false
|
||||||
|
control.itemClicked(modelData)
|
||||||
|
d.updateText(modelData.title)
|
||||||
|
}
|
||||||
|
function updateText(text){
|
||||||
|
d.flagVisible = false
|
||||||
|
control.text = text
|
||||||
|
d.flagVisible = true
|
||||||
|
}
|
||||||
|
function loadData(){
|
||||||
|
var result = []
|
||||||
|
if(items==null){
|
||||||
|
list_view.model = result
|
||||||
|
return
|
||||||
|
}
|
||||||
|
items.map(function(item){
|
||||||
|
if(control.filter(item)){
|
||||||
|
result.push(item)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
list_view.model = result
|
||||||
|
}
|
||||||
}
|
}
|
||||||
onActiveFocusChanged: {
|
onActiveFocusChanged: {
|
||||||
if(!activeFocus){
|
if(!activeFocus){
|
||||||
@ -65,7 +93,7 @@ FluTextBox{
|
|||||||
height: 38
|
height: 38
|
||||||
width: control.width
|
width: control.width
|
||||||
onClicked:{
|
onClicked:{
|
||||||
handleClick(modelData)
|
d.handleClick(modelData)
|
||||||
}
|
}
|
||||||
background: Rectangle{
|
background: Rectangle{
|
||||||
FluFocusRectangle{
|
FluFocusRectangle{
|
||||||
@ -95,7 +123,7 @@ FluTextBox{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
onTextChanged: {
|
onTextChanged: {
|
||||||
loadData()
|
d.loadData()
|
||||||
if(d.flagVisible){
|
if(d.flagVisible){
|
||||||
var pos = control.mapToItem(null, 0, 0)
|
var pos = control.mapToItem(null, 0, 0)
|
||||||
if(d.window.height>pos.y+control.height+container.implicitHeight){
|
if(d.window.height>pos.y+control.height+container.implicitHeight){
|
||||||
@ -108,27 +136,4 @@ FluTextBox{
|
|||||||
control_popup.visible = true
|
control_popup.visible = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function handleClick(modelData){
|
|
||||||
control_popup.visible = false
|
|
||||||
control.itemClicked(modelData)
|
|
||||||
updateText(modelData.title)
|
|
||||||
}
|
|
||||||
function updateText(text){
|
|
||||||
d.flagVisible = false
|
|
||||||
control.text = text
|
|
||||||
d.flagVisible = true
|
|
||||||
}
|
|
||||||
function loadData(){
|
|
||||||
var result = []
|
|
||||||
if(items==null){
|
|
||||||
list_view.model = result
|
|
||||||
return
|
|
||||||
}
|
|
||||||
items.map(function(item){
|
|
||||||
if(item.title.indexOf(control.text)!==-1){
|
|
||||||
result.push(item)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
list_view.model = result
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user