Editing User:Vladbogolin/qt-display-manager
From BRL-CAD
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 2: | Line 2: | ||
The purpose of this project was to create a new cross-platform 3D display manager using Qt framework that supports all the features of existing display manager's. | The purpose of this project was to create a new cross-platform 3D display manager using Qt framework that supports all the features of existing display manager's. | ||
− | As BRL-CAD uses Tcl/Tk, the new display manager had to be integrated in Tk windows so this | + | As BRL-CAD uses Tcl/Tk, the new display manager had to be integrated in Tk windows so this is one of the first features implemented. Then, basic drawing had to be done, more exactly line, points and text drawing. |
[[File:Tkqt1.png|200px]][[File:Sph.png|200px]][[File:Tor.png|200px]] | [[File:Tkqt1.png|200px]][[File:Sph.png|200px]][[File:Tor.png|200px]] | ||
− | At this point the display manager could draw almost anything but there was no event processing involved so user input was ignored. The problem that occurs when talking about event processing is the communication between Qt and Tk, so every time a Qt event occurs the corresponding Tk one needs to be generated to obtain the desired behavior. This was simply done by using the Tcl "event generate" command and by processing Qt events. | + | To obtain this a QPainter that draws on a QPixmap was used. At this point the display manager could draw almost anything but there was no event processing involved so user input was ignored. The problem that occurs when talking about event processing is the communication between Qt and Tk, so every time a Qt event occurs the corresponding Tk one needs to be generated to obtain the desired behavior. This was simply done by using the Tcl "event generate" command and by processing Qt events. |
The events can be grouped in three categories: | The events can be grouped in three categories: | ||
Line 21: | Line 21: | ||
[[File:Rotate1.png|200px]][[File:Rotate2.png|200px]] | [[File:Rotate1.png|200px]][[File:Rotate2.png|200px]] | ||
− | As it comes to key bindings, I've tried to do everything in such a way that new key bindings can be easily added. | + | As it comes to key bindings, I've tried to do everything in such a way that new key bindings can be easily added. What adding a new key biding means is adding a function that receives as input a Qt event and returns the corresponding Tk one: |
char* qt_mouseButton1Press(QEvent *event) { | char* qt_mouseButton1Press(QEvent *event) { | ||
Line 35: | Line 35: | ||
} | } | ||
− | As seen from the images I focused on integrating the display manager in classic mged first | + | As seen from the images I focused on integrating the display manager in classic mged first so after everything was working accordingly I moved towards integrating the new display manager |
*in mged: | *in mged: | ||
[[File:mged.png|200px]] | [[File:mged.png|200px]] | ||
Line 42: | Line 42: | ||
[[File:archer.png|200px]] | [[File:archer.png|200px]] | ||
− | + | which is one of the final features implemented. |