All Projects → qtinuum → Qtnproperty

qtinuum / Qtnproperty

Licence: apache-2.0
Extended properties for Qt5

Labels

Projects that are alternatives of or similar to Qtnproperty

B23Downloader
下载B站 视频(投稿视频、番剧、电影、课程)、直播、漫画。(使用 Qt C++ 开发)
Stars: ✭ 337 (+11.22%)
Mutual labels:  qt
Raspberry Pi Cross Compilers
Latest GCC Cross Compiler & Native (ARM & ARM64) CI generated precompiled standalone toolchains for all Raspberry Pis. 🍇
Stars: ✭ 261 (-13.86%)
Mutual labels:  qt
Nbaseuikit
个人平时使用的一些Qt编写的组件(有部分是整合的开源作品,部分是自己原创);
Stars: ✭ 286 (-5.61%)
Mutual labels:  qt
Project lemonlime
为了 OI 比赛而生的基于 Lemon + LemonPlus 的轻量评测系统 | 三大桌面系统支持
Stars: ✭ 255 (-15.84%)
Mutual labels:  qt
Evision
计算机视觉实践和探索/Practice and explorations in computer vision.
Stars: ✭ 268 (-11.55%)
Mutual labels:  qt
Clementine
🍊 Clementine Music Player
Stars: ✭ 3,089 (+919.47%)
Mutual labels:  qt
fips3
OpenGL-based FITS image viewer
Stars: ✭ 24 (-92.08%)
Mutual labels:  qt
Qxmpp
Cross-platform C++ XMPP client and server library
Stars: ✭ 300 (-0.99%)
Mutual labels:  qt
Slicer
Multi-platform, free open source software for visualization and image computing.
Stars: ✭ 263 (-13.2%)
Mutual labels:  qt
Qcefview
A QWidget encapsulating the CEF named QCefView
Stars: ✭ 279 (-7.92%)
Mutual labels:  qt
Mapper
OpenOrienteering Mapper is a software for creating maps for the orienteering sport.
Stars: ✭ 258 (-14.85%)
Mutual labels:  qt
Klayout
KLayout Main Sources
Stars: ✭ 261 (-13.86%)
Mutual labels:  qt
Johnny
GUI frontend to John the Ripper password cracker
Stars: ✭ 277 (-8.58%)
Mutual labels:  qt
Sa
信号分析及数据可视化软件
Stars: ✭ 254 (-16.17%)
Mutual labels:  qt
Qt Inspector
Utility to browse the Qt object tree of a running Qt application and edit object properties on the fly.
Stars: ✭ 288 (-4.95%)
Mutual labels:  qt
Object-Counting
Object traking and counting with opencv.
Stars: ✭ 14 (-95.38%)
Mutual labels:  qt
Qt Json
A simple class for parsing JSON data into a QVariant hierarchy and vice versa.
Stars: ✭ 273 (-9.9%)
Mutual labels:  qt
Aqemu
Official AQEMU repository - a GUI for virtual machines using QEMU as the backend
Stars: ✭ 301 (-0.66%)
Mutual labels:  qt
Ttkwidgettools
QWidget 自定义控件集合 持续更新中......
Stars: ✭ 296 (-2.31%)
Mutual labels:  qt
Eiskaltdcpp
File sharing program using DC and ADC protocols
Stars: ✭ 277 (-8.58%)
Mutual labels:  qt

Build Status

QtnProperty

This is user and programmer friendly properties for Qt framework. See wiki for some details.

Overview

There are some limitations of standard Qt property system. This project is an attempt to make better properties. The key features are:

  • Properties hierarchy (properties can be organized in hierarchy at any depth)
  • Property widget to observe and edit properties in uniform way
  • Signals before and after property has changed
  • Property description - short text which help user to understand meaning and purpose of the property
  • Property state - property can be disabled or hidden at any moment
  • Serialization via QDataStream
  • Set/Get property value to/from QVariant and QString
  • Scripting support
  • Delegates to customize look and feel properties in property widget
  • PEG (property/enum generator) - it's optional tool like Qt moc which generates properties hierarchy from QML like files into C++ code.

New Features in v2.0.0

  • Multi-properties with QtnMultipleProperty. It is useful when you want to show properties of multiple objects at once. When values of objects's properties differ it shows grayed (Multiple properties). When you set a new property value, it will be changed in every dependent object. Multi-property set can be created with qtnCreateQObjectMultiPropertySet function defined in QObjectPropertySet.h or from custom property sets in a loop with qtnPropertiesToMultiSet function where target argument is a multi-property set, and source argument is a source property set you want to join.
  • QVariant properties with QtnCustomPropertyWidget. You can edit QVariant as property set / add/remove subproperties in QVariantMap or QVariantList, copy/paste variant properties.
  • Integer 64 properties QtnPropertyInt64 QtnPropertyUInt64
  • Floating point variants of QPoint, QSize, QRect properties
  • Overriding QtnPropertyDelegateFactory for QtnPropertySet
  • Improvements to sync objects values and property editors
  • Translations EN_RU

