Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best Qt Widget to use for properties window?

Tags:

I want a widget like the properties window in Visual Studio or NetBeans. It basically has two columns: the name of the property on the left, and the value on the right. The value needs to be able to be restricted to certain types, like 'bool' or 'float' (with valid ranges), but should also support more complex types (perhaps requiring a popup dialog when clicked, and then it can just display a toString() version in the window. I'm sure I can add most of those features myself, but what's the best base widget to start with?

Oh... grouping of properties is good too (like a tree I guess). And property editing should invoke a callback (send a signal).

like image 396
mpen Avatar asked Aug 17 '09 22:08

mpen


People also ask

What are qt5 widgets?

Widgets are the primary elements for creating user interfaces in Qt. Widgets can display data and status information, receive user input, and provide a container for other widgets that should be grouped together. A widget that is not embedded in a parent widget is called a window.

How do you use Qt widget?

To add widgets in Qt Designer: In the Qt Creator Editor mode, double-click the notepad. ui file in the Projects view to launch the file in the integrated Qt Designer. Drag and drop widgets Text Edit (QTextEdit) to the form.


2 Answers

Qt designer has properties exactly like you want. They are most likely implemented with QTreeView. You can always look at the source code.

qt designer

like image 114
Eugene Avatar answered Sep 18 '22 19:09

Eugene


QTreeView or QTableView. Do all (ok, most) of the heavy lifting with a specialized model that handles all of your type restrictions and what-not. Check out delegates as well.

like image 41
Steve S Avatar answered Sep 17 '22 19:09

Steve S