git-svn-id: svn://db.shs.com.ru/libs@127 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -128,7 +128,7 @@ void CDKItemModel::buildItem(CDKItem *it, CDSection & r) {
|
||||
|
||||
|
||||
void CDKItemModel::internalRebuild() {
|
||||
qDebug() << "[CDKItemModel]" << "internalRebuild()";
|
||||
//qDebug() << "[CDKItemModel]" << "internalRebuild()";
|
||||
if (root) delete root;
|
||||
root = new CDKItem(0, CDKItem::ItemCDSection, 0);
|
||||
CDSection & r = K.root();
|
||||
@@ -162,7 +162,11 @@ CDKItem::~CDKItem() {
|
||||
QVariant CDKItem::data(int column, int role) const {
|
||||
if (role == Qt::BackgroundRole) {
|
||||
switch (type_) {
|
||||
case ItemCDType: return QBrush(QColor(255, 250, 230));
|
||||
case ItemCDType: {
|
||||
CDType & t = K.section(buildPath())[index_];
|
||||
if (t.errorString().isEmpty()) return QBrush(QColor(255, 250, 230));
|
||||
else return QBrush(QColor(255, 128, 128));
|
||||
}
|
||||
case ItemCDSection: return QBrush(QColor(230, 250, 230));
|
||||
}
|
||||
}
|
||||
@@ -171,6 +175,10 @@ QVariant CDKItem::data(int column, int role) const {
|
||||
if (t.type() == "b") return t.toBool() ? Qt::Checked : Qt::Unchecked;
|
||||
else QVariant();
|
||||
}
|
||||
if (role == Qt::ToolTipRole && type_ == ItemCDType) {
|
||||
CDType & t = K.section(buildPath())[index_];
|
||||
return PI2QString(t.errorString());
|
||||
}
|
||||
if (role != Qt::DisplayRole && role != Qt::EditRole) return QVariant();
|
||||
PIDeque<int> path = buildPath();
|
||||
CDSection & rs = K.section(path);
|
||||
@@ -221,7 +229,7 @@ QVariant CDKItem::value(CDType t, int role) const {
|
||||
|
||||
bool CDKItem::setData(int column, const QVariant &value) {
|
||||
if ((column == 3 || column == 4) && type_ == ItemCDType) {
|
||||
K.section(buildPath())[index_].setFormula(Q2PIString(value.toString()));
|
||||
K.section(buildPath())[index_].setValue(Q2PIString(value.toString()));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -87,6 +87,11 @@ void CDKView::buildFromHeader(const QString &kdescription) {
|
||||
}
|
||||
|
||||
|
||||
void CDKView::calculateK() {
|
||||
K.calculate();
|
||||
}
|
||||
|
||||
|
||||
void CDKView::k_sendFailed() {
|
||||
bisyStatusChanged(false);
|
||||
emit messageStatus("send failed");
|
||||
|
||||
@@ -26,6 +26,7 @@ public slots:
|
||||
void loadK();
|
||||
void clearK();
|
||||
void buildFromHeader(const QString & kdescription);
|
||||
void calculateK();
|
||||
|
||||
private slots:
|
||||
void k_sendFailed();
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
#include "form.h"
|
||||
#include "ui_form.h"
|
||||
#include "QFileDialog"
|
||||
#include "cdutils_k.h"
|
||||
using namespace CDUtils;
|
||||
|
||||
Form::Form(QWidget *parent) : QWidget(parent), ui(new Ui::Form) {
|
||||
ui->setupUi(this);
|
||||
ui->treeView->setKFile("");
|
||||
ui->treeView->refresh();
|
||||
ui->treeView->startPing();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -31,4 +33,14 @@ void Form::on_pushButton_4_clicked() {
|
||||
|
||||
void Form::on_pushButton_6_clicked() {
|
||||
ui->treeView->buildFromHeader(QFileDialog::getOpenFileName(this, trUtf8("Select *.h file with K description"), "k_description.h", "C/C++ header files(*.h *.hpp);;All files(*)"));
|
||||
/*piCout << K.root()["Radar_WaveFreqTune"];
|
||||
piCout << K.root()["11.NVA_PulseGenFineTune"];
|
||||
piCout << K.root()[".NVA.NVA_PulseGenFineTune"];
|
||||
piCout << K.root()["NVA_A.1.NVA_Clk"];*/
|
||||
}
|
||||
|
||||
|
||||
void Form::on_buttonCalc_clicked() {
|
||||
ui->treeView->calculateK();
|
||||
ui->treeView->refresh();
|
||||
}
|
||||
|
||||
@@ -17,10 +17,9 @@ public:
|
||||
|
||||
private slots:
|
||||
void on_pushButton_3_clicked();
|
||||
|
||||
void on_pushButton_4_clicked();
|
||||
|
||||
void on_pushButton_6_clicked();
|
||||
void on_buttonCalc_clicked();
|
||||
|
||||
private:
|
||||
Ui::Form *ui;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="3" column="0" colspan="2">
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="CDKView" name="treeView"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
@@ -59,6 +59,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QPushButton" name="buttonCalc">
|
||||
<property name="text">
|
||||
<string>Calculate</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
|
||||
Reference in New Issue
Block a user