Some screenshots of the Demo application: Demo_screenshot_linux Demo_screenshot_win

How to build

Requirements:

  1. Qt 5.9 framework or later
  2. Optional: Flex 2.6.4 and Bison 3.1.1 (for Windows can be found here) if you build QtnPEG tool

To build:

mkdir path_to_build
cd path_to_build
qmake path_to_QtnProperty/QtnProperty.pro -r
make

Or just open path_to_QtnProperty/QtnProperty.pro file in Qt Creator and build all. Generated libraries and executables will be placed into the target specific folders. For example:

bin-linux-gcc-x86_64
bin-osx-clang-x86_64
bin-win32-msvc-i386
bin-win32-msvc-clang-x86_64
bin-win32-gcc-i386
bin-win32-gcc-x86_64

To run tests and demo, go to one of the binary folders and run:

./QtnPropertyTests
./QtnPropertyDemo

QtnProperty project consists of four submodules:

  1. QtnProperty library - property classes. By default it is a static library. If you need a dynamic library, you should run qmake with CONFIG+=qtnproperty_dynamic argument
  2. QtnPEG tool - optional executable to generate C++ code for property sets from simple QML like files (*.pef files)
  3. QtnPropertyTests - tests for QtnPropertyCore library
  4. QtnPropertyDemo - demo application

How to use

Step 1.

To have QtnProperty in your project you should include QtnPropertyDepend.pri file into your pro file. Example:

MyProject.pro

TEMPLATE   = subdirs
SUBDIRS   += \
        QtnProperty \
        Application

QtnProperty.file = path_to/QtnProperty/QtnProperty.pro

Application.depends = \
    QtnProperty

Application/Application.pro

QT += core gui widgets script

TEMPLATE = app

include(path_to/QtnProperty/QtnPropertyDepend.pri)
# this will add QtnProperty root to include path and will link the library to your app.

Step 2.

Then you can manually create property sets in your C++ code, create QtnPropertyWidget or QtnPropertyView widgets and assign property set to the widget:

class Ui_MainWindow
{
public:
    QtnPropertyWidget *centralWidget;
    ...
};

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    m_propertySet = new QtnPropertySet(this)

    auto floatValue = qtnCreateProperty<QtnPropertyFloat>(m_propertySet);
    floatValue->setName("value");
    floatValue->setDisplayName(tr("Value"));
    floatValue->setDescription(tr("Float value"));
    floatValue->setMaxValue(1.f);
    floatValue->setMinValue(0.f);
    floatValue->setStepValue(0.1f);
    floatValue->setValue(0.3f);

    auto textColor = qtnCreateProperty<QtnPropertyQColor>(m_propertySet);
    textColor->setName("textColor");
    textColor->setDisplayName(tr("TextColor"));
    textColor->setDescription(tr("Foreground text color"));
    textColor->setValue(QColor(0, 0, 0));

    ui->centralWidget->setPropertySet(m_propertySet);
}

This example will show you something like this:

Example_screenshot_windows

Step 3.

If you want to use *.pef files to generate properties C++ code you need to build QtnPEG executable.

Step 4.

To use *.pef files in your project you should do the following in your pro file:

  • Define PEG_TOOL variable as full path to the QtnPEG executable
  • include PEG.pri file
  • list all *.pef files in PEG_SOURCES variable
include(path_to/QtnProperty/PEG/PEG.pri)
PEG_SOURCES += TextEditor.pef

Step 5.

Write *.pef file with propertyset declaration. See wiki for more info. For example TextEditor.pef:

#include "QtnProperty/PropertyCore.h"

property_set TextEditor
{
    Bool enableWrapping
    {
        description = "Enable/disable text wrapping";
        value = true;
    }
    
    Bool replaceTabsWithSpaces
    {
        description = "Automatically replace tabs with spaces";
        value = false;
            
        slot propertyDidChange
        {
            tabSize.switchState(QtnPropertyStateImmutable, !replaceTabsWithSpaces);
        }
    }
    
    UInt tabSize
    {
        description = "Number of spaces to be placed.";
        state = QtnPropertyStateImmutable;
        value = 4;
    }
}

Step 6.

Include generated TextEditor.peg.h and TextEditor.peg.cpp files into your project.

Step 7.

Now you can use QtnPropertySetTextEditor class (defined in generated files) in your C++ code like this:

    QtnPropertySetTextEditor params;
    params.enableWrapping = false;
    if (params.replaceTabsWithSpaces)
        document.replaceTabsWithSpaces(params.tabSize);

Video of GUI testing using Froglogic (c) Squish test framework is here.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].