14 posts • Page 1 of 1
I have been looking into using Qt4 for making nice UI's for Sketchup plugin's
I'm looking into how to make it work runtime in a sketchup plugin, and there is very little documentation to be found anywhere.
So, basically I'm posting to see if anyone else interested in this, have you been working this way, or is there any good reason not to use Qt4 for UI's.
My goal is to post a solid "How-to" use/setup Qt4 UI's in Sketchup plugin's.
If you don't know Qt4 - Qt4 is an IDE made by Nokia, very powerful and used for very sophisticated UI's.
Part of the IDE is Qt4-designer - a graphical interface WYSIWYG kind-of-thing, very cool and considered by many the best around.
Qt4-designer is free and open source.
Screenshot Qt4 here: http://qt.nokia.com/images/products/qt- ... t-mac/view
The workflow goes like this:
- Layout your UI with widgets, buttons, sliders, dials, combo's and what have you.
- Set properties to get behaviour and look you want.
- Set signals/slots to connect UI with you main RUBY plugin file.
- Qt4 saves as an XML file.
- Run the XML file through a program/compiler ("rbuic4" in linux-terminal) with Ruby bindings and output is a ready-to-go UI in RUBY.
- You can re-work/tweak the RUBY UI or leave and use as is.
Pro's for this workflow:
- Fast way to make some really cool UI stuff.
- The RUBY UI runs and looks native in both Windows AND Mac-OSX - from the SAME UI-file.
- Keep plugin's in only RUBY - you can scramble the UI if you are into that kind-of-thing.
- The UI file is separated from the logic.
- Should you be trembling over Trimble in the future - at least your UI can easily be converted to python/java or whatever you require.
Con's for this workflow
- There is very little documentation around.
For some documentation of this I found this link: http://techbase.kde.org/Development/Tut ... on_Kubuntu
Right now I'm trying to figure out the runtime dependencies/libraries needed and where to locate/put them.
If you have anything you want to share - PLEASE post
Sounds like a full Ruby install will be needed by all end users.
Easy on PC... but on MAC it requires changing symbolic links. Do a search on this forum (or check the indexes in the Code Snippets Sticky we have other threads on these topics.
One thing to investigate for this project is if all the frameworks required overrides any of the core methods - can can cause problems.
If you require the Standard Ruby Library there might very well be problems. The Set class in SketchUp conflicts with the Set class in the Standard Library for instance.
I just happened to be working on a fix, as I need to use a gem that requires the standard Set class.
Just wanted to point out wxSU. Similar idea to yours, but uses wxWindows. Perhaps there is some ideas that could be applied to Qt4.
Didn't SU4Thea use that at some point - and it caused conflicts and issues. Messed around with lots of stuff, even attached hidden windows to the SketchUp window etc...? Or was that something else?
That is a very good idea - will have a look
Yes thomthom, WxSU creates an invisible toplevel windowframe around the SketchUp application window, so that Wx messages can bubble up to that window object and be processed. (It changes the SU app window class to be a child of this invisible window.)
I wonder if this can cause problems for plugins that use EventRelay, or plugins that are searching for window objects using Win API calls via Win32API ??
Yes it can.
Hi guys - thank you for your input.
It might be that Dan is right and a complete ruby installation is needed at runtime, but that is not the easy lightweight solution I was hoping for.
Here is what I was hoping to achieve.
I want to track down the files/libraries that are sought by
The files required by Qt4 is placed inside the sketchup tree, maybe in /Resources/Qt/, as standalone dependencies for plugin's.
Then require the files directly with a path to the files... /Resources/Qt/Qtcore
As I understand Sketchup runs its own ruby interpreter 1.8.6, and I want the interpreter to run the GUI also.
Should this work? or is it a really bad idea?
Sorry, I have a stupid question - I can't get my head around the require.
When you require 'Sketchup' or 'Qt4' - what actually happens, which files are actually sought? - I sure there is an easy way to track them down, I just can't find it ....
Can anyone give me a hint.
The require() method is defined in mixin module Kernel, which is "mixed into" class Object, using the C-side of the include method.
Therefore... since ALL objects in Ruby are subclasses of Object, EVERY object's pedigree will contain Object and Kernel. You can see this with the ancestors() method. Subclasses inherit their ancestors methods, but can be overridden locally within a class or module, or locally undefined (which is rare.)
You should read up on the Kernel.require and Kernel.load methods.. and understand how require uses the global arrays $LOAD_PATH (aka $:,) and $LOADED_FEATURES (aka $".)
Get the Standard Ruby 1.8.6 Reference (CHM) here, or access the online web editions for the Core and Libs.
1) the Resouces path is a application OEM path and should remain "hands off"
2) it is very difficult to install anything into that path
Ruby libraries, other than a few win32ole.so and Win32API.so (for historical reasons,) need to stay in the Ruby lib directories. (And even those 2 mentioned here, should stay in the full Ruby install folders, if possible.)
We just cannot copy all of the Ruby extended library files into the Sketchup plugins folder. It will create havoc.
Actually the 'author_subdir/your_ui.rb' file would have statement(s) at or near the top that are:
See my post: [ Code ] Ruby LOAD PATHs script (Win32) : ver 3.0.1
I do remember seeing a Ruby script that would go through a file looking for require statements, and search each dependency in turn for their dependancies.
It would print out a report. Either was something Rick Wilson wrote, .. or something that disro'd with the Full Ruby install.
But cannot locate it now.
14 posts • Page 1 of 1