[Qt-creator] Shadown Builds and Completion in UI Classes

Chris W chrisw_junk at yahoo.com.au
Sun Jun 21 09:55:35 CEST 2009


Hello All,

Qt 1.1.0, and 21 June snapshot, Qt 4.5.1 on Linux.

If I use the Qt Creator shadow build feature, or a .pro that does a similar
thing explicitly, then code completion in UI classes fails.  It seems the
completer does not look in the shadow directory for ui_*.h files or does not
parse then well.  Rather than being shown the widget members of the UI I am
shown only the class name from the Ui name space.  For example, in the generic
generated code below completion fails after typing "m_ui->" showing only
"AlarmView" rather than a list containing the two widgets in the designer and
the ui_alarmview.h files.

If I disable shadow building the completion works perfectly well.

Any thoughts?

Chris W

File: alarmview.h
----8< snip -------------------
#ifndef ALARMVIEW_H
#define ALARMVIEW_H
 
#include <QtGui/QWidget>
 
namespace Ui {
    class AlarmView;  // Completion only offers this
}
 
class AlarmView : public QWidget {
    Q_OBJECT
    Q_DISABLE_COPY(AlarmView)
public:
    explicit AlarmView(QWidget *parent = 0);
    virtual ~AlarmView();
 
protected:
    virtual void changeEvent(QEvent *e);
 
private:
    Ui::AlarmView *m_ui;
};
 
#endif // ALARMVIEW_H

File: alarmview.cpp
----8< snip -------------------
#include "alarmview.h"
#include "ui_alarmview.h"
 
AlarmView::AlarmView(QWidget *parent) :
    QWidget(parent),
    m_ui(new Ui::AlarmView)
{
    m_ui->setupUi(this);
    m_ui->  // Completion fails here and only offers the class AlarmView and not
the widgets
}
 
AlarmView::~AlarmView()
{
    delete m_ui;
}
 
void AlarmView::changeEvent(QEvent *e)
{
    QWidget::changeEvent(e);
    switch (e->type()) {
    case QEvent::LanguageChange:
        m_ui->retranslateUi(this);
        break;
    default:
        break;
    }
}






More information about the Qt-creator-old mailing list