Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. I have encountered some issues regarding the QT window DLL.
Qt 6.11 is out! See what's new in the release blog

I have encountered some issues regarding the QT window DLL.

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 2 Posters 425 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Javalitterboy
    wrote on last edited by Javalitterboy
    #1

    I am using Ruby C extensions in Sketchup to call QT windows.
    I compiled using the vc142 environment instead of qmake.
    1.How should I handle QApplication? I have already initialized an app every time a window is displayed.
    2.After app. exec(), Sketchup no longer receives any key events.

    #include "quickseachdialog.h"
    #include <QtWidgets/QWidget>
    #include <QtWidgets/QApplication>
    #include "RubyUtils.h"
    
    static bool init_app = false;
    
    class QuickSeachDialog : public QWidget
    {
    public:
    	QuickSeachDialog(QWidget* parent = nullptr);
    	~QuickSeachDialog();
    };
    
    QuickSeachDialog::QuickSeachDialog(QWidget *parent)
    	: QWidget(parent)
    {
    	// 设置窗口标题和尺寸
    	setWindowTitle("Search Command");
    	resize(800, 600);
    }
    
    QuickSeachDialog::~QuickSeachDialog()
    {
    }
    
    VALUE rbf_show_quick_seach(VALUE self) {
    	int argc = 0;
    	char* argv[] = { nullptr };
    	QApplication app(argc, argv);
    	QuickSeachDialog dialog;
    	dialog.show();
    	app.exec();
    	return Qnil;
    }
    
    void InitQtDialog()
    {
    	VALUE DFC = rb_define_module("DFC");
    
    	VALUE qt_dialog = rb_define_class_under(DFC, "QtDialog", rb_cObject);
    	rb_define_module_function(qt_dialog, "show_quick_seach", VALUEFUNC(rbf_show_quick_seach), 0);
    }
    
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Your return statement will only execute when you end the Qt application part such as when closing the dialog.
      Are you sure that the architecture of Sketchup allows for a secondary event loop to be running or that it could be controlled by the Sketchup event loop ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      J 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi and welcome to devnet,

        Your return statement will only execute when you end the Qt application part such as when closing the dialog.
        Are you sure that the architecture of Sketchup allows for a secondary event loop to be running or that it could be controlled by the Sketchup event loop ?

        J Offline
        J Offline
        Javalitterboy
        wrote on last edited by Javalitterboy
        #3

        @SGaist said in I have encountered some issues regarding the QT window DLL.:

        Are you sure that the architecture of Sketchup allows for a secondary event loop to be running or that it could be controlled by the Sketchup event loop ?

        I'm not sure.
        Sketchup 2022 is developed based on MFC, while Sketchup 2023 is developed based on QT5.
        Should I send the event from QApplication to the Sketchup main window.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          If there's already a Qt event loop running, you should not need to create a new one.

          That said, did you check with the Sketchup folks to see if there's a documented way to use Qt in the plugins ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          J 1 Reply Last reply
          0
          • SGaistS SGaist

            If there's already a Qt event loop running, you should not need to create a new one.

            That said, did you check with the Sketchup folks to see if there's a documented way to use Qt in the plugins ?

            J Offline
            J Offline
            Javalitterboy
            wrote on last edited by
            #5

            @SGaist Thank you. Let me ask.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved