[Qt-interest] Book: C++ GUI Programming with Qt 4 (2nd ed.) online+free+legal
Mark Summerfield
list at qtrac.plus.com
Tue Nov 17 10:35:48 CET 2009
On 2009-11-16, Johannes Kleimola wrote:
> Hi!
>
> So there is a small error in the printed book and downloadable example
> source code after all. And I seem to have come up with the same solution
> as you had locally. Should the error be stated on the mailing list as
> well, to not confuse other readers?
Yes, of course!
So for the diagram example, in diagramwindow.cpp the
DiagramWindow::updateActions() method should be:
void DiagramWindow::updateActions()
{
bool hasSelection = !scene->selectedItems().isEmpty();
bool isNode = (selectedNode() != 0);
bool isNodePair = (selectedNodePair() != NodePair());
bool isLink = (selectedLink() != 0);
cutAction->setEnabled(isNode);
copyAction->setEnabled(isNode);
addLinkAction->setEnabled(isNodePair);
deleteAction->setEnabled(hasSelection);
bringToFrontAction->setEnabled(isNode);
sendToBackAction->setEnabled(isNode);
propertiesAction->setEnabled(isNode || isLink);
foreach (QAction *action, view->actions())
view->removeAction(action);
foreach (QAction *action, editMenu->actions()) {
if (action->isEnabled())
view->addAction(action);
}
}
Thanks again for pointing it out:-)
--
Mark Summerfield, Qtrac Ltd, www.qtrac.eu
C++, Python, Qt, PyQt - training and consultancy
"Advanced Qt Programming" - ISBN 0321635906
More information about the Qt-interest-old
mailing list