Skip to content

Commit 25bc507

Browse files
author
Koen Deforche
committed
implemented WTreeView/WTableView events outside items
1 parent e6cb5c3 commit 25bc507

File tree

21 files changed

+230
-107
lines changed

21 files changed

+230
-107
lines changed

ReleaseNotes.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,19 @@ <h3>C) Non-backwards compatible changes</h3>
295295
WTreeNode::labelArea() is no longer returning a WTableCell but
296296
instead a WContainerWidget.
297297
</dd>
298+
299+
<dt>
300+
<a href="classWt_1_1WTreeView.html">WTreeView</a>,
301+
<a href="classWt_1_1WTableView.html">WTableView</a>
302+
</dt>
303+
<dd>
304+
Event handling (clicked(), doubleClicked(), ... ) has been
305+
generalized: events that are not generated on an item (but for
306+
example in empty space below the items) will now also
307+
generate these events, but then with an invalid model index.
308+
You may thus need to adapt current code to check whether the model
309+
index that is returned is valid.
310+
</dd>
298311
</dl>
299312
<hr>
300313

examples/simplechat/PopupChatWidget.C

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ PopupChatWidget::PopupChatWidget(SimpleChatServer& server,
4949
updateUsers();
5050

5151
connect();
52-
5352
}
5453

5554
void PopupChatWidget::setName(const Wt::WString& name)

examples/widgetgallery/approot/text.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -967,15 +967,15 @@
967967
${doc-link WCssTheme} class as it is the default theme.
968968
</dd>
969969
<dt>polished</dt>
970-
<dd>This class is also part of the ${doc-link WCssTheme} class. You can
971-
change to this CSS theme with the method <tt>setCssTheme()</tt>
972-
from the class ${doc-link WApplication} and passing the parameter
973-
"polished".
970+
<dd>This theme is also implemented by the ${doc-link WCssTheme} class.
971+
You can change to this CSS theme with <tt>setCssTheme("polished")</tt>
972+
in your ${doc-link WApplication}.
974973
</dd>
975974
<dt>bootstrap</dt>
976975
<dd>
977-
This class is also part of the ${doc-link WBootstrapTheme} class. Use
978-
<tt>setCssTheme("bootstrap")</tt> to apply this theme.
976+
This theme is implemented by the ${doc-link WBootstrapTheme}
977+
class, and relies on Twitter's Bootstrap CSS framework. Use
978+
<tt>setTheme(new WBootstrapTheme())</tt> to use this theme.
979979
</dd>
980980
</dl>
981981
</p>

examples/widgetgallery/examples/Flash.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ std::string poster = "pics/sintel_trailer.jpg";
99
Wt::WContainerWidget *container = new Wt::WContainerWidget();
1010

1111
Wt::WFlashObject *flash =
12-
new Wt::WFlashObject("www.youtube.com/watch?v=HOfdboHvshg", container);
12+
new Wt::WFlashObject("http://www.youtube.com/v/HOfdboHvshg", container);
1313
flash->setFlashParameter("allowFullScreen", "true");
1414
flash->setAlternativeContent(new Wt::WImage(poster));
1515
flash->resize(640, 360);

examples/wt-homepage/WtHome.C

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ WtHome::WtHome(const WEnvironment& env)
3535
if (wtExamplePath)
3636
wtExamplePath_ = wtExamplePath;
3737
else
38-
wtExamplePath_ = "../";
38+
wtExamplePath_ = "..";
3939

4040
init();
4141
}

examples/wt-homepage/jwt-home.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -630,9 +630,8 @@ the <a href="https://github.com/kdeforche/jwt">github
630630
repository</a>.</p>
631631

632632
<p>
633-
Alternatively checkout the repository from:
634633
<div class="fragment">
635-
<pre class="fragment">$ git clone http://www.webtoolkit.eu/git/jwt.git</pre>
634+
<pre class="fragment">$ git clone git://github.com/kdeforche/jwt.git</pre>
636635
</div>
637636
</p>
638637
</message>

examples/wt-homepage/wt-home.xml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -357,9 +357,8 @@ tutorial</a>) has the following features:
357357
<li>Use a single connection or share connection pools between
358358
multiple sessions from which connections are used only during an
359359
active transaction.</li>
360-
<li>Comes with Sqlite3, Firebird, and PostgreSQL backends, and a <a
361-
href="http://wtdbomysql.sourceforge.net/">MySQL backend (GPL
362-
only)</a> is maintained by the community (Paul Harisson).</li>
360+
<li>Comes with Sqlite3, Firebird, MariaDB/MySQL and PostgreSQL
361+
backends, and an Oracle backend is also available on request.</li>
363362
</ul>
364363

