-
Notifications
You must be signed in to change notification settings - Fork 25
Add quick item childen (can be nested) #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rafaeldelucena
wants to merge
12
commits into
parkouss:master
Choose a base branch
from
rafaeldelucena:add-quick-item-children
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
1691774
Add quick item childen (can be nested)
rafaeldelucena 9e3ee1a
Check for QT_QUICK_LIB at dump_quick_items
rafaeldelucena 7c6a846
Remove warnings from unused params
rafaeldelucena 26ff92b
Fix flake8 errors
rafaeldelucena c16fd55
Add Functionnal test
rafaeldelucena f2e6977
Changes after format_code.sh
rafaeldelucena c49378e
Update Changelog
rafaeldelucena 8f7a2b8
Fixing functional tests
rafaeldelucena ac4aa77
Remove unused
rafaeldelucena cbe445a
Add initial version of cmakelists for qml app
rafaeldelucena 35a38df
Updating cmakelists and github action to run qml app test
rafaeldelucena eb25bd9
Fix cmakelists
rafaeldelucena File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -257,3 +257,5 @@ Example: :: | |
| .. autoclass:: QuickItem | ||
|
|
||
| .. automethod:: QuickItem.click | ||
|
|
||
| .. automethod:: QuickItem.children | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| cmake_minimum_required(VERSION 3.14) | ||
|
|
||
| # Set the project name and target | ||
| project(funq-test-qml-app) | ||
|
|
||
| # Specify C++ standard | ||
| set(CMAKE_CXX_STANDARD 17) | ||
| set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
|
||
| # Set a default build type if none is specified (important for CI) | ||
| if(NOT CMAKE_BUILD_TYPE) | ||
| set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE) | ||
| endif() | ||
|
|
||
| # Find the appropriate version of Qt (either Qt5 or Qt6) | ||
| find_package(Qt6 QUIET COMPONENTS Widgets Quick Qml) | ||
| if (NOT Qt6_FOUND) | ||
| find_package(Qt5 REQUIRED COMPONENTS Widgets Quick Qml) | ||
| set(QT_VERSION_MAJOR 5) | ||
| else() | ||
| set(QT_VERSION_MAJOR 6) | ||
| endif() | ||
|
|
||
| # Set the output directory for the executable | ||
| set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/) | ||
|
|
||
| # Add the main source file | ||
| add_executable(${PROJECT_NAME} main.cpp) | ||
|
|
||
| # Add the resource file and link against the appropriate Qt libraries | ||
| if (QT_VERSION_MAJOR EQUAL 5) | ||
| qt5_add_resources(QT_RESOURCES resources.qrc) | ||
| target_link_libraries(${PROJECT_NAME} Qt5::Widgets Qt5::Quick Qt5::Qml) | ||
| elseif (QT_VERSION_MAJOR EQUAL 6) | ||
| qt_add_resources(QT_RESOURCES resources.qrc) | ||
| target_link_libraries(${PROJECT_NAME} Qt6::Widgets Qt6::Quick Qt6::Qml) | ||
| endif() | ||
|
|
||
| # Include the generated resource files in the target | ||
| target_sources(${PROJECT_NAME} PRIVATE ${QT_RESOURCES}) | ||
|
|
||
| # Platform-specific settings | ||
| if (CMAKE_SYSTEM_NAME STREQUAL "Windows") | ||
| # Windows-specific settings | ||
| set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Release) | ||
| elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin") | ||
| # macOS-specific settings (e.g., bundle into an .app) | ||
| set(MACOSX_BUNDLE TRUE) | ||
| set_target_properties(${PROJECT_NAME} PROPERTIES | ||
| MACOSX_BUNDLE_GUI_IDENTIFIER com.yourdomain.funq-test-qml-app | ||
| MACOSX_BUNDLE_BUNDLE_NAME "FunqTestQMLApp" | ||
| MACOSX_BUNDLE_BUNDLE_VERSION "1.0" | ||
| MACOSX_BUNDLE_SHORT_VERSION_STRING "1.0" | ||
| ) | ||
| elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux") | ||
| # Linux-specific settings | ||
| set(CMAKE_INSTALL_RPATH "$ORIGIN") | ||
| endif() | ||
|
|
||
| # Installation rules (optional, for installation packaging) | ||
| install(TARGETS ${PROJECT_NAME} | ||
| BUNDLE DESTINATION . | ||
| RUNTIME DESTINATION bin | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| #include <QQuickView> | ||
| #include <QGuiApplication> | ||
|
|
||
| int main(int argc, char *argv[]) | ||
| { | ||
| QGuiApplication app(argc, argv); | ||
|
|
||
| QQuickView * view = new QQuickView(); | ||
| view->setSource(QUrl("qrc:///qml/children.qml")); | ||
| view->show(); | ||
| return app.exec(); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import QtQuick 2.0 | ||
|
|
||
| Rectangle { | ||
| id: main | ||
| width: 600 | ||
| height: 600 | ||
| color: "red" | ||
|
|
||
| Text { | ||
| text: "Parent" | ||
| } | ||
|
|
||
| Rectangle { | ||
| width: 400 | ||
| height: 400 | ||
| color: "green" | ||
| anchors.centerIn: parent | ||
| Text { | ||
| text: "Child" | ||
| } | ||
|
|
||
| Rectangle { | ||
| width: 200 | ||
| height: 200 | ||
| color: "blue" | ||
| anchors.centerIn: parent | ||
| Text { | ||
| text: "Grandchild" | ||
| } | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| <RCC> | ||
| <qresource prefix="/"> | ||
| <file>qml/children.qml</file> | ||
| </qresource> | ||
| </RCC> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| # -*- coding: utf-8 -*- | ||
|
|
||
| # Copyright: SCLE SFE | ||
| # Contributor: Rafael de Lucena Valle <rafaeldelucena@gmail.com> | ||
| # | ||
| # This software is a computer program whose purpose is to test graphical | ||
| # applications written with the QT framework (http://qt.digia.com/). | ||
| # | ||
| # This software is governed by the CeCILL v2.1 license under French law and | ||
| # abiding by the rules of distribution of free software. You can use, | ||
| # modify and/ or redistribute the software under the terms of the CeCILL | ||
| # license as circulated by CEA, CNRS and INRIA at the following URL | ||
| # "http://www.cecill.info". | ||
| # | ||
| # As a counterpart to the access to the source code and rights to copy, | ||
| # modify and redistribute granted by the license, users are provided only | ||
| # with a limited warranty and the software's author, the holder of the | ||
| # economic rights, and the successive licensors have only limited | ||
| # liability. | ||
| # | ||
| # In this respect, the user's attention is drawn to the risks associated | ||
| # with loading, using, modifying and/or developing or reproducing the | ||
| # software by the user in light of its specific status of free software, | ||
| # that may mean that it is complicated to manipulate, and that also | ||
| # therefore means that it is reserved for developers and experienced | ||
| # professionals having in-depth computer knowledge. Users are therefore | ||
| # encouraged to load and test the software's suitability as regards their | ||
| # requirements in conditions enabling the security of their systems and/or | ||
| # data to be ensured and, more generally, to use and operate it in the | ||
| # same conditions as regards security. | ||
| # | ||
| # The fact that you are presently reading this means that you have had | ||
| # knowledge of the CeCILL v2.1 license and that you accept its terms. | ||
|
|
||
| from base import QmlAppTestCase | ||
| from funq.client import FunqClient | ||
|
|
||
|
|
||
| class TestQmlItemChilden(QmlAppTestCase): | ||
|
|
||
| def get_children_by_property(self, prop, recursive=False): | ||
| self.funq = FunqClient() | ||
| widget = self.funq.active_widget() | ||
| item = widget.item(id='main') | ||
| children = item.children(recursive=recursive) | ||
| return [child.properties().get(prop) | ||
| for child in children.iter() if prop in child.properties()] | ||
|
|
||
| def test_non_recursive_children(self): | ||
| children = self.get_children_by_property('text') | ||
| self.assertIn('Parent', children) | ||
|
|
||
| def test_recursive_children(self): | ||
| children = self.get_children_by_property('text', recursive=True) | ||
| self.assertIn('Parent', children) | ||
| self.assertIn('Child', children) | ||
| self.assertIn('Grandchild', children) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.