Answer the question
In order to leave comments, you need to log in
How to get rid of downcast in GUI?
There is a window Window, on it on different tabs there are about fifty widgets: QLineEdit, QDateEdit and QComboBox, or rather their own derived classes.
The essence of the Window window:
Open the window -> select query from mysql -> fill widgets
Press the Save button -> update query in mysql -> close the window
In order not to write logic for each individual widget, I want to have something like QMap, where the first field is a column mysql tables. All this to populate widgets, compare with the original value (QWidget::setProperty), collect update requests in a more centralized way. And don't duplicate the code.
I haven't written a GUI much in my life, but I don't want to start a project with a downcast. Thank you for your attention.
PS Who is not familiar with Qt:
QLineEdit, QDateEdit and QComboBox are descendants of QWidget, all of which are library GUI widget classes.
QMap - analogue of std::map
Answer the question
In order to leave comments, you need to log in
have something like QMap where the first field is a mysql table column.
Generate your fifty widgets along with the request, who forbids you? It's just that the program needs to "know" a little more about the data structure.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question