diff --git a/CMakeLists.txt b/CMakeLists.txt index c9bb991..2df2c5d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.16) project(wble LANGUAGES CXX - VERSION 1.1.0 + VERSION 1.2.0 DESCRIPTION "Library of useful Qt widgets" HOMEPAGE_URL "https://github.com/przemek83/wble") diff --git a/README.md b/README.md index c84be47..fa9863b 100644 --- a/README.md +++ b/README.md @@ -8,17 +8,33 @@ [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=przemek83_wble&metric=coverage)](https://sonarcloud.io/summary/new_code?id=przemek83_wble) [![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=przemek83_wble&metric=duplicated_lines_density)](https://sonarcloud.io/summary/new_code?id=przemek83_wble) -## Table of content +## Table of contents +- [Examples screenshot](#examples-screenshot) - [About project](#about-project) -- [Building](#building) +- [Getting Started](#getting-started) + * [Prerequisites](#prerequisites) + * [Building](#building) + * [CMake integration](#cmake-integration) +- [Built with](#built-with) - [Usage](#usage) - [Widgets](#widgets) + * [Double slider](#double-slider) + * [Filters](#filters) + + [Integer filter](#integer-filter) + + [Double filter](#double-filter) + + [Date filter](#date-filter) + + [String filter](#string-filter) + * [Progress bars](#progress-bars) + + [Infinity progress bar](#infinity-progress-bar) + + [Counter progress bar](#counter-progress-bar) +- [Testing](#testing) +- [Licensing](#licensing) ## Examples screenshot -![Alt text](examples.png?raw=true "String filter not checkable") +![Alt text](examples.png?raw=true "Wble examples app screenshot") ## About project - Library of useful Qt widgets. Created as a result of division of code of Volbx project and moving parts of it to independent library. Library contains: +Library of useful Qt widgets. Created as a result of the division of code of Volbx project and moving parts of it to an independent library. Library contains: + double slider + numeric filters (integer and double one) + string filter @@ -30,7 +46,7 @@ This section describes briefly how to setup the environment and build the project. ### Prerequisites -Qt in version 6.5 or greater, C++ compiler with C++17 support as a minimum and CMake 3.16+. +Qt in version 6.5 or greater, C++ compiler with C++17 support as a minimum, and CMake 3.16+. ### Building Clone and use CMake directly or via any IDE supporting it. CMake should: @@ -39,7 +55,27 @@ Clone and use CMake directly or via any IDE supporting it. CMake should: As a result of compilation, binary for simulations and binary for testing should be created. -**TIP**: remember to set properly `CMAKE_PREFIX_PATH` env variable. It should have Qt installation path to let CMake `find_package` command work. +**TIP**: Remember to set properly the `CMAKE_PREFIX_PATH` env variable. It should have a Qt installation path to let CMake `find_package` command work. + +### CMake integration +Use `FetchContent` CMake module in your project: +```cmake +include(FetchContent) + +FetchContent_Declare( + wble + GIT_REPOSITORY https://github.com/przemek83/wble.git + GIT_TAG v1.2.0 +) + +FetchContent_MakeAvailable(wble) +``` +From that moment, wble library can be used in the `target_link_libraries` command: +```cmake +add_executable(${PROJECT_NAME} ${SOURCES}) +target_link_libraries(${PROJECT_NAME} shared wble) +``` +Check my other project `Volbx` for real world CMake integration. ## Built with | Tool | Windows | Ubuntu | @@ -49,12 +85,9 @@ As a result of compilation, binary for simulations and binary for testing should | CMake | 3.30.2 | 3.28.3 | | Git | 2.46.0 | 2.43.0 | | Qt | 6.5.2 | 6.5.2 | -| Qt Creator | 10.0.2 | 10.0.2 | -| VS Code | 1.92.0 | 1.95.3 | ## Usage -The easiest way is to check examples subproject, where you can find how to create and interact with each widget included in this library. -Alternatively, tests subproject can be checked. Usage also can be found in my other project called Volbx where widgets from this library are used. +The easiest way is to check examples subproject, where you can find how to create and interact with each widget included in this library. Alternatively, tests subproject can be checked. Usage also can be found in my other project called `Volbx` where widgets from this library are used. ## Widgets ### Double slider @@ -64,16 +97,16 @@ Each handle can be moved independently. Check also Integer and Double filters, w Each filter widget inherits from `QGroupBox`. It means all filters can be checkable or not. Use standard `setCheckable()` to alter behavior. #### Integer filter ![Alt text](IntegerFilter.png?raw=true "Integer filter not checkable") -Wrapped double slider into adjustable widget. Dedicated for integer values. +Wrapped double slider into an adjustable widget. Dedicated for integer values. #### Double filter ![Alt text](DoubleFilter.png?raw=true "Double filter not checkable") -Wrapped double slider into adjustable widget. Dedicated for double values. +Wrapped double slider into an adjustable widget. Dedicated for double values. #### Date filter ![Alt text](DateFilter.png?raw=true "Date filter not checkable") Widget allowing to pick custom date range. An additional "Ignore data with empty dates" check box can be used to filter out data entries with empty dates. #### String filter ![Alt text](StringFilter.png?raw=true "String filter not checkable") -Widget allowing to pick multiple string values as filtered set. Additional checkbox "Select/Unselect all" for quick unchecking / checking all string values in filter. +Widget allowing to pick multiple string values as filtered set. Additional checkbox "Select/Unselect all" for quick unchecking/checking all string values in filter. ### Progress bars Widgets capable of showing progress of longer tasks. Can be used as a blend in widget or modal one. #### Infinity progress bar @@ -81,10 +114,10 @@ Widgets capable of showing progress of longer tasks. Can be used as a blend in w Can be used for tasks with unknown end time. The progress bar displays moving arcs until it is stopped or destroyed. #### Counter progress bar ![Alt text](CounterProgressBar.png?raw=true "String filter not checkable") -Can be used for tasks with known end time. The progress bar displays arc, which is moving from 0 towards 100 percent. In the middle, current percent is displayed. +Can be used for tasks with a known end time. The progress bar displays an arc, which is moving from 0 toward 100 percent. In the middle, the current percent is displayed. ## Testing -For testing purposes, the QtTest framework is used. Build the project first. Make sure that the `wble-tests` target is built. Modern IDEs supporting CMake also support running tests with monitoring of failures. But in case you would like to run it manually, go to the `build/tests` directory, where the⁣ binary `wble-tests` should be available. Launching it should produce the following output on Linux: +For testing purposes, the Qt Test framework is used. Build the project first. Make sure that the `wble-tests` target is built. Modern IDEs supporting CMake also support running tests with monitoring of failures. But in case you would like to run it manually, go to the `build/tests` directory, where the⁣ binary `wble-tests` should be available. Launching it should produce the following output on Linux: Example run: ``` $ ./wble-tests diff --git a/tests/ProgressBarCounterTest.cpp b/tests/ProgressBarCounterTest.cpp index dd86023..98cebfe 100644 --- a/tests/ProgressBarCounterTest.cpp +++ b/tests/ProgressBarCounterTest.cpp @@ -37,32 +37,3 @@ void ProgressBarCounterTest::testReseting() ProgressBarCounter progressBar(QString::fromLatin1(""), max_); ProgressBarCommon::checkReseting(progressBar); } - -// void ProgressBarCounterTest::checkInitialPaint() -// { -// ProgressBarCounter progressBar(QLatin1String("Initial"), max_); -// auto actual{progressBar.grab().toImage()}; -// QImage expected(":/res/counterInitial.png"); -// expected = expected.convertToFormat(actual.format()); -// QCOMPARE(actual, expected); -// } - -// void ProgressBarCounterTest::checkPaintAfterUpdate() -// { -// ProgressBarCounter progressBar(QLatin1String("Updated"), max_); -// progressBar.updateProgress(10); -// auto actual{progressBar.grab().toImage()}; -// QImage expected(":/res/counterUpdated.png"); -// expected = expected.convertToFormat(actual.format()); -// QCOMPARE(actual, expected); -// } - -// void ProgressBarCounterTest::checkPaintFinished() -// { -// ProgressBarCounter progressBar(QLatin1String("Finished"), max_); -// progressBar.updateProgress(100); -// auto actual{progressBar.grab().toImage()}; -// QImage expected(":/res/counterFinished.png"); -// expected = expected.convertToFormat(actual.format()); -// QCOMPARE(actual, expected); -// } diff --git a/tests/ProgressBarCounterTest.h b/tests/ProgressBarCounterTest.h index 1279a03..e9467d1 100644 --- a/tests/ProgressBarCounterTest.h +++ b/tests/ProgressBarCounterTest.h @@ -16,12 +16,6 @@ private Q_SLOTS: static void testReseting(); - // static void checkInitialPaint(); - - // static void checkPaintAfterUpdate(); - - // static void checkPaintFinished(); - private: static constexpr int max_{100}; };