chore: tweak ux for particles
This commit is contained in:
+32
-2
@@ -23,7 +23,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
|
||||
ui = new Ui::MainWindow;
|
||||
ui->setupUi(this);
|
||||
this->setWindowFlags(Qt::FramelessWindowHint);
|
||||
// this->setWindowFlags(Qt::FramelessWindowHint);
|
||||
|
||||
ui->splitter->setStretchFactor(0, 1);
|
||||
ui->splitter->setStretchFactor(1, 1);
|
||||
@@ -121,11 +121,21 @@ void MainWindow::setupModels()
|
||||
m_particleListModel = new ParticleListModel(m_data, this);
|
||||
ui->particlesView->setModel(m_particleListModel);
|
||||
|
||||
// Configure particle list view to use ellipses for long text
|
||||
ui->particlesView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
ui->particlesView->setTextElideMode(Qt::ElideRight);
|
||||
|
||||
// Connect selection changes
|
||||
connect(ui->topLevelParticlesView->selectionModel(),
|
||||
&QItemSelectionModel::selectionChanged,
|
||||
this,
|
||||
&MainWindow::onTreeSelectionChanged);
|
||||
|
||||
// Connect particle selection changes
|
||||
connect(ui->particlesView->selectionModel(),
|
||||
&QItemSelectionModel::selectionChanged,
|
||||
this,
|
||||
&MainWindow::onParticleSelectionChanged);
|
||||
}
|
||||
|
||||
void MainWindow::onTreeSelectionChanged(
|
||||
@@ -160,8 +170,28 @@ void MainWindow::onTreeSelectionChanged(
|
||||
ui->particlesView->setFocus();
|
||||
}
|
||||
}
|
||||
else
|
||||
else // network selected
|
||||
{
|
||||
m_particleListModel->setStreamId(QString());
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::onParticleSelectionChanged(
|
||||
const QItemSelection &selected,
|
||||
const QItemSelection &deselected)
|
||||
{
|
||||
Q_UNUSED(deselected);
|
||||
|
||||
if (selected.indexes().isEmpty())
|
||||
{
|
||||
ui->label->setText("");
|
||||
return;
|
||||
}
|
||||
|
||||
QModelIndex index = selected.indexes().first();
|
||||
const Particle *particle = m_particleListModel->particleAtRow(index.row());
|
||||
if (particle)
|
||||
{
|
||||
ui->label->setText(particle->summary);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user