The file /usr/include/connection.h should include <kexidb/tristate.h> instead of <tristate.h>, else programs that use the library, like labplot in the 1.5.0.5 version don't compile.
kexi installs /usr/include/kexidb/connection.h not /usr/include/connection.h the problem is that the labplot configure script doesn't take the Gentoo path into account src_unpack() { kde_src_unpack sed -e "s:QWT3D_PATH/include:QWT3D_PATH/include/qwtplot3d:" \ -e "s:KEXIDB_DIR/include:KEXIDB_DIR/include/kexidb:" \ -i configure } is a quick and dirty workaround.