Merge branch 'tomaz-css' into Qt

Tomaz' code does a much better job of shading the dive list!

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2013-05-02 17:01:35 -07:00
commit ff2ce39970
10 changed files with 106 additions and 16 deletions

View file

@ -25,6 +25,7 @@
#include "../divelist.h"
#include "../pref.h"
#include "modeldelegates.h"
#include "models.h"
MainWindow::MainWindow() : ui(new Ui::MainWindow()),
model(new DiveTripModel(this)),
@ -33,6 +34,7 @@ MainWindow::MainWindow() : ui(new Ui::MainWindow()),
ui->setupUi(this);
sortModel->setSourceModel(model);
ui->ListWidget->setModel(sortModel);
connect(ui->ListWidget, SIGNAL(activated(QModelIndex)), this, SLOT(diveSelected(QModelIndex)));
/* figure out appropriate widths for the columns. The strings chosen
* are somewhat random (but at least we're trying to allow them to be
@ -70,6 +72,16 @@ MainWindow::MainWindow() : ui(new Ui::MainWindow()),
readSettings();
}
void MainWindow::diveSelected(const QModelIndex& index)
{
struct dive *dive = (struct dive*) index.model()->data(index, TreeItemDT::DIVE_ROLE).value<void*>();
if (dive)
selected_dive = get_index_for_dive(dive);
// Here should be the code to update the other widgets.
}
void MainWindow::on_actionNew_triggered()
{
qDebug("actionNew");