PDA

View Full Version : Borland TDBCtrlGrid equivalent available ?



marcvanriet
25th August 2009, 13:51
Hello,

I'm rather new to QT programming (have 20 years of programming experience though), and I am trying to switch to QT for some simple database applications.

I am looking for an equivalent of the TDBCtrlGrid widget that is present in Borland Delphi and C++ Builder.

It is a database widget with different rows. On the first row, you can put any data-aware widgets in the user-interface designer, and lay them out as you like. You can add text and lines and whatever also.

When you run the application, you get a table with different rows showing the data of your records.

I'm using this component quite heavily, because it is very convenient to provide a user-friendly interface.

Is something similar possible in QT ? I haven't found anything in the documentation.

Best regards,
Marc

wysota
25th August 2009, 14:03
Not directly. But you can use QScrollArea with QVBoxLayout and when you add a new row, instantiate a component of your choice (which would probably be composed of some other widgets arranged into a horizontal layout) and add it to the layout.

marcvanriet
25th August 2009, 14:10
Hello Wysota,

Thanks for the quick reply.

But that would mean that I have to instantiate a component for each record in the database right ? And then keep track of which component is linked to which record.

That isn't practical in a database with thousands of records.

Best regards,
Marc

wysota
25th August 2009, 15:43
That isn't practical in a database with thousands of records.
Having several thousand components on the screen is impractical at all. It's much more practical to use the default behaviour of QTableView and forget about TDBCtrlGrid.