This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
I have the following setting: netbeans C++ extension, Qt installed on C:\Qt\4.3.4, Mingw compiler in C:\MinGw. PATH set to PATH=C:\Qt\4.3.4\bin;C:\MinGW\bin;C:\WINDOWS\System32;C:\_E\cygwin\bin; Include diretories C:\Qt\4.3.4\include\Qt, C:\Qt\4.3.4\include\QtCore, C:\Qt\4.3.4\include\Qt\UITools, C:\Qt\4.3.4\include\QtGui have been added to both C and C++ code assistance. To demonstrate type the following source: QPushButton hello; hello.|resize(100, 200); The | shows a possible place for the cursor. <Crtl><Space> shows: no suggestions. Same behavior in netbeans 6.0 and 6.1. In Linux: it is working correctly.
thanks, we'll investigate. Use Unix for now ;-)
Created attachment 59733 [details] But I have code completion (qt 4.3.2). But it doesn't contain 'resize' method.
Could the issue be a recursion problem, when the code completion module scans the header files? I discovered the following while trying to code complete a QPushButton: Situtation 1: Source line is #include <QPushButton> Typing out the contents of the file QPushButton yields C:\Qt\4.3.4\include\QtGui>type QPushButton #include "qpushbutton.h" C:\Qt\4.3.4\include\QtGui>type qpushbutton.h #include "../../src/gui/widgets/qpushbutton.h" This shows that finding the final definitions for the QPushButton class requires a look-up through several #include files. When I #include a header that requires only ONE recursion it works: Situation 2: Here the source line is #include <qpushButton.h> C:\Qt\4.3.4\include\Qt>type qpushbutton.h #include "../../src/gui/widgets/qpushbutton.h" THEN CODE COMPLETION WORKS! (Remark: both the C:\Qt\4.3.4\include\Qt, and C:\Qt\4.3.4\include\QtGui directories are in my "code assistance directory list"). Maybe this helps to resolve the bug. Cheers, Wolfgang
Can you try such scenario? - Add 'C:\Qt\4.3.4\include' path into C++ code assistance also - Close NetBeans - Delete old cache in C:\Documents and Settings\<USER>\Local Settings\Temp\<USER>-cnd60-caches-0\ - Verify code completion again
This WORKED in Netbeans 6.1, although not in Netbeans 6.0.1. One strange thing remains: QPushButton hello; hello.set|Text("hello "); hello.res|ize(150, 100); setText is code-completed alright, the resize method still refuses to get completed. It does so without any problems in Linux (even Netbeans 6.0). I noticed, however, that the Linux Qt includes do not use recursion so excessively. So there is a difference between Qt in different OSes. But your suggestion brought a big step forward in Windows. Many thanks!
So here is another follow-up. QPushButton is a subclass of QWidget. The missing resize method is from QWidget. Now QWidget is ignored by code completion completely: 1. #include <QWid|get> 2. int main(int argc, char *argv[]) { 3. QWid|get *w = new QWidget(); 4. w->|resize(500,500); Line 1: Suggests QWidget C:\Qt\4.3.4\include\QtGui Line 3: Suggests QWidgetData, QWidgetMap, etc. but not just QWidget Line 4: no suggestions The sequence of #include files is C:\Qt\4.3.4\include\QtGui>type QWidget #include "qwidget.h" C:\Qt\4.3.4\include\QtGui>type qwidget.h #include "../../src/gui/kernel/qwidget.h" C:\Qt\4.3.4\include\QtGui>type ..\..\src\gui\kernel\qwidget.h ... Here is the actual header information ... omitted because it is very long ... The file contains e.g. the resize method definition ... There might be some strange things in this qwidget.h file the parser does not understand? Can the parser be replaced or is it a netbeans built-in? I have all the includes as suggested in the previous comment. I now start netbeans from a .bat file which first empties out the temp directory: C:\Qt\4.3.4\bin>type netbeans-6.1.bat PATH=C:\Qt\4.3.4\bin;C:\MinGW\bin;C:\WINDOWS\System32;C:\_E\cygwin\bin; del /S /F /Q "C:\Documents and Settings\wp\Local Settings\Temp" "c:\Documents and Settings\All Users\Start Menu\Programs\NetBeans\NetBeans IDE 6.1 Beta.lnk"
I found bad string (Qt 4.3.2). - Open D:\Qt\4.3.2\src\gui\kernelqwidget.h file - Find 'friend Q_GUI_EXPORT QWidgetData *qt_qwidget_data(QWidget *widget);' line - Comment this line - Close NetBeans - Delete old cache in C:\Documents and Settings\<USER>\Local Settings\Temp\<USER>-cnd60-caches-0\ - Verify code completion again
Parser fails on such code (simple testcase): #define Q_DECL_IMPORT __declspec(dllimport) #define Q_GUI_EXPORT Q_DECL_IMPORT class QWidgetData { public: QWidgetData() {} }; class QObject { public: QObject() {} }; class QPaintDevice { public: QPaintDevice() {} }; class Q_GUI_EXPORT QWidget : public QObject, public QPaintDevice { public: int i; friend Q_GUI_EXPORT QWidgetData *qt_qwidget_data(QWidget *widget); };
It is *at least* a P2 bug, since the class QWidget from the example above disappears from the model completely. It's field "i" is shown as a global variable.
The reason is understood: the parser breaks on the __declspec(dllimport) construct. I think it's easy to fix.
I agree, it's easy to fix and very preferable to have in 6.1 as well. I will fix grammar
fixed in trunk http://hg.netbeans.org/main?cmd=changeset;node=8c89deab0e63 + test http://hg.netbeans.org/main?cmd=changeset;node=333fa8bf487d Please, review and approve integrating into 6.1
I reviewed the test. I agree that it's correct and safe.
verified in 200804040802 build + jars with fixes from developers
fix integrated in 6.1 http://hg.netbeans.org/release61?cmd=changeset;node=2d8f60a678f1
Bug not fixed. '__declspec' is predefined macro on Windows. Platform independent testcase: # 1 "newfile.cpp" # 1 "<built-in>" # 1 "<command line>" # 1 "newfile.cpp" class QWidgetData { public: QWidgetData() {} }; class QObject { public: QObject() {} }; class QPaintDevice { public: QPaintDevice() {} }; class __attribute__((dllimport)) QWidget : public QObject, public QPaintDevice { public: int i; friend __attribute__((dllimport)) QWidgetData *qt_qwidget_data(QWidget *widget); };
From your example I see, that it's not predefined, but otherwise :-) If you generated output by gcc => gcc has: #define __declspec(x) __attribute__((x))
additional fix in trunk: http://hg.netbeans.org/main?cmd=changeset;node=c9ecea2561c9 + test http://hg.netbeans.org/main?cmd=changeset;node=94f4c97f97e7 and in release61: http://hg.netbeans.org/release61?cmd=changeset;node=3905c3c9f608
verified in 200804082140 build (branch: release61)
Created attachment 59885 [details] Qt in NetBeans (screenshot)