Skip to content
/ wble Public

Library of useful Qt widgets. Contains double slider, progress bars, integer, double, string and date filters.

License

Notifications You must be signed in to change notification settings

przemek83/wble

Repository files navigation

Build & test CodeQL codecov

Quality Gate Status Bugs Code Smells Coverage Duplicated Lines (%)

Table of contents

Examples screenshot

Alt text

About project

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
  • date filter
  • infinity progress bar
  • counter progress bar

Getting Started

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+.

Building

Clone and use CMake directly or via any IDE supporting it. CMake should:

  • configure everything automatically,
  • compile and create binaries.

As a result of compilation, binary for simulations and binary for testing should be created.

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:

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:

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
OS version 10 22H2 24.04
GCC 13.1.0 13.2.0
CMake 3.30.2 3.28.3
Git 2.46.0 2.43.0
Qt 6.5.2 6.5.2

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.

Widgets

Double slider

Alt text
Each handle can be moved independently. Check also Integer and Double filters, which are wrapping double slider into handy adjustable widgets.

Filters

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
Wrapped double slider into an adjustable widget. Dedicated for integer values.

Double filter

Alt text
Wrapped double slider into an adjustable widget. Dedicated for double values.

Date filter

Alt text
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
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
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
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 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
********* Start testing of DoubleSliderTest *********
Config: Using QtTest library 6.5.2, Qt 6.5.2 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 10.3.1 20210422 (Red Hat 10.3.1-1)), ubuntu 24.04
PASS   : DoubleSliderTest::initTestCase()
PASS   : DoubleSliderTest::testSettingCurrentValues()
PASS   : DoubleSliderTest::testEmittingCurrentMinChanged()

(...)

PASS   : UtilitiesTest::testGetSpanAngleCounterHalf()
PASS   : UtilitiesTest::testGetSpanAngleCounterFull()
PASS   : UtilitiesTest::cleanupTestCase()
Totals: 10 passed, 0 failed, 0 skipped, 0 blacklisted, 0ms
********* Finished testing of UtilitiesTest *********

As an alternative, CTest can be used to run tests from the build/tests directory:

$ ctest
Test project <path>/wble/build/tests
    Start 1: wble-tests
1/1 Test #1: wble-tests .......................   Passed    0.11 sec

100% tests passed, 0 tests failed out of 1

Total Test time (real) =   0.11 sec

Licensing

Wble library is published under a LGPL license.

The project uses the following software:

Name License Home Description
Qt LGPLv3 https://www.qt.io/ cross-platform application development framework