corrections on hinspector
This commit is contained in:
parent
a96df9116e
commit
7ceb8530f2
|
@ -1,3 +1,4 @@
|
||||||
|
#include <QComboBox>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QTableView>
|
#include <QTableView>
|
||||||
|
@ -13,22 +14,26 @@ HInspectorWidget::HInspectorWidget(QWidget* parent):
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
filterProxyModels(),
|
filterProxyModels(),
|
||||||
filterProxyModelsHistory(),
|
filterProxyModelsHistory(),
|
||||||
|
recordsHistoryComboBox(NULL),
|
||||||
slotsView(NULL)
|
slotsView(NULL)
|
||||||
{
|
{
|
||||||
|
//recordsHistoryComboBox = new QComboBox(this);
|
||||||
|
|
||||||
slotsView = new QTableView(this);
|
slotsView = new QTableView(this);
|
||||||
slotsView->setAlternatingRowColors(true);
|
slotsView->setAlternatingRowColors(true);
|
||||||
slotsView->setSelectionBehavior(QAbstractItemView::SelectRows);
|
slotsView->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||||
slotsView->setSortingEnabled(true);
|
slotsView->setSortingEnabled(true);
|
||||||
|
|
||||||
QGridLayout* inspectorLayout = new QGridLayout();
|
QGridLayout* inspectorLayout = new QGridLayout();
|
||||||
inspectorLayout->addWidget(slotsView, 0, 0, 1, 2);
|
//inspectorLayout->addWidget(recordsHistoryComboBox, 0, 0, 1, 2);
|
||||||
|
inspectorLayout->addWidget(slotsView, 1, 0, 1, 2);
|
||||||
|
|
||||||
filterPatternLineEdit = new QLineEdit(this);
|
filterPatternLineEdit = new QLineEdit(this);
|
||||||
QLabel* filterPatternLabel = new QLabel(tr("&Filter pattern:"), this);
|
QLabel* filterPatternLabel = new QLabel(tr("&Filter pattern:"), this);
|
||||||
filterPatternLabel->setBuddy(filterPatternLineEdit);
|
filterPatternLabel->setBuddy(filterPatternLineEdit);
|
||||||
|
|
||||||
inspectorLayout->addWidget(filterPatternLabel, 1, 0);
|
inspectorLayout->addWidget(filterPatternLabel, 2, 0);
|
||||||
inspectorLayout->addWidget(filterPatternLineEdit, 1, 1);
|
inspectorLayout->addWidget(filterPatternLineEdit, 2, 1);
|
||||||
|
|
||||||
QGroupBox* inspectorGroupBox = new QGroupBox(tr("Hurricane inspector"), this);
|
QGroupBox* inspectorGroupBox = new QGroupBox(tr("Hurricane inspector"), this);
|
||||||
inspectorGroupBox->setLayout(inspectorLayout);
|
inspectorGroupBox->setLayout(inspectorLayout);
|
||||||
|
@ -37,6 +42,9 @@ HInspectorWidget::HInspectorWidget(QWidget* parent):
|
||||||
mainLayout->addWidget(inspectorGroupBox);
|
mainLayout->addWidget(inspectorGroupBox);
|
||||||
setLayout(mainLayout);
|
setLayout(mainLayout);
|
||||||
|
|
||||||
|
//connect(recordsHistoryComboBox, SIGNAL(currentIndexChanged(int)),
|
||||||
|
// this, SLOT(recordChanged(int)));
|
||||||
|
|
||||||
connect(filterPatternLineEdit, SIGNAL(textChanged(const QString &)),
|
connect(filterPatternLineEdit, SIGNAL(textChanged(const QString &)),
|
||||||
this, SLOT(textFilterChanged()));
|
this, SLOT(textFilterChanged()));
|
||||||
|
|
||||||
|
@ -46,6 +54,7 @@ HInspectorWidget::HInspectorWidget(QWidget* parent):
|
||||||
|
|
||||||
void HInspectorWidget::setRecord(Record* record) {
|
void HInspectorWidget::setRecord(Record* record) {
|
||||||
filterProxyModelsHistory.clear();
|
filterProxyModelsHistory.clear();
|
||||||
|
//recordsHistoryComboBox->clear();
|
||||||
internalSetRecord(record);
|
internalSetRecord(record);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,6 +75,8 @@ void HInspectorWidget::internalSetRecord(Record* record) {
|
||||||
slotsView->setModel(sortModel);
|
slotsView->setModel(sortModel);
|
||||||
slotsView->resizeColumnsToContents();
|
slotsView->resizeColumnsToContents();
|
||||||
filterProxyModelsHistory.push_back(sortModel);
|
filterProxyModelsHistory.push_back(sortModel);
|
||||||
|
//recordsHistoryComboBox->addItem(QString(record->getName().c_str()));
|
||||||
|
//recordsHistoryComboBox->setCurrentIndex(recordsHistoryComboBox->count()-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HInspectorWidget::keyPressEvent(QKeyEvent *event) {
|
void HInspectorWidget::keyPressEvent(QKeyEvent *event) {
|
||||||
|
@ -86,19 +97,34 @@ void HInspectorWidget::keyPressEvent(QKeyEvent *event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//} else if (event->matches(QKeySequence::MoveToPreviousChar)) {
|
} else if (event->matches(QKeySequence::MoveToPreviousChar)) {
|
||||||
// if (!recordModelsHistory.empty()) {
|
if (!filterProxyModelsHistory.empty()) {
|
||||||
// recordModelsHistory.pop_back();
|
filterProxyModelsHistory.pop_back();
|
||||||
// if (!recordModelsHistory.empty()) {
|
if (!filterProxyModelsHistory.empty()) {
|
||||||
// QSortFilterProxyModel* proxyModel = recordModelsHistory.back();
|
QSortFilterProxyModel* proxyModel = filterProxyModelsHistory.back();
|
||||||
// slotsView->setModel(proxyModel);
|
slotsView->setModel(proxyModel);
|
||||||
// }
|
}
|
||||||
// }
|
//unsigned count = recordsHistoryComboBox->count();
|
||||||
|
//if (count > 0) {
|
||||||
|
// recordsHistoryComboBox->removeItem(count-1);
|
||||||
|
//}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
event->ignore();
|
event->ignore();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HInspectorWidget::recordChanged(int index) {
|
||||||
|
if (index >= 0 && index < filterProxyModelsHistory.size()) {
|
||||||
|
QSortFilterProxyModel* proxyModel = filterProxyModelsHistory[index];
|
||||||
|
slotsView->setModel(proxyModel);
|
||||||
|
//if (recordsHistoryComboBox->count() > index) {
|
||||||
|
// for (int i = recordsHistoryComboBox->count() - 1; i <= index; i--) {
|
||||||
|
// recordsHistoryComboBox->removeItem(i);
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void HInspectorWidget::textFilterChanged() {
|
void HInspectorWidget::textFilterChanged() {
|
||||||
QRegExp regExp(filterPatternLineEdit->text());
|
QRegExp regExp(filterPatternLineEdit->text());
|
||||||
|
|
|
@ -8,17 +8,19 @@ using namespace Hurricane;
|
||||||
class QSortFilterProxyModel;
|
class QSortFilterProxyModel;
|
||||||
class QTableView;
|
class QTableView;
|
||||||
class QLineEdit;
|
class QLineEdit;
|
||||||
|
class QComboBox;
|
||||||
|
|
||||||
class HInspectorWidget : public QWidget {
|
class HInspectorWidget : public QWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef map<Record*, QSortFilterProxyModel*> FilterProxyModels;
|
typedef map<Record*, QSortFilterProxyModel*> FilterProxyModels;
|
||||||
typedef list<QSortFilterProxyModel*> FilterProxyModelsHistory;
|
typedef vector<QSortFilterProxyModel*> FilterProxyModelsHistory;
|
||||||
HInspectorWidget(QWidget* parent=0);
|
HInspectorWidget(QWidget* parent=0);
|
||||||
void setRecord(Record* record);
|
void setRecord(Record* record);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
void recordChanged(int index);
|
||||||
void textFilterChanged();
|
void textFilterChanged();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -28,6 +30,7 @@ class HInspectorWidget : public QWidget {
|
||||||
void internalSetRecord(Record* record);
|
void internalSetRecord(Record* record);
|
||||||
FilterProxyModels filterProxyModels;
|
FilterProxyModels filterProxyModels;
|
||||||
FilterProxyModelsHistory filterProxyModelsHistory;
|
FilterProxyModelsHistory filterProxyModelsHistory;
|
||||||
|
QComboBox* recordsHistoryComboBox;
|
||||||
QTableView* slotsView;
|
QTableView* slotsView;
|
||||||
QLineEdit* filterPatternLineEdit;
|
QLineEdit* filterPatternLineEdit;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue