1.1 --- a/mainwindow.cpp Fri Oct 02 09:40:57 2009 +0000
1.2 +++ b/mainwindow.cpp Fri Oct 02 13:24:55 2009 +0000
1.3 @@ -138,10 +138,6 @@
1.4 connect (textEditor, SIGNAL (textHasChanged() ), this, SLOT (updateNoteFlag()));
1.5 connect (textEditor, SIGNAL (windowClosed() ), this, SLOT (updateActions()));
1.6
1.7 - // Connect HistoryWindow, so that we can update flags
1.8 - connect (historyWindow, SIGNAL (windowClosed() ), this, SLOT (updateActions()));
1.9 -
1.10 -
1.11 // Initialize script editor
1.12 scriptEditor = new SimpleScriptEditor();
1.13 scriptEditor->move (50,50);
1.14 @@ -1066,7 +1062,7 @@
1.15 a = new QAction(tr( "Antialiasing","View action" ),this );
1.16 a->setStatusTip ( tr( "Antialiasing" ));
1.17 a->setToggleAction(true);
1.18 - a->setOn (settings.value("/mainwindow/view/AntiAlias",true).toBool());
1.19 + a->setChecked (settings.value("/mainwindow/view/AntiAlias",true).toBool());
1.20 viewMenu->addAction (a);
1.21 connect( a, SIGNAL( triggered() ), this, SLOT(windowToggleAntiAlias() ) );
1.22 actionViewToggleAntiAlias=a;
1.23 @@ -1074,7 +1070,7 @@
1.24 a = new QAction(tr( "Smooth pixmap transformations","View action" ),this );
1.25 a->setStatusTip (a->text());
1.26 a->setToggleAction(true);
1.27 - a->setOn (settings.value("/mainwindow/view/SmoothPixmapTransformation",true).toBool());
1.28 + a->setChecked (settings.value("/mainwindow/view/SmoothPixmapTransformation",true).toBool());
1.29 viewMenu->addAction (a);
1.30 connect( a, SIGNAL( triggered() ), this, SLOT(windowToggleSmoothPixmap() ) );
1.31 actionViewToggleSmoothPixmapTransform=a;
1.32 @@ -1108,7 +1104,7 @@
1.33 a->setStatusTip ( tr( "Use modifier to color branches" ));
1.34 a->setToggleAction(true);
1.35 a->addTo (tb);
1.36 - a->setOn(true);
1.37 + a->setChecked(true);
1.38 actionModModeColor=a;
1.39
1.40 a= new QAction( QPixmap(iconPath+"modecopy.png"), tr( "Use modifier to copy","Mode modifier" ), actionGroupModModes );
1.41 @@ -1399,7 +1395,7 @@
1.42 a = new QAction( tr( "Autosave","Settings action"), this);
1.43 a->setStatusTip( tr( "Autosave"));
1.44 a->setToggleAction(true);
1.45 - a->setOn ( settings.value ("/mainwindow/autosave/use",false).toBool());
1.46 + a->setChecked ( settings.value ("/mainwindow/autosave/use",false).toBool());
1.47 connect( a, SIGNAL( triggered() ), this, SLOT( settingsAutosaveToggle() ) );
1.48 settingsMenu->addAction (a);
1.49 actionSettingsAutosaveToggle=a;
1.50 @@ -1413,7 +1409,7 @@
1.51 a = new QAction( tr( "Write backup file on save","Settings action"), this);
1.52 a->setStatusTip( tr( "Write backup file on save"));
1.53 a->setToggleAction(true);
1.54 - a->setOn ( settings.value ("/mainwindow/writeBackupFile",false).toBool());
1.55 + a->setChecked ( settings.value ("/mainwindow/writeBackupFile",false).toBool());
1.56 connect( a, SIGNAL( triggered() ), this, SLOT( settingsWriteBackupFileToggle() ) );
1.57 settingsMenu->addAction (a);
1.58 actionSettingsWriteBackupFile=a;
1.59 @@ -1423,28 +1419,28 @@
1.60 a = new QAction( tr( "Edit branch after adding it","Settings action" ), this );
1.61 a->setStatusTip( tr( "Edit branch after adding it" ));
1.62 a->setToggleAction(true);
1.63 - a->setOn ( settings.value ("/mapeditor/editmode/autoEditNewBranch",true).toBool());
1.64 + a->setChecked ( settings.value ("/mapeditor/editmode/autoEditNewBranch",true).toBool());
1.65 settingsMenu->addAction (a);
1.66 actionSettingsAutoEditNewBranch=a;
1.67
1.68 a= new QAction( tr( "Select branch after adding it","Settings action" ), this );
1.69 a->setStatusTip( tr( "Select branch after adding it" ));
1.70 a->setToggleAction(true);
1.71 - a->setOn ( settings.value ("/mapeditor/editmode/autoSelectNewBranch",false).toBool() );
1.72 + a->setChecked ( settings.value ("/mapeditor/editmode/autoSelectNewBranch",false).toBool() );
1.73 settingsMenu->addAction (a);
1.74 actionSettingsAutoSelectNewBranch=a;
1.75
1.76 a= new QAction(tr( "Select existing heading","Settings action" ), this);
1.77 a->setStatusTip( tr( "Select heading before editing" ));
1.78 a->setToggleAction(true);
1.79 - a->setOn ( settings.value ("/mapeditor/editmode/autoSelectText",true).toBool() );
1.80 + a->setChecked ( settings.value ("/mapeditor/editmode/autoSelectText",true).toBool() );
1.81 settingsMenu->addAction (a);
1.82 actionSettingsAutoSelectText=a;
1.83
1.84 a= new QAction( tr( "Delete key","Settings action" ), this);
1.85 a->setStatusTip( tr( "Delete key for deleting branches" ));
1.86 a->setToggleAction(true);
1.87 - a->setOn ( settings.value ("/mapeditor/editmode/useDelKey",true).toBool() );
1.88 + a->setChecked ( settings.value ("/mapeditor/editmode/useDelKey",true).toBool() );
1.89 settingsMenu->addAction (a);
1.90 connect( a, SIGNAL( triggered() ), this, SLOT( settingsToggleDelKey() ) );
1.91 actionSettingsUseDelKey=a;
1.92 @@ -1452,21 +1448,21 @@
1.93 a= new QAction( tr( "Exclusive flags","Settings action" ), this);
1.94 a->setStatusTip( tr( "Use exclusive flags in flag toolbars" ));
1.95 a->setToggleAction(true);
1.96 - a->setOn ( settings.value ("/mapeditor/editmode/useFlagGroups",true).toBool() );
1.97 + a->setChecked ( settings.value ("/mapeditor/editmode/useFlagGroups",true).toBool() );
1.98 settingsMenu->addAction (a);
1.99 actionSettingsUseFlagGroups=a;
1.100
1.101 a= new QAction( tr( "Use hide flags","Settings action" ), this);
1.102 a->setStatusTip( tr( "Use hide flag during exports " ));
1.103 a->setToggleAction(true);
1.104 - a->setOn ( settings.value ("/export/useHideExport",true).toBool() );
1.105 + a->setChecked ( settings.value ("/export/useHideExport",true).toBool() );
1.106 settingsMenu->addAction (a);
1.107 actionSettingsUseHideExport=a;
1.108
1.109 a = new QAction( tr( "Animation","Settings action"), this);
1.110 a->setStatusTip( tr( "Animation"));
1.111 a->setToggleAction(true);
1.112 - a->setOn (settings.value("/animation/use",false).toBool() );
1.113 + a->setChecked (settings.value("/animation/use",true).toBool() );
1.114 connect( a, SIGNAL( triggered() ), this, SLOT( settingsToggleAnimation() ) );
1.115 settingsMenu->addAction (a);
1.116 actionSettingsUseAnimation=a;
1.117 @@ -2992,7 +2988,7 @@
1.118 if (m)
1.119 {
1.120 m->setMapLinkStyle("StyleLine");
1.121 - actionFormatLinkStyleLine->setOn(true);
1.122 + actionFormatLinkStyleLine->setChecked(true);
1.123 }
1.124 }
1.125
1.126 @@ -3002,7 +2998,7 @@
1.127 if (m)
1.128 {
1.129 m->setMapLinkStyle("StyleParabel");
1.130 - actionFormatLinkStyleParabel->setOn(true);
1.131 + actionFormatLinkStyleParabel->setChecked(true);
1.132 }
1.133 }
1.134
1.135 @@ -3012,7 +3008,7 @@
1.136 if (m)
1.137 {
1.138 m->setMapLinkStyle("StylePolyLine");
1.139 - actionFormatLinkStylePolyLine->setOn(true);
1.140 + actionFormatLinkStylePolyLine->setChecked(true);
1.141 }
1.142 }
1.143
1.144 @@ -3022,7 +3018,7 @@
1.145 if (m)
1.146 {
1.147 m->setMapLinkStyle("StylePolyParabel");
1.148 - actionFormatLinkStylePolyParabel->setOn(true);
1.149 + actionFormatLinkStylePolyParabel->setChecked(true);
1.150 }
1.151 }
1.152
1.153 @@ -3327,6 +3323,11 @@
1.154
1.155 void Main::updateActions()
1.156 {
1.157 + // updateActions is also called when satellites are closed //FIXME-2 doesn't update immediatly, e.g. historyWindow is still visible, when "close" is pressed
1.158 + actionViewToggleNoteEditor->setChecked (textEditor->isVisible());
1.159 + actionViewToggleHistoryWindow->setChecked (historyWindow->isVisible());
1.160 + actionViewTogglePropertyWindow->setChecked (branchPropertyWindow->isVisible());
1.161 +
1.162 VymModel *m =currentModel();
1.163 if (m)
1.164 {
1.165 @@ -3337,16 +3338,16 @@
1.166 switch (m->getMapLinkStyle())
1.167 {
1.168 case LinkableMapObj::Line:
1.169 - actionFormatLinkStyleLine->setOn(true);
1.170 + actionFormatLinkStyleLine->setChecked(true);
1.171 break;
1.172 case LinkableMapObj::Parabel:
1.173 - actionFormatLinkStyleParabel->setOn(true);
1.174 + actionFormatLinkStyleParabel->setChecked(true);
1.175 break;
1.176 case LinkableMapObj::PolyLine:
1.177 - actionFormatLinkStylePolyLine->setOn(true);
1.178 + actionFormatLinkStylePolyLine->setChecked(true);
1.179 break;
1.180 case LinkableMapObj::PolyParabel:
1.181 - actionFormatLinkStylePolyParabel->setOn(true);
1.182 + actionFormatLinkStylePolyParabel->setChecked(true);
1.183 break;
1.184 default:
1.185 break;
1.186 @@ -3370,15 +3371,10 @@
1.187 actionFilePrint->setEnabled (false);
1.188 }
1.189
1.190 - // updateActions is also called when NoteEditor is closed
1.191 - actionViewToggleNoteEditor->setOn (textEditor->isVisible());
1.192 - actionViewToggleHistoryWindow->setOn (historyWindow->isVisible());
1.193 - actionViewTogglePropertyWindow->setOn (branchPropertyWindow->isVisible());
1.194 -
1.195 if (m && m->getMapLinkColorHint()==LinkableMapObj::HeadingColor)
1.196 - actionFormatLinkColorHint->setOn(true);
1.197 + actionFormatLinkColorHint->setChecked(true);
1.198 else
1.199 - actionFormatLinkColorHint->setOn(false);
1.200 + actionFormatLinkColorHint->setChecked(false);
1.201
1.202
1.203 if (m && m->hasChanged() )
1.204 @@ -3403,7 +3399,7 @@
1.205 {
1.206 if (selbi || selti->getType()==TreeItem::Image)
1.207 {
1.208 - actionFormatHideLinkUnselected->setOn (((MapItem*)selti)->getHideLinkUnselected());
1.209 + actionFormatHideLinkUnselected->setChecked (((MapItem*)selti)->getHideLinkUnselected());
1.210 actionFormatHideLinkUnselected->setEnabled (true);
1.211 }
1.212
1.213 @@ -3435,9 +3431,9 @@
1.214 // System Flags
1.215 actionToggleScroll->setEnabled (true);
1.216 if ( selbi->isScrolled() )
1.217 - actionToggleScroll->setOn(true);
1.218 + actionToggleScroll->setChecked(true);
1.219 else
1.220 - actionToggleScroll->setOn(false);
1.221 + actionToggleScroll->setChecked(false);
1.222
1.223 if ( selti->getURL().isEmpty() )
1.224 {
1.225 @@ -3471,7 +3467,7 @@
1.226 actionSortChildren->setEnabled (true);
1.227
1.228 actionToggleHideExport->setEnabled (true);
1.229 - actionToggleHideExport->setOn (selbi->hideInExport() );
1.230 + actionToggleHideExport->setChecked (selbi->hideInExport() );
1.231
1.232 actionCopy->setEnabled (true);
1.233 actionCut->setEnabled (true);
1.234 @@ -3489,7 +3485,7 @@
1.235 actionOpenVymLink->setEnabled (false);
1.236 actionDeleteVymLink->setEnabled (false);
1.237 actionToggleHideExport->setEnabled (true);
1.238 - actionToggleHideExport->setOn (selti->hideInExport() );
1.239 + actionToggleHideExport->setChecked (selti->hideInExport() );
1.240
1.241
1.242 actionCopy->setEnabled (true);
1.243 @@ -3547,14 +3543,14 @@
1.244 {
1.245 textEditor->setShowWithMain(true);
1.246 textEditor->show();
1.247 - actionViewToggleNoteEditor->setOn (true);
1.248 + actionViewToggleNoteEditor->setChecked (true);
1.249 }
1.250
1.251 void Main::windowHideNoteEditor()
1.252 {
1.253 textEditor->setShowWithMain(false);
1.254 textEditor->hide();
1.255 - actionViewToggleNoteEditor->setOn (false);
1.256 + actionViewToggleNoteEditor->setChecked (false);
1.257 }
1.258
1.259 void Main::setScript (const QString &script)
2.1 --- a/mapeditor.cpp Fri Oct 02 09:40:57 2009 +0000
2.2 +++ b/mapeditor.cpp Fri Oct 02 13:24:55 2009 +0000
2.3 @@ -185,7 +185,7 @@
2.4 return mapScene;
2.5 }
2.6
2.7 -void MapEditor::scrollTo (const QModelIndex &index) //FIXME-1 problems with locating stuff in big maps
2.8 +void MapEditor::scrollTo (const QModelIndex &index)
2.9 {
2.10 if (index.isValid())
2.11 {
2.12 @@ -196,7 +196,8 @@
2.13 if (lmo)
2.14 {
2.15 QRectF r=lmo->getBBox();
2.16 - setScrollBarPosTarget (lmo->getBBox() );
2.17 + if (debug) cout << "ME::scrollTo "<<ti->getHeadingStd()<<" bbox="<<r<<endl;
2.18 + setScrollBarPosTarget (r);
2.19 }
2.20 }
2.21 }
2.22 @@ -216,6 +217,8 @@
2.23 qreal top = verticalScrollBar()->value();
2.24 qreal bottom = top + height;
2.25
2.26 + scrollBarPosTarget=getScrollBarPos();
2.27 +
2.28 if (viewRect.left() <= left + xmargin) {
2.29 // need to scroll from the left
2.30 // if (!d->leftIndent)
2.31 @@ -237,17 +240,24 @@
2.32 scrollBarPosTarget.setY(int(viewRect.bottom() - height + ymargin + 0.5));
2.33 }
2.34
2.35 + if (scrollBarPosTarget==getScrollBarPos()) return;
2.36 +
2.37 if (scrollBarPosAnimation.state()==QtAbstractAnimation::Running)
2.38 scrollBarPosAnimation.stop();
2.39 - scrollBarPosAnimation.setTargetObject (this);
2.40 - scrollBarPosAnimation.setPropertyName ("scrollBarPos");
2.41 - scrollBarPosAnimation.setDuration(1000);
2.42 - scrollBarPosAnimation.setEasingCurve ( QtEasingCurve::OutQuint);
2.43 - scrollBarPosAnimation.setStartValue(
2.44 - QPointF (horizontalScrollBar()->value() ,
2.45 - verticalScrollBar()->value() ) );
2.46 - scrollBarPosAnimation.setEndValue(scrollBarPosTarget);
2.47 - scrollBarPosAnimation.start();
2.48 +
2.49 + if (settings.value ("/animation/use/",true).toBool() )
2.50 + {
2.51 + scrollBarPosAnimation.setTargetObject (this);
2.52 + scrollBarPosAnimation.setPropertyName ("scrollBarPos");
2.53 + scrollBarPosAnimation.setDuration(1000);
2.54 + scrollBarPosAnimation.setEasingCurve ( QtEasingCurve::OutQuint);
2.55 + scrollBarPosAnimation.setStartValue(
2.56 + QPointF (horizontalScrollBar()->value() ,
2.57 + verticalScrollBar()->value() ) );
2.58 + scrollBarPosAnimation.setEndValue(scrollBarPosTarget);
2.59 + scrollBarPosAnimation.start();
2.60 + } else
2.61 + setScrollBarPos (scrollBarPosTarget);
2.62 }
2.63
2.64 QPointF MapEditor::getScrollBarPosTarget()
2.65 @@ -265,7 +275,8 @@
2.66
2.67 QPointF MapEditor::getScrollBarPos()
2.68 {
2.69 - return scrollBarPos;
2.70 + return QPointF (horizontalScrollBar()->value(),verticalScrollBar()->value());
2.71 + //return scrollBarPos;
2.72 }
2.73
2.74 void MapEditor::setZoomFactorTarget (const qreal &zft)
2.75 @@ -273,14 +284,18 @@
2.76 zoomFactorTarget=zft;
2.77 if (zoomAnimation.state()==QtAbstractAnimation::Running)
2.78 zoomAnimation.stop();
2.79 - //zoomAnimation=QtPropertyAnimation(this, "zoomFactor");
2.80 - zoomAnimation.setTargetObject (this);
2.81 - zoomAnimation.setPropertyName ("zoomFactor");
2.82 - zoomAnimation.setDuration(1000);
2.83 - zoomAnimation.setEasingCurve ( QtEasingCurve::OutQuint);
2.84 - zoomAnimation.setStartValue(zoomFactor);
2.85 - zoomAnimation.setEndValue(zft);
2.86 - zoomAnimation.start();
2.87 + if (settings.value ("/animation/use/",true).toBool() )
2.88 + {
2.89 + //zoomAnimation=QtPropertyAnimation(this, "zoomFactor");
2.90 + zoomAnimation.setTargetObject (this);
2.91 + zoomAnimation.setPropertyName ("zoomFactor");
2.92 + zoomAnimation.setDuration(1000);
2.93 + zoomAnimation.setEasingCurve ( QtEasingCurve::OutQuint);
2.94 + zoomAnimation.setStartValue(zoomFactor);
2.95 + zoomAnimation.setEndValue(zft);
2.96 + zoomAnimation.start();
2.97 + } else
2.98 + setZoomFactor (zft);
2.99 }
2.100
2.101 qreal MapEditor::getZoomFactorTarget()
2.102 @@ -1483,7 +1498,12 @@
2.103
2.104 void MapEditor::mouseDoubleClickEvent(QMouseEvent* e)
2.105 {
2.106 - if (debug) cout << "ME p="<<mapToScene (e->pos())<<endl;
2.107 + if (debug)
2.108 + {
2.109 + cout << "ME p="<<mapToScene (e->pos())<<" scrollBarPos="<<getScrollBarPos();
2.110 + cout << " min="<<QPointF(horizontalScrollBar()->minimum(),verticalScrollBar()->minimum());
2.111 + cout << endl;
2.112 + }
2.113
2.114
2.115 if (model->isSelectionBlocked() )
3.1 --- a/misc.cpp Fri Oct 02 09:40:57 2009 +0000
3.2 +++ b/misc.cpp Fri Oct 02 13:24:55 2009 +0000
3.3 @@ -1,7 +1,6 @@
3.4 #include <math.h>
3.5
3.6 #include <qregexp.h>
3.7 -//#include <qpoint.h>
3.8 #include <stdlib.h>
3.9
3.10 #include "misc.h"
3.11 @@ -29,6 +28,12 @@
3.12 return stream;
3.13 }
3.14
3.15 +ostream &operator<< (ostream &stream, QRectF const &r)
3.16 +{
3.17 + stream << "tL="<<r.topLeft()<<" - bR="<<r.bottomRight();
3.18 + return stream;
3.19 +}
3.20 +
3.21 ostream &operator<< (ostream &stream, Vector const &p)
3.22 {
3.23 stream << "("<<p.x()<<","<<p.y()<<")";
4.1 --- a/misc.h Fri Oct 02 09:40:57 2009 +0000
4.2 +++ b/misc.h Fri Oct 02 13:24:55 2009 +0000
4.3 @@ -7,6 +7,7 @@
4.4 class QString;
4.5 class QPoint;
4.6 class QPointF;
4.7 +class QRectF;
4.8 class Vector;
4.9
4.10 /////////////////////////////////////////////////////////////////////////////
4.11 @@ -17,6 +18,7 @@
4.12
4.13 extern ostream &operator<< (ostream &stream, QPoint const &p);
4.14 extern ostream &operator<< (ostream &stream, QPointF const &p);
4.15 +extern ostream &operator<< (ostream &stream, QRectF const &r);
4.16 extern ostream &operator<< (ostream &stream, Vector const &p);
4.17 qreal getAngle(const QPointF &);
4.18 qreal max (qreal,qreal);
5.1 --- a/mysortfilterproxymodel.cpp Fri Oct 02 09:40:57 2009 +0000
5.2 +++ b/mysortfilterproxymodel.cpp Fri Oct 02 13:24:55 2009 +0000
5.3 @@ -1,37 +1,41 @@
5.4 /****************************************************************************
5.5 **
5.6 -** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
5.7 -** Contact: Qt Software Information (qt-info@nokia.com)
5.8 +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
5.9 +** Contact: Nokia Corporation (qt-info@nokia.com)
5.10 **
5.11 -** This file is part of the example classes of the Qt Toolkit.
5.12 +** This file is part of the examples of the Qt Toolkit.
5.13 **
5.14 +** $QT_BEGIN_LICENSE:LGPL$
5.15 ** Commercial Usage
5.16 ** Licensees holding valid Qt Commercial licenses may use this file in
5.17 ** accordance with the Qt Commercial License Agreement provided with the
5.18 ** Software or, alternatively, in accordance with the terms contained in
5.19 ** a written agreement between you and Nokia.
5.20 **
5.21 +** GNU Lesser General Public License Usage
5.22 +** Alternatively, this file may be used under the terms of the GNU Lesser
5.23 +** General Public License version 2.1 as published by the Free Software
5.24 +** Foundation and appearing in the file LICENSE.LGPL included in the
5.25 +** packaging of this file. Please review the following information to
5.26 +** ensure the GNU Lesser General Public License version 2.1 requirements
5.27 +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
5.28 +**
5.29 +** In addition, as a special exception, Nokia gives you certain
5.30 +** additional rights. These rights are described in the Nokia Qt LGPL
5.31 +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
5.32 +** package.
5.33 **
5.34 ** GNU General Public License Usage
5.35 ** Alternatively, this file may be used under the terms of the GNU
5.36 -** General Public License versions 2.0 or 3.0 as published by the Free
5.37 -** Software Foundation and appearing in the file LICENSE.GPL included in
5.38 -** the packaging of this file. Please review the following information
5.39 -** to ensure GNU General Public Licensing requirements will be met:
5.40 -** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
5.41 -** http://www.gnu.org/copyleft/gpl.html. In addition, as a special
5.42 -** exception, Nokia gives you certain additional rights. These rights
5.43 -** are described in the Nokia Qt GPL Exception version 1.3, included in
5.44 -** the file GPL_EXCEPTION.txt in this package.
5.45 -**
5.46 -** Qt for Windows(R) Licensees
5.47 -** As a special exception, Nokia, as the sole copyright holder for Qt
5.48 -** Designer, grants users of the Qt/Eclipse Integration plug-in the
5.49 -** right for the Qt/Eclipse Integration to link to functionality
5.50 -** provided by Qt Designer and its related libraries.
5.51 +** General Public License version 3.0 as published by the Free Software
5.52 +** Foundation and appearing in the file LICENSE.GPL included in the
5.53 +** packaging of this file. Please review the following information to
5.54 +** ensure the GNU General Public License version 3.0 requirements will be
5.55 +** met: http://www.gnu.org/copyleft/gpl.html.
5.56 **
5.57 ** If you are unsure which license is appropriate for your use, please
5.58 -** contact the sales department at qt-sales@nokia.com.
5.59 +** contact the sales department at http://www.qtsoftware.com/contact.
5.60 +** $QT_END_LICENSE$
5.61 **
5.62 ****************************************************************************/
5.63
5.64 @@ -39,42 +43,52 @@
5.65
5.66 #include "mysortfilterproxymodel.h"
5.67
5.68 +//! [0]
5.69 MySortFilterProxyModel::MySortFilterProxyModel(QObject *parent)
5.70 : QSortFilterProxyModel(parent)
5.71 {
5.72 }
5.73 -/*
5.74 +//! [0]
5.75 +
5.76 +//! [1]
5.77 void MySortFilterProxyModel::setFilterMinimumDate(const QDate &date)
5.78 {
5.79 minDate = date;
5.80 invalidateFilter();
5.81 }
5.82 +//! [1]
5.83 +
5.84 +//! [2]
5.85 void MySortFilterProxyModel::setFilterMaximumDate(const QDate &date)
5.86 {
5.87 maxDate = date;
5.88 invalidateFilter();
5.89 }
5.90 -*/
5.91 +//! [2]
5.92
5.93 -#include <iostream>
5.94 -using namespace std;
5.95 +//! [3]
5.96 bool MySortFilterProxyModel::filterAcceptsRow(int sourceRow,
5.97 const QModelIndex &sourceParent) const
5.98 {
5.99 - return true;
5.100 -cout << "MSFPM sM="<<sourceModel()<<endl;
5.101 QModelIndex index0 = sourceModel()->index(sourceRow, 0, sourceParent);
5.102 QModelIndex index1 = sourceModel()->index(sourceRow, 1, sourceParent);
5.103 + QModelIndex index2 = sourceModel()->index(sourceRow, 2, sourceParent);
5.104
5.105 - return (sourceModel()->data(index0).toString().contains(filterRegExp()) );
5.106 + return (sourceModel()->data(index0).toString().contains(filterRegExp())
5.107 + || sourceModel()->data(index1).toString().contains(filterRegExp()))
5.108 + && dateInRange(sourceModel()->data(index2).toDate());
5.109 }
5.110 +//! [3]
5.111
5.112 -/*
5.113 +//! [4] //! [5]
5.114 bool MySortFilterProxyModel::lessThan(const QModelIndex &left,
5.115 const QModelIndex &right) const
5.116 {
5.117 QVariant leftData = sourceModel()->data(left);
5.118 QVariant rightData = sourceModel()->data(right);
5.119 +//! [4]
5.120 +
5.121 +//! [6]
5.122 if (leftData.type() == QVariant::DateTime) {
5.123 return leftData.toDateTime() < rightData.toDateTime();
5.124 } else {
5.125 @@ -91,9 +105,12 @@
5.126 return QString::localeAwareCompare(leftString, rightString) < 0;
5.127 }
5.128 }
5.129 +//! [5] //! [6]
5.130 +
5.131 +//! [7]
5.132 bool MySortFilterProxyModel::dateInRange(const QDate &date) const
5.133 {
5.134 return (!minDate.isValid() || date > minDate)
5.135 && (!maxDate.isValid() || date < maxDate);
5.136 }
5.137 -*/
5.138 +//! [7]
6.1 --- a/mysortfilterproxymodel.h Fri Oct 02 09:40:57 2009 +0000
6.2 +++ b/mysortfilterproxymodel.h Fri Oct 02 13:24:55 2009 +0000
6.3 @@ -1,37 +1,41 @@
6.4 /****************************************************************************
6.5 **
6.6 -** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
6.7 -** Contact: Qt Software Information (qt-info@nokia.com)
6.8 +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
6.9 +** Contact: Nokia Corporation (qt-info@nokia.com)
6.10 **
6.11 -** This file is part of the example classes of the Qt Toolkit.
6.12 +** This file is part of the examples of the Qt Toolkit.
6.13 **
6.14 +** $QT_BEGIN_LICENSE:LGPL$
6.15 ** Commercial Usage
6.16 ** Licensees holding valid Qt Commercial licenses may use this file in
6.17 ** accordance with the Qt Commercial License Agreement provided with the
6.18 ** Software or, alternatively, in accordance with the terms contained in
6.19 ** a written agreement between you and Nokia.
6.20 **
6.21 +** GNU Lesser General Public License Usage
6.22 +** Alternatively, this file may be used under the terms of the GNU Lesser
6.23 +** General Public License version 2.1 as published by the Free Software
6.24 +** Foundation and appearing in the file LICENSE.LGPL included in the
6.25 +** packaging of this file. Please review the following information to
6.26 +** ensure the GNU Lesser General Public License version 2.1 requirements
6.27 +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
6.28 +**
6.29 +** In addition, as a special exception, Nokia gives you certain
6.30 +** additional rights. These rights are described in the Nokia Qt LGPL
6.31 +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
6.32 +** package.
6.33 **
6.34 ** GNU General Public License Usage
6.35 ** Alternatively, this file may be used under the terms of the GNU
6.36 -** General Public License versions 2.0 or 3.0 as published by the Free
6.37 -** Software Foundation and appearing in the file LICENSE.GPL included in
6.38 -** the packaging of this file. Please review the following information
6.39 -** to ensure GNU General Public Licensing requirements will be met:
6.40 -** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
6.41 -** http://www.gnu.org/copyleft/gpl.html. In addition, as a special
6.42 -** exception, Nokia gives you certain additional rights. These rights
6.43 -** are described in the Nokia Qt GPL Exception version 1.3, included in
6.44 -** the file GPL_EXCEPTION.txt in this package.
6.45 -**
6.46 -** Qt for Windows(R) Licensees
6.47 -** As a special exception, Nokia, as the sole copyright holder for Qt
6.48 -** Designer, grants users of the Qt/Eclipse Integration plug-in the
6.49 -** right for the Qt/Eclipse Integration to link to functionality
6.50 -** provided by Qt Designer and its related libraries.
6.51 +** General Public License version 3.0 as published by the Free Software
6.52 +** Foundation and appearing in the file LICENSE.GPL included in the
6.53 +** packaging of this file. Please review the following information to
6.54 +** ensure the GNU General Public License version 3.0 requirements will be
6.55 +** met: http://www.gnu.org/copyleft/gpl.html.
6.56 **
6.57 ** If you are unsure which license is appropriate for your use, please
6.58 -** contact the sales department at qt-sales@nokia.com.
6.59 +** contact the sales department at http://www.qtsoftware.com/contact.
6.60 +** $QT_END_LICENSE$
6.61 **
6.62 ****************************************************************************/
6.63
6.64 @@ -49,15 +53,15 @@
6.65 public:
6.66 MySortFilterProxyModel(QObject *parent = 0);
6.67
6.68 - // QDate filterMinimumDate() const { return minDate; }
6.69 -// void setFilterMinimumDate(const QDate &date);
6.70 + QDate filterMinimumDate() const { return minDate; }
6.71 + void setFilterMinimumDate(const QDate &date);
6.72
6.73 -// QDate filterMaximumDate() const { return maxDate; }
6.74 -// void setFilterMaximumDate(const QDate &date);
6.75 + QDate filterMaximumDate() const { return maxDate; }
6.76 + void setFilterMaximumDate(const QDate &date);
6.77
6.78 protected:
6.79 bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
6.80 -// bool lessThan(const QModelIndex &left, const QModelIndex &right) const;
6.81 + bool lessThan(const QModelIndex &left, const QModelIndex &right) const;
6.82
6.83 private:
6.84 bool dateInRange(const QDate &date) const;
7.1 --- a/treeeditor.cpp Fri Oct 02 09:40:57 2009 +0000
7.2 +++ b/treeeditor.cpp Fri Oct 02 13:24:55 2009 +0000
7.3 @@ -16,15 +16,11 @@
7.4 {
7.5 model=m;
7.6
7.7 -/*
7.8 -*/
7.9 // MySortFilterProxyModel *proxyModel = new MySortFilterProxyModel(this); // FIXME-1 trying to use proxy...
7.10 proxyModel = new QSortFilterProxyModel (this);
7.11
7.12 -// proxyModel->setDynamicSortFilter (false);
7.13 setModel(proxyModel);
7.14 proxyModel->setSourceModel(model);
7.15 -// setModel(model);
7.16
7.17 QAction *a;
7.18 // Shortcuts for navigating with cursor:
8.1 --- a/version.h Fri Oct 02 09:40:57 2009 +0000
8.2 +++ b/version.h Fri Oct 02 13:24:55 2009 +0000
8.3 @@ -7,7 +7,7 @@
8.4 #define __VYM_VERSION "1.13.0"
8.5 //#define __VYM_CODENAME "Codename: RC-1"
8.6 #define __VYM_CODENAME "Codename: development version, not for production!"
8.7 -#define __VYM_BUILD_DATE "2009-10-01"
8.8 +#define __VYM_BUILD_DATE "2009-10-02"
8.9
8.10
8.11 bool checkVersion(const QString &);
9.1 --- a/vymview.cpp Fri Oct 02 09:40:57 2009 +0000
9.2 +++ b/vymview.cpp Fri Oct 02 13:24:55 2009 +0000
9.3 @@ -124,7 +124,9 @@
9.4 // original model first
9.5
9.6 // Re-emit but map selection first
9.7 - model->emitSelectionChanged (treeEditor->getProxyModel()->mapSelectionToSource (newsel));
9.8 + selModel->select (treeEditor->getProxyModel()->mapSelectionToSource (newsel),
9.9 + QItemSelectionModel::ClearAndSelect );
9.10 + //showSelection();
9.11 }
9.12
9.13 void VymView::expandAll()