[Qt-jambi-interest] BackgroundRole

2009-02-05 Thread Vincent Lebreil
Hi,

I'm trying to display a background color for all items of my model.
I've tried to return a QColor in my data method for BackgroundRole. But this
color is only displayed if the mouse is over one row of my view. This color
is not displayed for all the rows of my view.
I don't understand why, cause if I do the same thing but with
DecorationRole, it works great (ie all the rows of my view have this
decoration).

Thanks for your help

Vincent

---8< ---
public Object data(QModelIndex index, int role) {
Object data = null;
if (index != null) {
if (role == Qt.ItemDataRole.DisplayRole }
data = "data";
} else if (role == Qt.ItemDataRole.DecorationRole) {
data = QColor.blue;
} else if (role == Qt.ItemDataRole.BackgroundRole) {
data = QColor.blue;
}
}
return data;
}
-8<---
___
Qt-jambi-interest mailing list
Qt-jambi-interest@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest


Re: [Qt-jambi-interest] signal.connect() creates double connections in some cases

2009-02-05 Thread Eskil Abrahamsen Blomfeldt
Mathias wrote:
> public class MyTabWidget extends QTabWidget {
> public MyTabWidget() {
> currentChanged.connect(this, "currentChanged(int)");
> }
> 
> private void currentChanged(int index) {
> System.out.println("Changed!");
> }
> }
> 
> This creates two lines of printout on every tab change.

Yes, this is a bug =) Thank you for spotting this. There are other side 
effects to this as well, so until it has been fixed, I advice you to 
give the slots names that do not match any of the signals in the same 
class.

> PS: I'm sorry if this thing is already in some bug tracking database. I 
> haven't seen one for Jambi yet, maybe I haven't looked hard enough?

There's a single task tracker for everything:

http://www.qtsoftware.com/developer/task-tracker

In "Advanced Search" you can specify product = "Qt Jambi" to limit the 
results to Qt Jambi bugs. In some cases it might make sense to search 
the entire database, though, as most Qt bugs will also affect Qt Jambi 
applications.


-- Eskil
___
Qt-jambi-interest mailing list
Qt-jambi-interest@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest


[Qt-jambi-interest] signal.connect() creates double connections in some cases

2009-02-05 Thread Mathias
Gentlemen,

consider this:

public class MyTabWidget extends QTabWidget {
public MyTabWidget() {
currentChanged.connect(this, "currentTabChanged(int)");
}

private void currentTabChanged(int index) {
System.out.println("Changed!");
}
}

This short piece of code works as expected. On every tab change one line of
console printout.
However, if you rename the slot method to the same name as the signal
("currentChanged" in this case) the connect() call creates two connections
to the slot:

public class MyTabWidget extends QTabWidget {
public MyTabWidget() {
currentChanged.connect(this, "currentChanged(int)");
}

private void currentChanged(int index) {
System.out.println("Changed!");
}
}

This creates two lines of printout on every tab change.

Unexpected to me... :)

Cheers from the Black Forest,
Mathias

PS: I'm sorry if this thing is already in some bug tracking database. I
haven't seen one for Jambi yet, maybe I haven't looked hard enough?
___
Qt-jambi-interest mailing list
Qt-jambi-interest@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest


[Qt-jambi-interest] Crash on System.exit()

2009-02-05 Thread Mathias
Gentlemen,

I did notice that in some cases, when my app exits with System.exit() (e.g.
after having handled an exception) Jambi crashes with a seg fault in
qtjambi.dll native code.
I attached the crash log of the most recent case.

Basically the procedure is as follows:

During startup my application throws an exception before getting to
QApplication.exec() (for example because it detected another instance
running).
The exception is being handled in the global UncaughtExceptionHandler set
with Thread.setDefaultUncaughtExceptionHandler(...).
The exception handler displays a messagebox to the user with
QMessageBox.critical(...) and then calls System.exit(1).

This is my current handler:

public void uncaughtException(Thread t, final Throwable e) {
if (log != null) log.error("Unrecoverable error encountered on
thread " + t, e);

Runnable messenger = new Runnable() {
public void run() {
QMessageBox.critical(null,
QApplication.translate("Application", "application
error"),
StringUtils.abbreviate(e.getMessage(), 500)
);
System.exit(1);
}
};

// we need to display the error message on the main thread
if (Thread.currentThread() != mainThread) {
QApplication.invokeLater(messenger);
} else {
messenger.run();
}
}

Everything works as expected except for the seg fault at the very end (see
attachment).

Am I missing a crucial clean up step before the System.exit() ?

Thanks for any hints on this,
Mathias


hs_err_pid3724.log
Description: Binary data
___
Qt-jambi-interest mailing list
Qt-jambi-interest@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest


Re: [Qt-jambi-interest] QTJambi in MacOS

2009-02-05 Thread Eskil Abrahamsen Blomfeldt
Dennis Kehrig wrote:
> What, exactly - Java oder Eclipse? Because I got the same problem
> without using Eclipse at all (compiled on Windows, then run on Mac OS
> X). Java on Windows does not accept this option, is this a Mac-only thing?

Hi, Dennis.

Yes, it's a mac-only thing, because the implementation of Java on Mac is 
  pretty different from the platforms maintained by Sun.

Both Eclipse and Qt Jambi require that you use this option when 
launching the Java runtime. In fact, whenever you start a Java 
application which uses a different GUI library than Swing on Mac, you 
will have to pass in the -XstartOnFirstThread option.

-- Eskil
___
Qt-jambi-interest mailing list
Qt-jambi-interest@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest


Re: [Qt-jambi-interest] QTJambi in MacOS

2009-02-05 Thread Dennis Kehrig
Hello,

> "QPixmap: It is not safe to use pixmaps outside the GUI thread"

I experienced this, too.

> On OS-X you need to launch with -XstartOnFirstThread.

What, exactly - Java oder Eclipse? Because I got the same problem
without using Eclipse at all (compiled on Windows, then run on Mac OS
X). Java on Windows does not accept this option, is this a Mac-only thing?

Greetings,

Dennis
___
Qt-jambi-interest mailing list
Qt-jambi-interest@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest