QPropertyEditor
Qt Widgets
Score 76%
Description:

This small library is used to be a lightweight method to allow the graphical editing of properties defined via the Q_PROPERTY macro. It can be easily extended for custom datatypes.

In the zip archiv a Sample Application is included that contains a custom property for a vector with three floating point values.

Feedback is welcome!
Last changelog:

10 years ago

v 0.1. support for basic datatypes
v 0.2. support for dynamic properties (that don't start with a '_')
v 0.3 support for enums (thanks to banal from qt-apps.org for this enhancement)

phamtv

6 years ago

Can you populate a structure array? If so, is there an example to demonstrate this?

Report

phamtv

6 years ago

After looking at my message, I should provide you with some details. I am trying to populate a simple class that contains a structure array of registers. I am hoping to come up with a property grid that comes up with a formatted structure as follow:

Class Name
...Registers
->...0x01-Register 1...........0xFF
->->... Bit 1 - Some thing.....0x01
->->... Bit 2 - Some thing.....0x00
->...0x02-Register 2...........0xAB
->->... Bit 1 - Some thing.....0x01
->->... Bit 2 - Some thing.....0x00
->->... Bit 3 - Some thing.....0x00

etc..

Thanks!

Report

phamtv

6 years ago

After looking at my message, I should provide you with some details. I am trying to populate a simple class that contains a structure array of registers. I am hoping to come up with a property grid that comes up with a formatted structure as follow:

Class Name
...Registers
->...0x01-Register 1...........0xFF
->->... Bit 1 - Some thing.....0x01
->->... Bit 2 - Some thing.....0x00
->...0x02-Register 2...........0xAB
->->... Bit 1 - Some thing.....0x01
->->... Bit 2 - Some thing.....0x00
->->... Bit 3 - Some thing.....0x00

etc..

Thanks!

Report

starapple

7 years ago

Hi, is this a widget that works with the qtpropertybrowser dll? If so, how is it implemented?

Should it be built/made? I tried to make it and got this message: error: 'INT_MAX' was not declared in this scope Property.cpp:69
D:/Qt/QPropertyEditor_0.3/src/QPropertyEditor/Property.cpp

I executed the dos batch file in the Doc folder but it did nothing.

Thanks for your help.

Report

C

Volki

7 years ago

It's not using the qtpropertybrowser dll

You have to include limits.h if you couldn't find INT_MAX. The docs batch file only works if you have doxygen installed and available through your PATH environment settings

Report

jacmoe

8 years ago

Hi.
Great library. :)

I noticed that the license for the code is LGPL, but the headers mention GPL.
Is that an error?
Is it LGPL or GPL ?

I changed the license headers in my copy to the following:

// *************************************************************************************************
//
// QPropertyEditor v 0.3
//
// --------------------------------------
// Copyright (C) 2007 Volker Wiendl
// Acknowledgements to Roman alias banal from qt-apps.org for the Enum enhancement
//
//
// The QPropertyEditor Library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by the Free Software
// Foundation; either version 2 of the License, or (at your option) any later
// version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License along with
// this program; if not, write to the Free Software Foundation, Inc., 59 Temple
// Place - Suite 330, Boston, MA 02111-1307, USA, or go to
// http://www.gnu.org/copyleft/lesser.txt.
//
// *************************************************************************************************


I hope it's alright with you.
Otherwise, you need to change the entry so that the right license is shown.

Kind Regards

Jacob 'jacmoe' Moen

Report

C

Volki

8 years ago

LGPL is fine

Report

jong

8 years ago

Hi,
I cannot manage to set a name for a property. It is possible to do it with the class as the example shows it however I didn't find a way to change the displayed name of a property, looking at the code didn't help me.

Report

C

Volki

8 years ago

You can use underscores to insert spaces

Report

sajis997

8 years ago

Hello Volki,

I have already installed your component.

My system crashed couple of days ago and i reinstalled everything.

While compiling this component i have the following error:

INT_MAX not declared

I have queries regarding that before as well and some in forum said that

#include <limits> has defined that


But i am still having that error


Any hint would be of great help


Regards
Sajjad

Report

muenalan

8 years ago

Thanks for a such nice widget!

Q: Can we add a setting to update only once the editing is finshed; not during editing. After ENTER, for a QLineEdit, for instance.

Background: During editing a property value the underlaying m_property member of the QObject class gets *immediately* updated (not just after finishing the edit). So when writing an email, for instance, its also written during entering the string, while the email is half correct/valid.

PROBLEM: My class checks for valid emails, and voila throws exeptions. Of course, there are more cases where half-correct input is not ok.


Thanks+Cheers,
mu

Report

muenalan

8 years ago

muenalan: ok, then here is a patch for a start.

Property.cpp.editingFinishedInsteadOfsetValue-DIFFPATCH
49,70d48
< void Property::editingFinished()
< {
< if( QObject::sender() )
< {
< QVariant value_editor;
<
< switch(value().type())
< {
< case QVariant::Int:
< value_editor = static_cast<QSpinBox *>( QObject::sender() )->value();
< break;
< case QMetaType::Float:
< case QVariant::Double:
< value_editor = static_cast<QDoubleSpinBox *>( QObject::sender() )->value();
< break;
< }
<
< if (m_propertyObject)
< m_propertyObject->setProperty(qPrintable(objectName()), value_editor);
< }
< }
<
91d68
<
96,103c73
<
< // MUE: In 0.3 valueChanged(..) was setting the property upon each character change, even when
< // the input was not meant to be set.
< // Changed to editingFinished() (see QAbstractSpinBox docs) and introduced corresponding slot into
< // this class.
<
< // connect(editor, SIGNAL(valueChanged(int)), this, SLOT(setValue(int)));
< connect(editor, SIGNAL(editingFinished()), this, SLOT(editingFinished()));
---
> connect(editor, SIGNAL(valueChanged(int)), this, SLOT(setValue(int)));
110,111c80
< // connect(editor, SIGNAL(valueChanged(double)), this, SLOT(setValue(double)));
< connect(editor, SIGNAL(editingFinished()), this, SLOT(editingFinished()));
---
> connect(editor, SIGNAL(valueChanged(double)), this, SLOT(setValue(double)));

