ENH: Add ability to add cache entries (even before first configure).
This commit is contained in:
parent
45a8e26fe1
commit
a81896eaed
|
@ -0,0 +1,71 @@
|
|||
|
||||
#include "AddCacheEntry.h"
|
||||
#include <QMetaProperty>
|
||||
|
||||
static const int NumTypes = 4;
|
||||
static const QString TypeStrings[NumTypes] =
|
||||
{ "BOOL", "PATH", "FILEPATH", "STRING" };
|
||||
static const QCMakeCacheProperty::PropertyType Types[NumTypes] =
|
||||
{ QCMakeCacheProperty::BOOL, QCMakeCacheProperty::PATH,
|
||||
QCMakeCacheProperty::FILEPATH, QCMakeCacheProperty::STRING};
|
||||
|
||||
AddCacheEntry::AddCacheEntry(QWidget* p)
|
||||
: QWidget(p)
|
||||
{
|
||||
this->setupUi(this);
|
||||
for(int i=0; i<NumTypes; i++)
|
||||
{
|
||||
this->Type->addItem(TypeStrings[i]);
|
||||
}
|
||||
QWidget* cb = new QCheckBox();
|
||||
QWidget* path = new QCMakeCachePathEditor();
|
||||
QWidget* filepath = new QCMakeCacheFilePathEditor();
|
||||
QWidget* string = new QLineEdit();
|
||||
this->StackedWidget->addWidget(cb);
|
||||
this->StackedWidget->addWidget(path);
|
||||
this->StackedWidget->addWidget(filepath);
|
||||
this->StackedWidget->addWidget(string);
|
||||
this->setTabOrder(this->Name, this->Type);
|
||||
this->setTabOrder(this->Type, cb);
|
||||
this->setTabOrder(cb, path);
|
||||
this->setTabOrder(path, filepath);
|
||||
this->setTabOrder(filepath, string);
|
||||
this->setTabOrder(string, this->Description);
|
||||
}
|
||||
|
||||
QString AddCacheEntry::name() const
|
||||
{
|
||||
return this->Name->text();
|
||||
}
|
||||
|
||||
QVariant AddCacheEntry::value() const
|
||||
{
|
||||
QWidget* w = this->StackedWidget->currentWidget();
|
||||
if(qobject_cast<QLineEdit*>(w))
|
||||
{
|
||||
return static_cast<QLineEdit*>(w)->text();
|
||||
}
|
||||
else if(qobject_cast<QCheckBox*>(w))
|
||||
{
|
||||
return static_cast<QCheckBox*>(w)->isChecked();
|
||||
}
|
||||
printf("didn't get anything %s\n", w->metaObject()->className());
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
QString AddCacheEntry::description() const
|
||||
{
|
||||
return this->Description->text();
|
||||
}
|
||||
|
||||
QCMakeCacheProperty::PropertyType AddCacheEntry::type() const
|
||||
{
|
||||
int idx = this->Type->currentIndex();
|
||||
if(idx >= 0 && idx < NumTypes)
|
||||
{
|
||||
return Types[idx];
|
||||
}
|
||||
return QCMakeCacheProperty::BOOL;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
|
||||
#ifndef AddCacheEntry_h
|
||||
#define AddCacheEntry_h
|
||||
|
||||
#include <QWidget>
|
||||
#include <QCheckBox>
|
||||
|
||||
#include "QCMake.h"
|
||||
#include "ui_AddCacheEntry.h"
|
||||
|
||||
class AddCacheEntry : public QWidget, public Ui::AddCacheEntry
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AddCacheEntry(QWidget* p);
|
||||
|
||||
QString name() const;
|
||||
QVariant value() const;
|
||||
QString description() const;
|
||||
QCMakeCacheProperty::PropertyType type() const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
<ui version="4.0" >
|
||||
<class>AddCacheEntry</class>
|
||||
<widget class="QWidget" name="AddCacheEntry" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>380</width>
|
||||
<height>158</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="text" >
|
||||
<string>Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QLineEdit" name="Name" />
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="label_2" >
|
||||
<property name="text" >
|
||||
<string>Type:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QComboBox" name="Type" >
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<widget class="QLabel" name="label_5" >
|
||||
<property name="text" >
|
||||
<string>Value:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" >
|
||||
<widget class="QStackedWidget" name="StackedWidget" >
|
||||
<property name="currentIndex" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" >
|
||||
<widget class="QLabel" name="label_3" >
|
||||
<property name="text" >
|
||||
<string>Description:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" >
|
||||
<widget class="QLineEdit" name="Description" />
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>QCMakeCachePathEditor</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>QCMakeCacheView.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>QCMakeCacheFilePathEditor</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>QCMakeCacheView.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>Type</sender>
|
||||
<signal>currentIndexChanged(int)</signal>
|
||||
<receiver>StackedWidget</receiver>
|
||||
<slot>setCurrentIndex(int)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>229</x>
|
||||
<y>34</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>287</x>
|
||||
<y>65</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
|
@ -9,6 +9,8 @@ ELSE(NOT QT4_FOUND)
|
|||
INCLUDE(${QT_USE_FILE})
|
||||
|
||||
SET(SRCS
|
||||
AddCacheEntry.cxx
|
||||
AddCacheEntry.h
|
||||
CMakeSetup.cxx
|
||||
CMakeSetupDialog.cxx
|
||||
CMakeSetupDialog.h
|
||||
|
@ -19,8 +21,10 @@ ELSE(NOT QT4_FOUND)
|
|||
)
|
||||
QT4_WRAP_UI(UI_SRCS
|
||||
CMakeSetupDialog.ui
|
||||
AddCacheEntry.ui
|
||||
)
|
||||
QT4_WRAP_CPP(MOC_SRCS
|
||||
AddCacheEntry.h
|
||||
CMakeSetupDialog.h
|
||||
QCMake.h
|
||||
QCMakeCacheView.h
|
||||
|
|
|
@ -2,5 +2,6 @@
|
|||
<qresource prefix="/Icons" >
|
||||
<file>CMakeSetup.png</file>
|
||||
<file>Delete16.png</file>
|
||||
<file>Plus16.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
|
||||
#include "QCMake.h"
|
||||
#include "QCMakeCacheView.h"
|
||||
#include "AddCacheEntry.h"
|
||||
|
||||
QCMakeThread::QCMakeThread(QObject* p)
|
||||
: QThread(p), CMakeInstance(NULL)
|
||||
|
@ -82,6 +83,7 @@ CMakeSetupDialog::CMakeSetupDialog()
|
|||
this->setCentralWidget(cont);
|
||||
this->ProgressBar->reset();
|
||||
this->RemoveEntry->setEnabled(false);
|
||||
this->AddEntry->setEnabled(false);
|
||||
|
||||
QMenu* FileMenu = this->menuBar()->addMenu(tr("&File"));
|
||||
this->ReloadCacheAction = FileMenu->addAction(tr("&Reload Cache"));
|
||||
|
@ -186,6 +188,8 @@ void CMakeSetupDialog::initialize()
|
|||
this, SLOT(selectionChanged()));
|
||||
QObject::connect(this->RemoveEntry, SIGNAL(clicked(bool)),
|
||||
this, SLOT(removeSelectedCacheEntries()));
|
||||
QObject::connect(this->AddEntry, SIGNAL(clicked(bool)),
|
||||
this, SLOT(addCacheEntry()));
|
||||
|
||||
// get the saved binary directories
|
||||
QStringList buildPaths = this->loadBuildPaths();
|
||||
|
@ -449,8 +453,8 @@ void CMakeSetupDialog::setEnabledState(bool enabled)
|
|||
this->DeleteCacheAction->setEnabled(enabled);
|
||||
this->ExitAction->setEnabled(enabled);
|
||||
this->ConfigureAction->setEnabled(enabled);
|
||||
this->AddEntry->setEnabled(enabled);
|
||||
this->RemoveEntry->setEnabled(false); // let selection re-enable it
|
||||
// generate button/action are handled separately
|
||||
}
|
||||
|
||||
void CMakeSetupDialog::promptForGenerator()
|
||||
|
@ -735,4 +739,38 @@ void CMakeSetupDialog::enterState(CMakeSetupDialog::State s)
|
|||
}
|
||||
}
|
||||
|
||||
void CMakeSetupDialog::addCacheEntry()
|
||||
{
|
||||
QDialog dialog(this);
|
||||
dialog.resize(400, 200);
|
||||
dialog.setWindowTitle(tr("CMakeSetup Help"));
|
||||
QVBoxLayout* l = new QVBoxLayout(&dialog);
|
||||
AddCacheEntry* w = new AddCacheEntry(&dialog);
|
||||
QDialogButtonBox* btns = new QDialogButtonBox(
|
||||
QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
|
||||
Qt::Horizontal, &dialog);
|
||||
QObject::connect(btns, SIGNAL(accepted()), &dialog, SLOT(accept()));
|
||||
QObject::connect(btns, SIGNAL(rejected()), &dialog, SLOT(reject()));
|
||||
l->addWidget(w);
|
||||
l->addStretch();
|
||||
l->addWidget(btns);
|
||||
if(QDialog::Accepted == dialog.exec())
|
||||
{
|
||||
QCMakeCacheModel* m = this->CacheValues->cacheModel();
|
||||
m->insertRows(0, 1, QModelIndex());
|
||||
m->setData(m->index(0, 0), w->type(), QCMakeCacheModel::TypeRole);
|
||||
m->setData(m->index(0, 0), w->name(), Qt::DisplayRole);
|
||||
m->setData(m->index(0, 0), w->description(), QCMakeCacheModel::HelpRole);
|
||||
m->setData(m->index(0, 0), 0, QCMakeCacheModel::AdvancedRole);
|
||||
if(w->type() == QCMakeCacheProperty::BOOL)
|
||||
{
|
||||
m->setData(m->index(0, 1), w->value().toBool() ?
|
||||
Qt::Checked : Qt::Unchecked, Qt::CheckStateRole);
|
||||
}
|
||||
else
|
||||
{
|
||||
m->setData(m->index(0, 1), w->value(), Qt::DisplayRole);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -69,6 +69,7 @@ protected slots:
|
|||
void setCacheModified();
|
||||
void removeSelectedCacheEntries();
|
||||
void selectionChanged();
|
||||
void addCacheEntry();
|
||||
|
||||
protected:
|
||||
|
||||
|
|
|
@ -149,6 +149,22 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="AddEntry" >
|
||||
<property name="toolTip" >
|
||||
<string>Add New Entry</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Add Entry</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="CMakeSetup.qrc" >:/Icons/Plus16.png</iconset>
|
||||
</property>
|
||||
<property name="toolButtonStyle" >
|
||||
<enum>Qt::ToolButtonTextBesideIcon</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="RemoveEntry" >
|
||||
<property name="toolTip" >
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 358 B |
|
@ -148,9 +148,13 @@ void QCMake::generate()
|
|||
emit this->generateDone(err);
|
||||
}
|
||||
|
||||
void QCMake::setProperties(const QCMakeCachePropertyList& props)
|
||||
void QCMake::setProperties(const QCMakeCachePropertyList& newProps)
|
||||
{
|
||||
QCMakeCachePropertyList props = newProps;
|
||||
|
||||
QStringList toremove;
|
||||
|
||||
// set the value of properties
|
||||
cmCacheManager *cachem = this->CMakeInstance->GetCacheManager();
|
||||
for(cmCacheManager::CacheIterator i = cachem->NewIterator();
|
||||
!i.IsAtEnd(); i.Next())
|
||||
|
@ -180,15 +184,50 @@ void QCMake::setProperties(const QCMakeCachePropertyList& props)
|
|||
{
|
||||
i.SetValue(prop.Value.toString().toAscii().data());
|
||||
}
|
||||
props.removeAt(idx);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// remove some properites
|
||||
foreach(QString s, toremove)
|
||||
{
|
||||
cachem->RemoveCacheEntry(s.toAscii().data());
|
||||
}
|
||||
|
||||
// add some new properites
|
||||
foreach(QCMakeCacheProperty s, props)
|
||||
{
|
||||
if(s.Type == QCMakeCacheProperty::BOOL)
|
||||
{
|
||||
this->CMakeInstance->AddCacheEntry(s.Key.toAscii().data(),
|
||||
s.Value.toBool() ? "ON" : "OFF",
|
||||
s.Help.toAscii().data(),
|
||||
cmCacheManager::BOOL);
|
||||
}
|
||||
else if(s.Type == QCMakeCacheProperty::STRING)
|
||||
{
|
||||
this->CMakeInstance->AddCacheEntry(s.Key.toAscii().data(),
|
||||
s.Value.toString().toAscii().data(),
|
||||
s.Help.toAscii().data(),
|
||||
cmCacheManager::STRING);
|
||||
}
|
||||
else if(s.Type == QCMakeCacheProperty::PATH)
|
||||
{
|
||||
this->CMakeInstance->AddCacheEntry(s.Key.toAscii().data(),
|
||||
s.Value.toString().toAscii().data(),
|
||||
s.Help.toAscii().data(),
|
||||
cmCacheManager::PATH);
|
||||
}
|
||||
else if(s.Type == QCMakeCacheProperty::FILEPATH)
|
||||
{
|
||||
this->CMakeInstance->AddCacheEntry(s.Key.toAscii().data(),
|
||||
s.Value.toString().toAscii().data(),
|
||||
s.Help.toAscii().data(),
|
||||
cmCacheManager::FILEPATH);
|
||||
}
|
||||
}
|
||||
|
||||
cachem->SaveCache(this->BinaryDirectory.toAscii().data());
|
||||
}
|
||||
|
||||
|
|
|
@ -40,10 +40,12 @@ QCMakeCacheView::QCMakeCacheView(QWidget* p)
|
|||
this->AdvancedFilter->setSourceModel(this->CacheModel);
|
||||
this->AdvancedFilter->setFilterRole(QCMakeCacheModel::AdvancedRole);
|
||||
this->AdvancedFilter->setFilterRegExp(AdvancedRegExp[0]);
|
||||
this->AdvancedFilter->setDynamicSortFilter(true);
|
||||
this->SearchFilter = new QSortFilterProxyModel(this);
|
||||
this->SearchFilter->setSourceModel(this->AdvancedFilter);
|
||||
this->SearchFilter->setFilterCaseSensitivity(Qt::CaseInsensitive);
|
||||
this->SearchFilter->setFilterKeyColumn(-1); // all columns
|
||||
this->SearchFilter->setDynamicSortFilter(true);
|
||||
this->setModel(this->SearchFilter);
|
||||
|
||||
// our delegate for creating our editors
|
||||
|
@ -296,6 +298,19 @@ bool QCMakeCacheModel::setData (const QModelIndex& idx, const QVariant& value, i
|
|||
this->Properties[idx.row()].Value = value.toInt() == Qt::Checked;
|
||||
emit this->dataChanged(idx, idx);
|
||||
}
|
||||
else if(role == QCMakeCacheModel::HelpRole)
|
||||
{
|
||||
this->Properties[idx.row()].Help = value.toString();
|
||||
emit this->dataChanged(idx, idx);
|
||||
}
|
||||
else if(role == QCMakeCacheModel::TypeRole)
|
||||
{
|
||||
this->Properties[idx.row()].Type = static_cast<QCMakeCacheProperty::PropertyType>(value.toInt());
|
||||
}
|
||||
else if(role == QCMakeCacheModel::AdvancedRole)
|
||||
{
|
||||
this->Properties[idx.row()].Advanced = value.toBool();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -327,6 +342,26 @@ bool QCMakeCacheModel::removeRows(int row, int num, const QModelIndex&)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool QCMakeCacheModel::insertRows(int row, int num, const QModelIndex&)
|
||||
{
|
||||
if(row < 0)
|
||||
row = 0;
|
||||
if(row > this->rowCount())
|
||||
row = this->rowCount();
|
||||
|
||||
this->beginInsertRows(QModelIndex(), row, row+num-1);
|
||||
for(int i=0; i<num; i++)
|
||||
{
|
||||
this->Properties.insert(row+i, QCMakeCacheProperty());
|
||||
if(this->NewCount >= row)
|
||||
{
|
||||
this->NewCount++;
|
||||
}
|
||||
}
|
||||
this->endInsertRows();
|
||||
return true;
|
||||
}
|
||||
|
||||
QCMakeCacheModelDelegate::QCMakeCacheModelDelegate(QObject* p)
|
||||
: QItemDelegate(p)
|
||||
{
|
||||
|
@ -342,18 +377,18 @@ QWidget* QCMakeCacheModelDelegate::createEditor(QWidget* p,
|
|||
}
|
||||
else if(type == QCMakeCacheProperty::PATH)
|
||||
{
|
||||
return new QCMakeCachePathEditor(false, p);
|
||||
return new QCMakeCachePathEditor(p);
|
||||
}
|
||||
else if(type == QCMakeCacheProperty::FILEPATH)
|
||||
{
|
||||
return new QCMakeCachePathEditor(true, p);
|
||||
return new QCMakeCacheFilePathEditor(p);
|
||||
}
|
||||
|
||||
return new QLineEdit(p);
|
||||
}
|
||||
|
||||
QCMakeCachePathEditor::QCMakeCachePathEditor(bool fp, QWidget* p)
|
||||
: QLineEdit(p), IsFilePath(fp)
|
||||
QCMakeCacheFileEditor::QCMakeCacheFileEditor(QWidget* p)
|
||||
: QLineEdit(p)
|
||||
{
|
||||
// this *is* instead of has a line edit so QAbstractItemView
|
||||
// doesn't get confused with what the editor really is
|
||||
|
@ -363,18 +398,28 @@ QCMakeCachePathEditor::QCMakeCachePathEditor(bool fp, QWidget* p)
|
|||
this->ToolButton->setCursor(QCursor(Qt::ArrowCursor));
|
||||
QObject::connect(this->ToolButton, SIGNAL(clicked(bool)),
|
||||
this, SLOT(chooseFile()));
|
||||
}
|
||||
|
||||
QCMakeCacheFilePathEditor::QCMakeCacheFilePathEditor(QWidget* p)
|
||||
: QCMakeCacheFileEditor(p)
|
||||
{
|
||||
QCompleter* comp = new QCompleter(this);
|
||||
QDirModel* model = new QDirModel(comp);
|
||||
if(!fp)
|
||||
{
|
||||
// only dirs
|
||||
model->setFilter(QDir::AllDirs | QDir::Drives);
|
||||
}
|
||||
comp->setModel(model);
|
||||
this->setCompleter(comp);
|
||||
}
|
||||
|
||||
void QCMakeCachePathEditor::resizeEvent(QResizeEvent* e)
|
||||
QCMakeCachePathEditor::QCMakeCachePathEditor(QWidget* p)
|
||||
: QCMakeCacheFileEditor(p)
|
||||
{
|
||||
QCompleter* comp = new QCompleter(this);
|
||||
QDirModel* model = new QDirModel(comp);
|
||||
model->setFilter(QDir::AllDirs | QDir::Drives);
|
||||
comp->setModel(model);
|
||||
this->setCompleter(comp);
|
||||
}
|
||||
|
||||
void QCMakeCacheFileEditor::resizeEvent(QResizeEvent* e)
|
||||
{
|
||||
// make the tool button fit on the right side
|
||||
int h = e->size().height();
|
||||
|
@ -383,21 +428,26 @@ void QCMakeCachePathEditor::resizeEvent(QResizeEvent* e)
|
|||
this->setContentsMargins(0, 0, h, 0);
|
||||
}
|
||||
|
||||
void QCMakeCacheFilePathEditor::chooseFile()
|
||||
{
|
||||
// choose a file and set it
|
||||
QString path;
|
||||
QFileInfo info(this->text());
|
||||
path = QFileDialog::getOpenFileName(this, tr("Select File"),
|
||||
info.absolutePath());
|
||||
|
||||
if(!path.isEmpty())
|
||||
{
|
||||
this->setText(path);
|
||||
}
|
||||
}
|
||||
|
||||
void QCMakeCachePathEditor::chooseFile()
|
||||
{
|
||||
// choose a file and set it
|
||||
QString path;
|
||||
if(this->IsFilePath)
|
||||
{
|
||||
QFileInfo info(this->text());
|
||||
path = QFileDialog::getOpenFileName(this, tr("Select File"),
|
||||
info.absolutePath());
|
||||
}
|
||||
else
|
||||
{
|
||||
path = QFileDialog::getExistingDirectory(this, tr("Select Path"),
|
||||
this->text());
|
||||
}
|
||||
if(!path.isEmpty())
|
||||
{
|
||||
this->setText(path);
|
||||
|
|
|
@ -68,17 +68,18 @@ public slots:
|
|||
void clear();
|
||||
void setEditEnabled(bool);
|
||||
bool removeRows(int row, int count, const QModelIndex& idx = QModelIndex());
|
||||
bool insertRows(int row, int num, const QModelIndex&);
|
||||
|
||||
public:
|
||||
// satisfy [pure] virtuals
|
||||
int columnCount ( const QModelIndex & parent ) const;
|
||||
QVariant data ( const QModelIndex & index, int role = Qt::DisplayRole) const;
|
||||
QModelIndex parent ( const QModelIndex & index ) const;
|
||||
int rowCount ( const QModelIndex & parent ) const;
|
||||
QVariant headerData ( int section, Qt::Orientation orient, int role ) const;
|
||||
Qt::ItemFlags flags ( const QModelIndex& index ) const;
|
||||
bool setData ( const QModelIndex& index, const QVariant& value, int role );
|
||||
QModelIndex buddy ( const QModelIndex& index ) const;
|
||||
int columnCount (const QModelIndex& parent) const;
|
||||
QVariant data (const QModelIndex& index, int role = Qt::DisplayRole) const;
|
||||
QModelIndex parent (const QModelIndex& index) const;
|
||||
int rowCount (const QModelIndex& parent = QModelIndex()) const;
|
||||
QVariant headerData (int section, Qt::Orientation orient, int role) const;
|
||||
Qt::ItemFlags flags (const QModelIndex& index) const;
|
||||
bool setData (const QModelIndex& index, const QVariant& value, int role);
|
||||
QModelIndex buddy (const QModelIndex& index) const;
|
||||
|
||||
// get the properties
|
||||
QCMakeCachePropertyList properties() const;
|
||||
|
@ -107,18 +108,33 @@ public:
|
|||
};
|
||||
|
||||
/// Editor widget for editing paths or file paths
|
||||
class QCMakeCachePathEditor : public QLineEdit
|
||||
class QCMakeCacheFileEditor : public QLineEdit
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QCMakeCachePathEditor(bool isFilePath, QWidget* p);
|
||||
QCMakeCacheFileEditor(QWidget* p);
|
||||
protected slots:
|
||||
void chooseFile();
|
||||
virtual void chooseFile() = 0;
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent* e);
|
||||
bool IsFilePath;
|
||||
QToolButton* ToolButton;
|
||||
};
|
||||
|
||||
class QCMakeCachePathEditor : public QCMakeCacheFileEditor
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QCMakeCachePathEditor(QWidget* p = NULL);
|
||||
void chooseFile();
|
||||
};
|
||||
|
||||
class QCMakeCacheFilePathEditor : public QCMakeCacheFileEditor
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QCMakeCacheFilePathEditor(QWidget* p = NULL);
|
||||
void chooseFile();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue