Qt-interest Archive, March 2002
About AutoCAD
Message 1 in thread
Hi all,
I want to write a AutoCAD extension(arx format). I planed to use qt to write the GUI. But I encountered a problem.
When the extension popup a dialog, it should use the AutoCAD main window as its parent. But QT widget use QWidget as its parent. So I must create a QWidget using the AutoCAD main window handle first. The problem is AutoCAD doesn't support unicode. After the dialog has poped up, the title and some menuitem text becomes garbage. When I unload the extension, all becomes normal. The following is the codes I used,
class ACADMainWidget:public QWidget
{
Q_OBJECT
public:
ACADMainWidget();
~ACADMainWidget();
private:
WId oldwid;
long oldproc;
};
ACADMainWidget::ACADMainWidget():QWidget()
{
WId hwnd=(WId)adsw_acadMainWnd();
oldwid=winId();
oldproc=GetWindowLong(hwnd, GWL_WNDPROC);
create(hwnd, true, false);
}
ACADMainWidget::~ACADMainWidget()
{
WId hwnd=(WId)adsw_acadMainWnd();
create(oldwid, true, false);
SetWindowLong(hwnd, GWL_WNDPROC, oldproc);
}
How can I solve this problem?
Thanks in advance.
Message 2 in thread
Morphes Lee <morphes@x263.net> wrote:
>Hi all,
> I want to write a AutoCAD extension(arx format). I planed to use qt
>to write the GUI. But I encountered a problem.
> When the extension popup a dialog, it should use the AutoCAD main
>window as its parent. But QT widget use QWidget as its parent. So I
>must create a QWidget using the AutoCAD main window handle first. The
>problem is AutoCAD doesn't support unicode. After the dialog has poped
>up, the title and some menuitem text becomes garbage. When I unload the
>extension, all becomes normal. The following is the codes I used,
I know nothing about AutoCAD and there may be an alternative solution
but if necessary you can tweak Qt to remove the UNICODE option and
rebuild Qt.
The GUI installer doesn't offer this option so you need to use your
favourite text editor to remove the relevant line from qmake.conf, then
go to the command line, run "nmake clean" in your QTDIR to remove your
old Qt build, then "configure -redo" to rebuild all the makefiles, and
then "nmake" to rebuild Qt and all tools with the new makefiles.
Maybe not the first thing to try, but possibly handy as a fallback?
--
[ signature omitted ]