前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >ObjectARX and Qt

ObjectARX and Qt

作者头像
用户3519280
发布2023-07-06 14:34:04
2550
发布2023-07-06 14:34:04
举报
文章被收录于专栏:c++ 学习分享c++ 学习分享

ObjectARX and Qt

Anyone know if its possible to use Qt classes in an ObjectARX application?

in reply to: jamierobertson1

‎12-02-2009 09:20 

Re: ObjectARX and Qt

I was experiencing with QT for last few days. This question already came into my mind. Following are the notes as per my observaion. 1. Linking the ObjectArx libraries with QT libraries. ( As both of the system are using Visual studio 2005 or similar versions, I feel it would not be a problem) 2. After executing a command suppose we have to display a dialog box, This can be done in following ways a. Check whether QTApplication has started or not. if it is we can post an event by using QApplication::postEvent() or QApplication::sendEvent(). 3. As we have already used the libraries of both QT and ObjectArx, we can mix ObjectArx Code in QT event handling procedures. Let me check whether we can link both of the Libraries, I will try to run a test application. But few questions arise on my mind. Like, Why you want to use QT libraries in your application as you can integrate C# rich user interface libraries with ObjectArx, Simply you have to write a module to link both C++ and C# applications. I know it is a bit tricky but it can be. Hope the above observation will help you. Thnaks & Regards Anirban Talukdar talukdar.anirban@gmail.com

‎12-03-2009 01:31 AM

‎12-03-200901:31 AM

Re: ObjectARX and Qt

Thanks for the reply, I was really just wondering if anyone has tried it before, and if so how painful was the experience and whats possible and not possible? My plan is to use c# for almost all my UI stuff, the only reason I'd like to use Qt is that I already have alot of Qt code like dialogs with QGraphicsViews and lots of calculations in Qt code etc which Im sure would take me forever to re-write in c# (plus I'm pretty new to c#). I'm currently thinking the simplest way ahead for me is to use c# as much as possible, keep my Qt stuff seperate and only where really neccesary pop up the occasional Qt widget using COM, I shouldnt really have to pass much data between them so it should be relatively easy. I'm keen to hear how your test goes, Regards, Jamie Robertson

Tags (0)

Add tags

Report

0 Likes

Reply

‎12-03-2009 01:38 AM

‎12-03-200901:38 AM

Re: ObjectARX and Qt

I will try to run. By the way if you have any overload of works, I can help you in this regard. I am looking for some works. Thanks & Regards Anirban Talukdar

‎12-03-2009 07:59 PM

‎12-03-200907:59 PM

Re: ObjectARX and Qt

Hi Robetson I found a good article on this. http://qtnode.net/wiki/Qt4_with_Visual_Studio Hope it will help you, I will also try to follow it on weekends. Thanks & Regards Anirban Talukdar

in reply to: jamierobertson1

‎12-04-2009 12:49 AM

‎12-04-200912:49 AM

Re: ObjectARX and Qt

