|
|
|
@ -4,7 +4,10 @@
|
|
|
|
|
#include <QEvent>
|
|
|
|
|
#include <QStringList>
|
|
|
|
|
#include <QHBoxLayout>
|
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
|
#include <QGridLayout>
|
|
|
|
|
#include <QMouseEvent>
|
|
|
|
|
#include <QLabel>
|
|
|
|
|
#include <QDebug>
|
|
|
|
|
#include <QListWidget>
|
|
|
|
|
#include "nmData/nmDataLogFile.h"
|
|
|
|
@ -15,10 +18,13 @@ nmWxSelectWellsWidget::nmWxSelectWellsWidget(QWidget* aParent) :
|
|
|
|
|
m_pListWidget(new QListWidget(this)),
|
|
|
|
|
m_pLineEdit(new QTextEdit(this))
|
|
|
|
|
{
|
|
|
|
|
QVBoxLayout* layout = new QVBoxLayout;
|
|
|
|
|
layout->addWidget(m_pLineEdit);
|
|
|
|
|
layout->addWidget(m_pListWidget);
|
|
|
|
|
// 主布局
|
|
|
|
|
QGridLayout* layout = new QGridLayout;
|
|
|
|
|
this->setLayout(layout);
|
|
|
|
|
layout->addWidget(new QLabel(tr("Select Wells: ")), 0, 0);
|
|
|
|
|
layout->addWidget(m_pListWidget, 1, 0);
|
|
|
|
|
layout->addWidget(new QLabel(tr("Selected Wells: ")), 0, 1);
|
|
|
|
|
layout->addWidget(m_pLineEdit, 1, 1);
|
|
|
|
|
// m_pLineEdit->setText(multiLineText);
|
|
|
|
|
m_pLineEdit->setReadOnly(true);
|
|
|
|
|
}
|
|
|
|
@ -39,8 +45,11 @@ void nmWxSelectWellsWidget::addItem(QString name, QVariant value)
|
|
|
|
|
m_values.append(value);
|
|
|
|
|
nmWxSelectWellItemWidget* itemWidget = new nmWxSelectWellItemWidget(NULL, name, value);
|
|
|
|
|
itemWidget->setFixedHeight(25);
|
|
|
|
|
QListWidgetItem* item = new QListWidgetItem(m_pListWidget);
|
|
|
|
|
item->setSizeHint(QSize(item->sizeHint().width(), 25));
|
|
|
|
|
itemWidget->setFixedWidth(200);
|
|
|
|
|
// itemWidget->setMinimumWidth(m_pListWidget->viewport()->width()); // 设置widget的最小宽度为列表视图的宽度
|
|
|
|
|
QListWidgetItem* item = new QListWidgetItem;
|
|
|
|
|
nmDataLogFile::getInstance()->writeLog(QString(" %1 ").arg(item->sizeHint().width()));
|
|
|
|
|
item->setSizeHint(QSize(200, 30));
|
|
|
|
|
m_pListWidget->addItem(item);
|
|
|
|
|
m_pListWidget->setItemWidget(item, itemWidget);
|
|
|
|
|
connect(itemWidget, SIGNAL(sigItemClicked()), this, SLOT(onUpdateSelections()));
|
|
|
|
@ -61,7 +70,7 @@ void nmWxSelectWellsWidget::onUpdateSelections()
|
|
|
|
|
nameList.append(m_items[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
m_pLineEdit->setPlainText(nameList.join(","));
|
|
|
|
|
m_pLineEdit->setPlainText(nameList.join("\n"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|