public static void main(String [] args) {
KCmdLineArgs.init( args , "", "", "", "version");
KApplication app = new KApplication();
QApplication app = new QApplication(args);
myWidget = new ();
app.setMainWidget( myWidget );
myWidget.show();
app.exec();
}
/**
* decodePixmap extracts a pixmap from coded data
* @param size of uncompressed data
* @param code string coded data
* @param isCompressed need data to be uncompressed
*/
private static QPixmap decodePixmap(int size, String code, boolean isCompressed) {
int len = code.length() >> 1;
byte [] data = new byte[len];
try {
for (int i=0, j=0 ; i < len; ++i, j+=2) {
data[i] = (byte)Short.parseShort(code.substring(j, j+2), 16);
}
if (isCompressed) {
byte [] pic = new byte [size];
Inflater inflater = new Inflater();
pic = new byte [size];
inflater.setInput(data);
inflater.inflate(pic, 0, size);
return new QPixmap(pic);
} else {
return new QPixmap(data);
}
}
catch (Exception e) {
System.err.println("Problem, while reading image data: "+e.getMessage());
}
return null;
}
/**
* polish does some last initialization just before the widget
* is displayed. Here we setup:
* i) databases
* ...
*/
public void polish() {
if ( != null ) {
QSqlCursor cursor = .sqlCursor();
if ( cursor == null ) {
cursor = new QSqlCursor( "" );
cursor = new QSqlCursor( "", true, QSqlDatabase.database("") );
if ( .isReadOnly() )
cursor.setMode( QSqlCursor.ReadOnly );
.setSqlCursor( cursor, false, true );
}
if ( !cursor.isActive() )
.refresh( QDataTable.RefreshAll );
}
if ( != null ) {
if ( .sqlCursor() == null ) {
QSqlCursor cursor = new QSqlCursor( "" );
QSqlCursor cursor = new QSqlCursor( "", true, QSqlDatabase.database("") );
.setSqlCursor( cursor, true );
.refresh();
.first();
}
}
super.polish();
}
/**
* SLOT
* languageChange sets the strings according to current language
*/
protected void languageChange() {
.header().setLabel(
,
( "
" ) );
.clear();
.header()
.horizontalHeader()
.setLabel(
,
( "
" ) );
.verticalHeader().setLabel(
( "
" ) );
.findItem(
)
if (
!= null)
.setText(
( "
" ) );
}