Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
przemek83 committed Jan 11, 2025
2 parents 67ca653 + 6e2fb70 commit 4eb4b95
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 51 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
63 changes: 48 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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 |
Expand All @@ -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
Expand All @@ -64,27 +97,27 @@ 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
![Alt text](InfinityProgressBar.png?raw=true "String filter not checkable")
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
Expand Down
29 changes: 0 additions & 29 deletions tests/ProgressBarCounterTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
// }
6 changes: 0 additions & 6 deletions tests/ProgressBarCounterTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -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};
};

0 comments on commit 4eb4b95

Please sign in to comment.