365364
<h4>Testing</h4>
@@ -989,7 +988,7 @@ Download the package
989988
(<a href="http://www.webtoolkit.eu/packages/winst-0.4.tar.gz">winst-0.4.tar.gz</a>)
990989
or get the latest git version:
991990
<div class="fragment">
992-
<pre class="fragment">$ git clone http://www.webtoolkit.eu/git/winst.git</pre>
991+
<pre class="fragment">$ git clone git://github.com/kdeforche/wt.git</pre>
993992
</div>
994993
</p>
995994

@@ -1031,7 +1030,7 @@ features in Wt:
10311030
<a href="http://www.webtoolkit.eu/wt/doc/reference/html/classWt_1_1WPdfImage.html">WPdfImage</a>
10321031
paint device will be included, which provides rendering support for PDF
10331032
documents. For more complete support for TrueType fonts and Unicode, you'll
1034-
want <a href="https://github.com/kdeforche/libharu">a patched libharu</a>
1033+
want <a href="https://github.com/libharu/libharu">the latest git version</a>
10351034
and probably also libpango (see further) for accurate font/glyph
10361035
selection.
10371036
</li>
@@ -1112,7 +1111,7 @@ repository</a>.</p>
11121111
<p>
11131112
Alternatively checkout the repository using:
11141113
<div class="fragment">
1115-
<pre class="fragment">$ git clone http://www.webtoolkit.eu/git/wt.git</pre>
1114+
<pre class="fragment">$ git clone git://github.com/kdeforche/wt.git</pre>
11161115
</div>
11171116
</p>
11181117
</message>

src/Wt/WAbstractItemView

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -691,25 +691,37 @@ public:
691691

692692
bool isEditing() const;
693693

694-
/*! \brief %Signal emitted when an item is clicked.
694+
/*! \brief %Signal emitted when clicked.
695695
*
696+
* When the event happened over an item, the first argument
697+
* indicates the item that was clicked on.
698+
696699
* \sa doubleClicked()
697700
*/
698701
Signal<WModelIndex, WMouseEvent>& clicked() { return clicked_; }
699702

700-
/*! \brief %Signal emitted when an item is double clicked.
703+
/*! \brief %Signal emitted when double clicked.
704+
*
705+
* When the event happened over an item, the first argument
706+
* indicates the item that was double clicked on.
701707
*
702708
* \sa clicked()
703709
*/
704710
Signal<WModelIndex, WMouseEvent>& doubleClicked() { return doubleClicked_; }
705711

706712
/*! \brief %Signal emitted when a mouse button is pressed down.
713+
*
714+
* When the event happened over an item, the first argument
715+
* indicates the item where the mouse went down.
707716
*
708717
* \sa mouseWentUp()
709718
*/
710719
Signal<WModelIndex, WMouseEvent>& mouseWentDown() { return mouseWentDown_; }
711720

712721
/*! \brief %Signal emitted when the mouse button is released.
722+
*
723+
* When the event happened over an item, the first argument
724+
* indicates the item where the mouse went up.
713725
*
714726
* \sa mouseWentDown()
715727
*/

src/Wt/WAbstractItemView.C

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,10 +1230,12 @@ void WAbstractItemView::expandColumn(int columnid)
12301230
void WAbstractItemView::handleClick(const WModelIndex& index,
12311231
const WMouseEvent& event)
12321232
{
1233-
bool doEdit = ((editTriggers() & SelectedClicked) && isSelected(index))
1234-
|| (editTriggers() & SingleClicked);
1233+
bool doEdit = index.isValid() &&
1234+
(((editTriggers() & SelectedClicked) && isSelected(index)) ||
1235+
(editTriggers() & SingleClicked));
12351236

1236-
selectionHandleClick(index, event.modifiers());
1237+
if (index.isValid())
1238+
selectionHandleClick(index, event.modifiers());
12371239

12381240
if (doEdit)
12391241
edit(index);
@@ -1244,7 +1246,7 @@ void WAbstractItemView::handleClick(const WModelIndex& index,
12441246
void WAbstractItemView::handleDoubleClick(const WModelIndex& index,
12451247
const WMouseEvent& event)
12461248
{
1247-
bool doEdit = editTriggers() & DoubleClicked;
1249+
bool doEdit = index.isValid() && (editTriggers() & DoubleClicked);
12481250
if (doEdit)
12491251
edit(index);
12501252

src/Wt/WLocale

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,12 @@ public:
105105
*/
106106
std::string name() const { return name_; }
107107

108+
/*! \brief Casts to the locale string (for pre-3.3.0 compatibility).
109+
*
110+
* \deprecated Use name() instead.
111+
*/
112+
operator std::string() const { return name(); }
113+
108114
/*! \brief Returns the current (user) locale.
109115
*
110116
* This returns WApplication::instance()->locale() if the

0 commit comments

Comments
 (0)