diff options
author | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2010-08-23 12:55:39 (GMT) |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2010-08-23 12:55:39 (GMT) |
commit | 00e954ca817f89958a8a8777d93d3843252dc88c (patch) | |
tree | 1e270f03368f967e8cb90b26bb44068009f79936 /tools/designer/src/lib/shared | |
parent | 6fc62c47739cedb5f3bc8de3004f68b62de991f2 (diff) | |
download | Qt-00e954ca817f89958a8a8777d93d3843252dc88c.zip Qt-00e954ca817f89958a8a8777d93d3843252dc88c.tar.gz Qt-00e954ca817f89958a8a8777d93d3843252dc88c.tar.bz2 |
Qt Designer/Integrations: Add properties for use by C++-IDEs.
...such as the header suffix (like ".h") or whether headers should
be lowercase only. Allows for using different suffixes and
conventions like 'CamelCase.hxx", etc.
Reviewed-by: Jarek Kobus <jaroslaw.kobus@nokia.com>
API-reviewed-by: Kai Koehne <kai.koehne@nokia.com>
Task-number: QTCREATORBUG-163
Diffstat (limited to 'tools/designer/src/lib/shared')
-rw-r--r-- | tools/designer/src/lib/shared/qdesigner_promotiondialog.cpp | 12 | ||||
-rw-r--r-- | tools/designer/src/lib/shared/qdesigner_promotiondialog_p.h | 11 |
2 files changed, 20 insertions, 3 deletions
diff --git a/tools/designer/src/lib/shared/qdesigner_promotiondialog.cpp b/tools/designer/src/lib/shared/qdesigner_promotiondialog.cpp index eca6615..1fbfccb 100644 --- a/tools/designer/src/lib/shared/qdesigner_promotiondialog.cpp +++ b/tools/designer/src/lib/shared/qdesigner_promotiondialog.cpp @@ -49,6 +49,7 @@ #include <QtDesigner/QDesignerFormWindowInterface> #include <QtDesigner/QDesignerPromotionInterface> #include <QtDesigner/QDesignerWidgetDataBaseItemInterface> +#include <QtDesigner/QDesignerIntegrationInterface> #include <abstractdialoggui_p.h> #include <QtCore/QTimer> @@ -152,8 +153,13 @@ namespace qdesigner_internal { void NewPromotedClassPanel::slotNameChanged(const QString &className) { // Suggest a name if (!className.isEmpty()) { - QString suggestedHeader = className.toLower().replace(QLatin1String("::"), QString(QLatin1Char('_'))); - suggestedHeader += QLatin1String(".h"); + const QChar dot(QLatin1Char('.')); + QString suggestedHeader = m_promotedHeaderLowerCase ? + className.toLower() : className; + suggestedHeader.replace(QLatin1String("::"), QString(QLatin1Char('_'))); + if (!m_promotedHeaderSuffix.startsWith(dot)) + suggestedHeader += dot; + suggestedHeader += m_promotedHeaderSuffix; const bool blocked = m_includeFileEdit->blockSignals(true); m_includeFileEdit->setText(suggestedHeader); @@ -248,6 +254,8 @@ namespace qdesigner_internal { preselectedBaseClass = baseClassNameList.indexOf(QLatin1String("QFrame")); NewPromotedClassPanel *newPromotedClassPanel = new NewPromotedClassPanel(baseClassNameList, preselectedBaseClass); + newPromotedClassPanel->setPromotedHeaderSuffix(core->integration()->headerSuffix()); + newPromotedClassPanel->setPromotedHeaderLowerCase(core->integration()->isHeaderLowercase()); connect(newPromotedClassPanel, SIGNAL(newPromotedClass(PromotionParameters,bool*)), this, SLOT(slotNewPromotedClass(PromotionParameters,bool*))); connect(this, SIGNAL(selectedBaseClassChanged(QString)), newPromotedClassPanel, SLOT(chooseBaseClass(QString))); diff --git a/tools/designer/src/lib/shared/qdesigner_promotiondialog_p.h b/tools/designer/src/lib/shared/qdesigner_promotiondialog_p.h index 1e63d81..f2a2b2a 100644 --- a/tools/designer/src/lib/shared/qdesigner_promotiondialog_p.h +++ b/tools/designer/src/lib/shared/qdesigner_promotiondialog_p.h @@ -84,7 +84,13 @@ namespace qdesigner_internal { int selectedBaseClass = -1, QWidget *parent = 0); - signals: + QString promotedHeaderSuffix() const { return m_promotedHeaderSuffix; } + void setPromotedHeaderSuffix(const QString &s) { m_promotedHeaderSuffix = s; } + + bool isPromotedHeaderLowerCase() const { return m_promotedHeaderLowerCase; } + void setPromotedHeaderLowerCase(bool l) { m_promotedHeaderLowerCase = l; } + + signals: void newPromotedClass(const PromotionParameters &, bool *ok); public slots: @@ -100,6 +106,9 @@ namespace qdesigner_internal { PromotionParameters promotionParameters() const; void enableButtons(); + QString m_promotedHeaderSuffix; + bool m_promotedHeaderLowerCase; + QComboBox *m_baseClassCombo; QLineEdit *m_classNameEdit; QLineEdit *m_includeFileEdit; |