开发者

QT qmake lowercases my custom widget names

开发者 https://www.devze.com 2022-12-29 20:09 出处:网络
I\'m using QT 4.6 on Linux and Windows, and on Linux, it insists on including my QScrollPane by qscrollpane.h

I'm using QT 4.6 on Linux and Windows, and on Linux, it insists on including my QScrollPane by qscrollpane.h

App.pro:

HEADERS += widgets/QScrollPane.h 

The section from mainform.ui

<widget class="QScrollPane" name="ListView">
 <property开发者_运维技巧 name="geometry">
  <rect>
   <x>0</x>
   <y>0</y>
   <width>500</width>
   <height>490</height>
  </rect>
 </property>
</widget>

The ui_mainform.h file:

 #include <QtGui/QStatusBar>
 #include <QtGui/QTabWidget>
 #include <QtGui/QWidget>
 #include <qscrollpane.h>

This isn't a big deal on Windows or Mac, but on Linux it's downright annoying. I could create a symlink to solve the issue, but I want to find the root cause.

Regards, -Chris


You need to provide more info about your custom widget. Add the following to your mainform.ui:

<customwidgets>
 <customwidget>
  <class>QScrollPane</class>
  <extends>QWidget or whatever class is QScrollPane parent</extends>
  <header>QScrollPane.h</header>
 </customwidget>
</customwidgets>

Should do the trick (disclaimer: tested only on Windows Qt 4.6.1).

I prefer using all lowercase filenames for my classes - I'm always 100% sure I won't be screwed up by some non 100% cross-platform tool.

0

精彩评论

暂无评论...
验证码 换一张
取 消