summaryrefslogtreecommitdiffstats
path: root/Source/QtDialog/AddCacheEntry.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/QtDialog/AddCacheEntry.cxx')
-rw-r--r--Source/QtDialog/AddCacheEntry.cxx64
1 files changed, 29 insertions, 35 deletions
diff --git a/Source/QtDialog/AddCacheEntry.cxx b/Source/QtDialog/AddCacheEntry.cxx
index efb2b65..dc7a4b0 100644
--- a/Source/QtDialog/AddCacheEntry.cxx
+++ b/Source/QtDialog/AddCacheEntry.cxx
@@ -17,21 +17,23 @@
static const int NumTypes = 4;
static const int DefaultTypeIndex = 0;
-static const QByteArray TypeStrings[NumTypes] =
- { "BOOL", "PATH", "FILEPATH", "STRING" };
-static const QCMakeProperty::PropertyType Types[NumTypes] =
- { QCMakeProperty::BOOL, QCMakeProperty::PATH,
- QCMakeProperty::FILEPATH, QCMakeProperty::STRING};
+static const QByteArray TypeStrings[NumTypes] = { "BOOL", "PATH", "FILEPATH",
+ "STRING" };
+static const QCMakeProperty::PropertyType Types[NumTypes] = {
+ QCMakeProperty::BOOL, QCMakeProperty::PATH, QCMakeProperty::FILEPATH,
+ QCMakeProperty::STRING
+};
AddCacheEntry::AddCacheEntry(QWidget* p, const QStringList& varNames,
- const QStringList& varTypes)
- : QWidget(p), VarNames(varNames), VarTypes(varTypes)
+ const QStringList& varTypes)
+ : QWidget(p)
+ , VarNames(varNames)
+ , VarTypes(varTypes)
{
this->setupUi(this);
- for(int i=0; i<NumTypes; i++)
- {
+ for (int i = 0; i < NumTypes; i++) {
this->Type->addItem(TypeStrings[i]);
- }
+ }
QWidget* cb = new QCheckBox();
QWidget* path = new QCMakePathEditor();
QWidget* filepath = new QCMakeFilePathEditor();
@@ -46,10 +48,10 @@ AddCacheEntry::AddCacheEntry(QWidget* p, const QStringList& varNames,
this->setTabOrder(path, filepath);
this->setTabOrder(filepath, string);
this->setTabOrder(string, this->Description);
- QCompleter *completer = new QCompleter(this->VarNames, this);
+ QCompleter* completer = new QCompleter(this->VarNames, this);
this->Name->setCompleter(completer);
- connect(completer, SIGNAL(activated(const QString&)),
- this, SLOT(onCompletionActivated(const QString&)));
+ connect(completer, SIGNAL(activated(const QString&)), this,
+ SLOT(onCompletionActivated(const QString&)));
}
QString AddCacheEntry::name() const
@@ -60,14 +62,11 @@ QString AddCacheEntry::name() const
QVariant AddCacheEntry::value() const
{
QWidget* w = this->StackedWidget->currentWidget();
- if(qobject_cast<QLineEdit*>(w))
- {
+ if (qobject_cast<QLineEdit*>(w)) {
return static_cast<QLineEdit*>(w)->text();
- }
- else if(qobject_cast<QCheckBox*>(w))
- {
+ } else if (qobject_cast<QCheckBox*>(w)) {
return static_cast<QCheckBox*>(w)->isChecked();
- }
+ }
return QVariant();
}
@@ -79,36 +78,31 @@ QString AddCacheEntry::description() const
QCMakeProperty::PropertyType AddCacheEntry::type() const
{
int idx = this->Type->currentIndex();
- if(idx >= 0 && idx < NumTypes)
- {
+ if (idx >= 0 && idx < NumTypes) {
return Types[idx];
- }
+ }
return Types[DefaultTypeIndex];
}
QString AddCacheEntry::typeString() const
{
int idx = this->Type->currentIndex();
- if(idx >= 0 && idx < NumTypes)
- {
+ if (idx >= 0 && idx < NumTypes) {
return TypeStrings[idx];
- }
+ }
return TypeStrings[DefaultTypeIndex];
}
-void AddCacheEntry::onCompletionActivated(const QString &text)
+void AddCacheEntry::onCompletionActivated(const QString& text)
{
int idx = this->VarNames.indexOf(text);
- if (idx != -1)
- {
+ if (idx != -1) {
QString vartype = this->VarTypes[idx];
- for (int i = 0; i < NumTypes; i++)
- {
- if (TypeStrings[i] == vartype)
- {
- this->Type->setCurrentIndex(i);
- break;
- }
+ for (int i = 0; i < NumTypes; i++) {
+ if (TypeStrings[i] == vartype) {
+ this->Type->setCurrentIndex(i);
+ break;
}
}
+ }
}