Property.h.editingFinishedInsteadOfsetValue-DIFFPATCH
140a141,142
> void editingFinished();
>

Report

C

Volki

8 years ago

It might be better for strings to have the property not set immediately, but on the other hand it can be useful to have immediate updates for example when changing the position property of some graphics. In this case I want to set the change immediately after changing the value.

Report

muenalan

8 years ago

You're right, but as it happens for me it 80% editingFinished was correct/intuitive. setValue/editingFinished should be likely configurable on a per-property basis. Let's think about it.

Report

dostowalla

8 years ago

Hello

There is a createEditor() function both in Property and QVariantDelegate class
and i would like to understand the difference betwen each of these

Regards
Sajjad



Report

dostowalla

9 years ago

Hello,

I am trying to read a node database along
with their respective field structures

Each field of different type.

The Nodes are already loaded from the database in a tree view.

When the user click on one of the nodes
the respective field with different types of that node will be loaded as well. and the user can edit them the mechanism is already provided in that!. Thanks to Volki again.

What changes do i have to make to get what i would like to have

Please let me know if anyone need more explanation to that issue

Regards
Sajjad

Report

C

Volki

8 years ago

You can add dynamic properties using the setProperty command of QObject. Those properties should be shown by the QPropertyEditor too. I haven't tested that intensively but despite the manually handling of the QDynamicPropertyChangeEvent it should work.

Not sure if that's the answer to your question, if not you have to make a little bit more clear, what's your problem.

Report

dostowalla

9 years ago

That is really nice widget!!!

I am quite new to Qt and have a question

inside the createEditor() function

there is a function called setProperty()

where there is a variant passed INT_MAX

I did not really understand that; Should that not be declared somewhere?

Report

subik

9 years ago

#include <limits.h>

solves it

Report

ZaphodB

9 years ago

but in EnumProperty.h you should change

#include <QtGUI/QComboBox>

to

#include <QtGui/QComboBox>

Otherwise you can't compile it under Linux.

Thanks. I was looking for a long time for a tool like that :)

Report

C

Volki

9 years ago

Thanks for the hint, I changed it and uploaded it again (although it currently seems, that the new file is not yet updated at qt-apps, because if I download it, it still returns the old version).

Report

banal

9 years ago

Hi Volki

Thanks a lot for sharing this Widget. It is exactly what i was looking for.
It seems, that i found a Bug and i wasn't really able to track it down myself. Maybe you can help me out :)
Whenever i use a int property in conjunction with the editorhints via Q_CLASSINFO, the editor (QSpinBox) changes it's value to 1 upon editing. If i don't use the editorhints, everything works fine, but then i'm not able to limit my input range.

Another "Feature" i'd like to see is the correct handling of properties that are using enums (declared with Q_ENUMS). In that case, a QComboBox should be used as editor instead of a QSpinBox.
My plan is to:
subclass Property and create a class "EnumProperty".
extend the QPropertyModel::addItem method to automatically create a EnumProperty whenever a enumerable property is detected

Do you think that might work? Or am i missing something important?
Any input is greatly appreciated. If you like, i'll share any modifications with you/the community.

Report

C

Volki

9 years ago

I can't reproduce the problem. What was the exact Q_CLASSINFO you used?

The only thing I can think of, is that you are using Linux. If I remember correctly, the values were not accepted if you just leave the focus. You had to press return. But that might be a problem in Qt itself or the user interface concept of KDE. I don't know.

Regarding the Q_ENUMS, that shouldn't be a big problem to add.

Report

banal

9 years ago

Thanks for the Feedback.
Here is what i used:
Q_PROPERTY(int Channels READ channels WRITE setChannels DESIGNABLE true USER true)
Q_CLASSINFO("Channels", "minimum=1;maximum=4;singleStep=1;")

The min and max do work as expected, so does the singleStep Parameter. However it always resets my value to 1 when i enter "edit" mode (eg. double click on the item or tab through the list).
I just checked with double values and it doesn't work either whereas in your example application it works...

I really can't spot the difference between my implementation and your TestClass. Except that my object is loaded as a plugin... but that shouldn't affect anything.

Report

C

Volki

9 years ago

Hm, the plugins may be a problem. Perhaps some of your code is using dynamic casts or qobject casts that may result in problems. You can check the Horde3D Editor that makes intensive use of this library

Report

10 years ago

v 0.1. support for basic datatypes
v 0.2. support for dynamic properties (that don't start with a '_')
v 0.3 support for enums (thanks to banal from qt-apps.org for this enhancement)

product-maker higggs Jul 27 2015

product-maker 7 34

File (click to download) Version Description Filetype Packagetype License Downloads Date Filesize OCS-Install DL
Details
version
0.3
updated Sep 28 2008
added Oct 30 2007
downloads today
0
page views today 0