[Kmymoney-devel] making the state of the views persistent
Cristian Oneţ
onet.cristian at gmail.com
Mon Jul 19 07:04:03 CEST 2010
Hi,
Just a tip: instead of doing it this way I would recommend using
QHeaderView::saveState() and QHeaderView::restoreState() to make the column
sizes, as well as the sorting order persistent that way the views will be more
user friendly.
Regards,
Cristian
În data de Luni 19 Iulie 2010 03:32:01 Alvaro Soliverez a scris:
> SVN commit 1151382 by asoliverez:
>
> Save sorting column of the schedule tree
>
> BUG:244879
>
> M +6 -9 kscheduledview.cpp
> M +1 -0 kscheduledview.h
>
>
> --- trunk/extragear/office/kmymoney/kmymoney/views/kscheduledview.cpp
> #1151381:1151382 @@ -60,7 +60,8 @@
> m_openBills(true),
> m_openDeposits(true),
> m_openTransfers(true),
> - m_openLoans(true)
> + m_openLoans(true),
> + m_sortColumn(0)
> {
> setupUi(this);
>
> @@ -103,6 +104,8 @@
> connect(m_calendar, SIGNAL(skipClicked(const MyMoneySchedule&, const
> QDate&)), this, SLOT(slotBriefSkipClicked(const MyMoneySchedule&, const
> QDate&)));
>
> connect(MyMoneyFile::instance(), SIGNAL(dataChanged()), this,
> SLOT(slotReloadView())); +
> + m_scheduleTree->sortByColumn(m_sortColumn, Qt::AscendingOrder);
> }
>
> KScheduledView::~KScheduledView()
> @@ -283,7 +286,6 @@
>
> //reenable sorting after loading items
> m_scheduleTree->setSortingEnabled(true);
> - m_scheduleTree->sortByColumn(0, Qt::AscendingOrder);
> }
>
> QTreeWidgetItem* KScheduledView::addScheduleItem(QTreeWidgetItem* parent,
> MyMoneySchedule& schedule) @@ -457,11 +459,8 @@
> m_openTransfers = grp.readEntry("KScheduleView_openTransfers", true);
> m_openLoans = grp.readEntry("KScheduleView_openLoans", true);
> m_tabWidget->setCurrentIndex(grp.readEntry("KScheduleView_tab", 0));
> -
> + m_sortColumn = grp.readEntry("KScheduleView_sortColumn", 0);
>
> m_scheduleTree->header()->setFont(KMyMoneyGlobalSettings::listHeaderFont()
> ); - grp = config->group("Schedule View Settings");
> - //m_scheduleTree->restoreLayout(grp);
> -
> }
>
> void KScheduledView::writeConfig(void)
> @@ -473,10 +472,8 @@
> grp.writeEntry("KScheduleView_openTransfers", m_openTransfers);
> grp.writeEntry("KScheduleView_openLoans", m_openLoans);
> grp.writeEntry("KScheduleView_tab", m_tabWidget->currentIndex());
> + grp.writeEntry("KScheduleView_sortColumn",
> m_scheduleTree->sortColumn()); config->sync();
> -
> - grp = config->group("Schedule View Settings");
> - //m_scheduleTree->saveLayout(grp);
> }
>
> void KScheduledView::slotListViewContextMenu(const QPoint& pos)
> --- trunk/extragear/office/kmymoney/kmymoney/views/kscheduledview.h
> #1151381:1151382 @@ -141,6 +141,7 @@
> bool m_openTransfers;
> bool m_openLoans;
> bool m_needReload;
> + int m_sortColumn;
>
> /**
> * Search widget for the list
--
Regards,
Cristian Oneţ
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/kmymoney-devel/attachments/20100719/ab27fcb6/attachment-0001.sig
More information about the KMyMoney-devel
mailing list