Alternatively if your using VS 2008, you can just download the latest version of Qt for VS: [http://get.qt.nokia.com/qt/source/qt-win-opensource-4.6.0-vs2008.exe] Edited by: jamierobertson1 on Dec 4, 2009 8:50 AM

in reply to: jamierobertson1

‎12-07-2009 07:31 AM

‎12-07-200907:31 AM

Re: ObjectARX and Qt

Hi, I work on project (AutoCAD integration) implementing Qt in ARX and it works very well. Have a look on this article http://qt.nokia.com/products/appdev/add-on-products/catalog/4/Windows/qtwinmigrate. It talks about interactions between MFC <-> Qt. regards

‎12-08-2009 05:37 AM

‎12-08-200905:37 AM

Re: ObjectARX and Qt

Thanks, for that I'll take a look.

Tags (0)

‎04-25-2014 07:35 AM

‎04-25-201407:35 AM

Re: ObjectARX and Qt

Hello, i'm trying to integrate Qt in ARX. I have followed the article about migration from mfc to qt. Showing a QMessageBox::about using a QWinWidget succeeds but I do not succeed to show a simple QWidget (analogclock found in qt examples). Could you please give a minimal example of a QWidget shown in a command ? Regards

‎04-28-2014 05:03 AM

‎04-28-201405:03 AM

Re: ObjectARX and Qt

I don't understand why you succeed to display a QMessageBox but not a QDialog. Here's a simple example:

代码语言:javascript
复制
QWinWidget ww(adsw_acadMainWnd());
MyDialog dlg(&ww);
ww.showCentered();
dlg.exec();

Over time, I noticed that problems could appear at the objects deletion (due to QObject architecture, i.e. parent-child), so I recommand to use pointer and call delete in the right place and time.

Note: If you want to put Qt in palettes, use a QWinWidget too.

‎04-28-2014 05:06 AM

‎04-28-201405:06 AM

Re: ObjectARX and Qt

One more thing, assured yourself that you have a valid running QApplication (qApp).

‎04-28-2014 05:25 AM

‎04-28-201405:25 AM

Re: ObjectARX and Qt

Thank you very much, I think my problem came from the line dlg.exec(); I didn't know on which instance to call exec(). 

Where do you instantiate the QApplication? in the DllMain ? Do you call exec() on it or only on the QDialog 

‎04-28-2014 05:33 AM

‎04-28-201405:33 AM

Re: ObjectARX and Qt

I chose to initialize QApplication in On_kInitAppMsg and to destroy it (quit) in On_kUnloadAppMsg.

I use Qt for years, and it seems this is a good solution.

Regards,

‎12-10-2014 04:12 AM

‎12-10-201404:12 AM

Re: ObjectARX and Qt

Hi maisoui,

I followed your guides, qtwinmigrate and applied to ObjectARX 2015.

Succeeded to build ObjectARX MFC sample, "dynamic_dg", today.

But as you said, I encountered Runtime Error message, "...QWidget Must construct a QApplication before a QWidget".

Can you help me snippet code about QApplication?

Is it right place below initApp() or where?

Thanks in advance.

---------------

extern "C" AcRx::AppRetCode acrxEntryPoint( AcRx::AppMsgCode msg, void* pkt) {     switch( msg )     {     case AcRx::kInitAppMsg:         acrxUnlockApplication(pkt);         acrxRegisterAppMDIAware(pkt);         initApp();

        break;     case AcRx::kUnloadAppMsg:         unloadApp();         break;     default:         break;     }     return AcRx::kRetOK; }

Re: ObjectARX and Qt

Hi,

Yes, in your initApp you need to allocate a QApplication. You can use QtWinMigrate to create a QMfcApplication or do by yourself :

代码语言:javascript
复制
int argc = 0;
(void)new QApplication(argc, NULL);

From my my experience, I can say:

  • You don't need to configure a Windows Hook (using SetWindowsHookEx)
  • Maybe you need to call qApp->processEvents(); just after allocating the QApplication to correctly "initialize" in the events loop

Don't forget to delete your QApplication in your "unload app".

‎12-10-2014 06:28 AM

‎12-10-201406:28 AM

Re: ObjectARX and Qt

Thank you, Jonathan.

Another question I have.

After QApplication added to initApp(), I could not solve error, Qt's Windows Platform loading error, like attachements capture.

"This application failed to start because it could not find or load the Qt platform plugin "windows".

Available platform plugins are: minimal, offscreen, windows.

Reinstalling the application may fix this problem."

I know about the message, so I did copy them all to my arx folder(--; and autocad folder)

(C:\Qt\5.2.1\msvc2012_64\plugins\platforms\*.dll)

Jonathan, you could save me. Thanks a lot.

‎12-10-2014 07:16 AM

‎12-10-201407:16 AM

Re: ObjectARX and Qt

I'm progressing some test scenarios. After that, I'll post my result. Regards,

‎12-11-2014 12:17 AM

‎12-11-201412:17 AM

Re: ObjectARX and Qt

Yes, you're right. For each OS Qt5 needs to load a specific plugin. For Windows, it's qwindow[d].dll. It's like other Qt plugins, subfolders must be in an accessible path. When you debug, you can simply use : PATH="

‎12-16-2014 10:49 PM

‎12-16-201410:49 PM

Re: ObjectARX and Qt

Hi, Jonathan ...

I tested basic Qt(5.2.1_x64) Loading on AutoCAD 2015 Platform until now, and succeeded following QMessageBox, very infant code.^^

Thanks for your helps. I'll develop this to next step application using QWinWidget as you said.

Regards,

Myeong Hwan, Kim

dynamic.arx => AutoCAD MFC Sample

icudt51.dll icuin51.dll icuuc51.dll

libEGL.dll

libGLESv2.dll Qt5Core.dll Qt5Gui.dll Qt5Widgets.dll qwindows.dll => plugins/platform for windows

代码语言:javascript
复制
_putenv("QT_QPA_PLATFORM_PLUGIN_PATH=C:/temp"); // Environmental variable 1...
_putenv("PATH=C:/temp;%PATH%"); // Environmental variable 2...
int argc = 0;
(void)new QApplication(argc, NULL);
//qApp->processEvents();
//QMessageBox::critical(0, QObject::tr("Test"), QObject::tr("Critical Messages...")); // OK!
//QMessageBox::about(&win, "About QtMfc", "QtMFC Version 1.0\nCopyright (C) 2014"); // window handle?
QMessageBox::about(0, "About QtMfc", "QtMFC Version 1.0\nCopyright (C) 2014"); //OK!

‎12-19-2014 01:59 AM

‎12-19-201401:59 AM

Re: ObjectARX and Qt

Thanks... I could now implement addin code on AutoCAD, more about Revit using Qt's Dialog. But, struggling on AutoCAD Palette using QWinWidget Class for this weekend. Can you guide about that? Everything is helpful. Especially about QWinWidget's constructor code and QApplication Instance. Thanks a lot.

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2023-06-28,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • ObjectARX and Qt
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档