summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@digia.com>2012-10-30 17:29:54 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-10-31 10:06:49 +0100
commiteb1406272c4eafc5aa112c491cb82c20d7c73862 (patch)
tree26fc1edec129ff338e3ed2c6cb78caf8fe9f53b1 /src
parentfc209e432b3fa561969ccab37083aa5ee31b6a6d (diff)
downloadqtactiveqt-eb1406272c4eafc5aa112c491cb82c20d7c73862.tar.gz
Remove dependency on a generated ui header file in a public header file
Since the public headers can be installed then it is not really a good idea to have generated ui header files included in them. Therefore this changes how the ui code is utilized so it creates it as a member rather than subclassing the class instead. Task-number: QTBUG-27776 (partial) Change-Id: I79a2a3f775202133bb6d7f2f30e0b6d86c9fa1fd Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Diffstat (limited to 'src')
-rw-r--r--src/activeqt/container/qaxselect.cpp33
-rw-r--r--src/activeqt/container/qaxselect.h17
2 files changed, 30 insertions, 20 deletions
diff --git a/src/activeqt/container/qaxselect.cpp b/src/activeqt/container/qaxselect.cpp
index 88db313..1797fe9 100644
--- a/src/activeqt/container/qaxselect.cpp
+++ b/src/activeqt/container/qaxselect.cpp
@@ -41,6 +41,7 @@
#include "qaxselect.h"
#ifndef QT_NO_WIN_ACTIVEQT
+#include "ui_qaxselect.h"
#include <qt_windows.h>
@@ -120,35 +121,43 @@ QVariant ControlList::data(const QModelIndex &index, int role) const
}
QAxSelect::QAxSelect(QWidget *parent, Qt::WindowFlags f)
-: QDialog(parent, f)
+: QDialog(parent, f), selectUi(new Ui::QAxSelect)
{
#ifndef QT_NO_CURSOR
QApplication::setOverrideCursor(Qt::WaitCursor);
#endif
-
- setupUi(this);
- ActiveXList->setModel(new ControlList(this));
- connect(ActiveXList->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)),
+ selectUi->setupUi(this);
+ selectUi->ActiveXList->setModel(new ControlList(this));
+ connect(selectUi->ActiveXList->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)),
this, SLOT(on_ActiveXList_clicked(QModelIndex)));
#ifndef QT_NO_CURSOR
QApplication::restoreOverrideCursor();
#endif
- ActiveXList->setFocus();
+ selectUi->ActiveXList->setFocus();
+
+ connect(selectUi->buttonOk, SIGNAL(clicked()), this, SLOT(accept()));
+ connect(selectUi->buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
+}
- connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept()));
- connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
+QAxSelect::~QAxSelect()
+{
+}
+
+QString QAxSelect::clsid() const
+{
+ return selectUi->ActiveX->text();
}
void QAxSelect::on_ActiveXList_clicked(const QModelIndex &index)
{
- QVariant clsid = ActiveXList->model()->data(index, Qt::UserRole);
- ActiveX->setText(clsid.toString());
+ QVariant clsid = selectUi->ActiveXList->model()->data(index, Qt::UserRole);
+ selectUi->ActiveX->setText(clsid.toString());
}
void QAxSelect::on_ActiveXList_doubleClicked(const QModelIndex &index)
{
- QVariant clsid = ActiveXList->model()->data(index, Qt::UserRole);
- ActiveX->setText(clsid.toString());
+ QVariant clsid = selectUi->ActiveXList->model()->data(index, Qt::UserRole);
+ selectUi->ActiveX->setText(clsid.toString());
accept();
}
diff --git a/src/activeqt/container/qaxselect.h b/src/activeqt/container/qaxselect.h
index c5706a7..b07b8a4 100644
--- a/src/activeqt/container/qaxselect.h
+++ b/src/activeqt/container/qaxselect.h
@@ -40,13 +40,8 @@
#ifndef QAXSELECT_H
#define QAXSELECT_H
-
#include <QtWidgets/QDialog>
-#ifndef QT_NO_WIN_ACTIVEQT
-#include "ui_qaxselect.h"
-#endif
-
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
@@ -55,17 +50,23 @@ QT_MODULE(ActiveQt)
#ifndef QT_NO_WIN_ACTIVEQT
-class QAxSelect : public QDialog, private Ui::QAxSelect
+namespace Ui {
+ class QAxSelect;
+}
+
+class QAxSelect : public QDialog
{
Q_OBJECT
public:
QAxSelect(QWidget *parent = 0, Qt::WindowFlags f = 0);
-
- QString clsid() const { return ActiveX->text(); }
+ ~QAxSelect();
+ QString clsid() const;
private Q_SLOTS:
void on_ActiveXList_clicked(const QModelIndex &index);
void on_ActiveXList_doubleClicked(const QModelIndex &index);
+private:
+ QScopedPointer<Ui::QAxSelect> selectUi;
};
QT_END_NAMESPACE