[PATCH] Select all dives in a trip when said trip is expanded and clicked
Lubomir I. Ivanov
neolit123 at gmail.com
Mon Feb 18 14:14:50 PST 2013
On 18 February 2013 22:58, Amit Chaudhuri <amit.k.chaudhuri at gmail.com> wrote:
> ..I wonder if the out of the box behaviour of the Qt stuff handles this
> better. I suspect it does. And if it doesn't, I'd be much more confident
> that it would be possible to over-ride to achieve it.
>
> I'm playing with the simplest of beginnings of a Qt version (a main window,
> menus, presistent recollection of window size/component sizes etc). I'll
> put this on the list of things to test early on. It's no more than ~10
> lines of code at present, so not yet interesting. But by end of March I
> hope to have something to put up to stimulate discussion.
>
things seem easy in Qt land. here is a snipped i wrote to populate a
tree widget, while i was testing before.
QFont font;
// top level trip
trip = new QTreeWidgetItem(ui.treeWidget);
font = trip->font(0);
font.setBold(true);
trip->setText(1, "Trip 17.01.2013");
trip->setFont(1, font);
// dives in a trip
dive = new QTreeWidgetItem(trip);
dive->setText(0, "1");
dive->setText(1, "17.01.2013");
dive->setText(2, "Gibraltar 1");
dive = new QTreeWidgetItem(trip);
dive->setText(0, "2");
dive->setText(1, "18.01.2013");
dive->setText(2, "Gibraltar 2");
dive = new QTreeWidgetItem(trip);
dive->setText(0, "3");
dive->setText(1, "19.01.2013");
dive->setText(2, "Gibraltar 3");
// toplevel dives
dive = new QTreeWidgetItem(ui.treeWidget);
dive->setText(0, "3");
dive->setText(1, "Dive 20.01.2013");
dive->setText(2, QString::fromUtf8("Cádiz 1"));
dive = new QTreeWidgetItem(ui.treeWidget);
dive->setText(0, "4");
dive->setText(1, "Dive 21.01.2013");
dive->setText(2, QString::fromUtf8("Cádiz 2"));
i haven't played much with overriding its selection with signals, but
pretty much everything we do in GTK seems covered:
http://harmattan-dev.nokia.com/docs/library/html/qt4/qtreewidget.html#signals
there is UTF-8 -> UTF-16 conversation above, as this source code file
was written for Qt4.8 (since i there wasn't a Qt5 mingw build yet).
same should be gone in Qt5 according to thiago macieira:
http://www.macieira.org/blog/2012/05/source-code-must-be-utf-8-and-qstring-wants-it/
the internal storage would be still UTF-16, though.
lubomir
--
More information about the subsurface
mailing list