Basic Qt interface, opening GDS2

edited August 2012 in General
Hi everyone,
(Sorry for my english)
I'm looking for a lib wich allows me to open a GDS2 under a Qt interface. I thought I could learn from your code open source and include files needed to display a GDS in my Qt interface. Unfortunately, I have not found a proper documentation. And it has hundreds of files of codes! Where should I look for the code that only open and display a GDS2?

Does someone could help me?

Thanks a lot!


  • edited September 2012


    well, doing it properly and efficient simply requires a couple of lines of code ... :-)

    Basically, KLayout is an application, not a library. It's build on some kind of framework which you could reuse (given you observe the implications of the GPL license). But providing a library or framework is very much different from providing an application (i.e. needs different documentation, deployment, licensing and support) and that is simply out of the scope of that project.

    You'll find a couple of other free libraries that allow you read and write GDS files. Drawing a simple layout with Qt is not a big issue since Qt comes with the necessary primitives, but that approach will be limited with respect to performance and drawing precision. To overcome these limitations, KLayout comes with a custom drawing engine which bloats up the code, just to note one particular issue.

    Painting works quite differently in KLayout compared to simple drawing on a QPainter object. Specifically, KLayout uses a collection of single-bit planes to paint on. These planes are then combined into the final image. This approach accounts for the typical, layered nature of a layout and facilitates background painting. Painting also goes through some levels of abstraction to support different output schemes and multi-threaded drawing and that architecture is not a shape yet that can be presented easily.

    Even more, KLayout is build around some lean internal interfaces and much functionality is implemented as components employing these interfaces in a "plugin" fashion. Which means they can be easily separated off or it's possible to extend KLayout without touching the framework. That fact further complicates the code.

    If you're desperate or out for some challenge, here are some hints:

    • The dbXYZ files for the objects make up the layout database. The main object is db::Layout in You'll also find some reader/writer code there (i.e. the GDS2 reader in
    • The tlXYZ files are for basic utility classes.
    • The layXYZ files are for the user interface. In particular you might be interested in which is the basic painter implementation. The basic output component you'll find in and (the full-featured multi-layout view). finally holds the main application window which is basically a collection of views.
    • All other files can be ignored since they are either plugin-type extensions or implement other parts of the framework (i.e. scripting interfaces).


Sign In or Register to comment.