Category Archives: Uncategorized

Qt Jambi

Hi!
Maybe you’ve already heard about Qt ( Trolltech ) company. It is best known in the Linux community as the basis for the KDE desktop environment. They are developing a cross platform framework for C++ and Java (Qt Jambi). Today I tested their framework and compared it to Swing/AWT (Sun‘s framework).
The naming conventions are basically identical to Java, the most difference is that in Qt Jambi everything begins with Q (QTable, QPushButton), and not with J like in Swing (JTable, JButton). 🙂
The components are being created on the same way in booth frameworks.

Qt Jambi:

QTableWidget table = new QTableWidget(1000, 5);
QTableWidgetItem item = null;

Swing / AWT:

JTable table = new JTable(1000, 5);
Object data = null;

The concept for filling out tables is the same for booth TableModel and AbstractTableModel. Let’s fill out these tables:

Qt Jambi:

for(int i = 0; i < 1000; i++) {
   for(int j = 0; j < 5; j++) {
      item = new QTableWidgetItem("Test value");
      table.setItem(i, j, item);
   }
}

Swing / AWT:

for(int i = 0; i < 1000; i++) {
   for(int j = 0; j < 5; j++) {
      data = "Test value";
      table.setValueAt(data, i, j);
   }
}

Qt table uses less memory with ~4MB, which is probably caused by the number of preloaded classes. I hope that Qt’s Slot approach for generating events also takes less memory then the Swing listeners. That was for today. I’ll come back with new test result as soon as I can.
Bye!