简体   繁体   English

Qt Designer不加载我的自定义小部件插件

[英]Qt Designer doesn't load my custom widget plugin

I'm reading the book "C++ GUI Programming with Qt4", and I've reached the topic of Integrating Custom Widgets with Qt Designer. 我正在阅读“使用Qt4进行C ++ GUI编程”一书,并且我已经讨论了将自定义小部件与Qt Designer集成的主题。

I've built the example project outlined there (the icon editor plugin), and I get a file called 'libiconeditorplugin.so', and I've copied it to '/usr/lib/qt4/plugins/designer/'. 我已经构建了那里概述的示例项目(图标编辑器插件),我得到一个名为'libiconeditorplugin.so'的文件,我将其复制到'/ usr / lib / qt4 / plugins / designer /'。 But when I start Qt Creator I don't see the icon editor widget in the widget box. 但是当我启动Qt Creator时,我没有在小部件框中看到图标编辑器小部件。

The only thing I've done differently from the book is I removed the DESTDIR from the .pro file because it had $QTDIR, and $QTDIR is not defined in my computer and I don't know where it should point. 我唯一与本书不同的是我从.pro文件中删除了DESTDIR,因为它有$ QTDIR,而我的计算机中没有定义$ QTDIR,我不知道应该指向哪里。 Instead, I copied the .so file manually. 相反,我手动复制了.so文件。

I'm not sure if I've copied the plugin in the right directory, and if libiconeditorplugin.so is the only file that I needed to copy, the book was kind of sketchy on how it should work. 我不确定我是否已将插件复制到正确的目录中,如果libiconeditorplugin.so是我需要复制的唯一文件,那么该书对于它应该如何工作有点粗略。

My OS is Ubuntu and I've installed Qt Creator with apt-get. 我的操作系统是Ubuntu,我用apt-get安装了Qt Creator。

Turns out I was copying libiconeditorplugin.so to the wrong directory. 原来我正在将libiconeditorplugin.so复制到错误的目录。 I was copying it to " /usr/lib/qt4/plugins/designer/ ", while Qt Designer was looking in " /usr/lib/x86_64-linux-gnu/qt4/plugins/designer/ ". 我将它复制到“ / usr / lib / qt4 / plugins / designer / ”,而Qt Designer则查看“ / usr / lib / x86_64-linux-gnu / qt4 / plugins / designer / ”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM