Alberto,

Take a look at this patch I made based on your first one.  I'm not
sure if it's the proper way to do it, but it works for me.

-JTM

On Wed, Mar 31, 2010 at 3:21 PM, John T. Mertz <thatonefilm...@gmail.com> wrote:
> I don't think its blocking them. I think the headers are set first,
> then the recalled settings are set after the headers have been set,
> overwriting them.
>
> On 3/31/10, Alberto Villa <avi...@freebsd.org> wrote:
>> On Wednesday 31 March 2010 22:39:30 John T. Mertz wrote:
>>> In mainwindow.cpp, line 1429 (might be slightly off of the svn head):
>>>
>>> m_projectList->setHeaderInfo(state);
>>>
>>> This restores the old saved state of the headers, so any new header
>>> options set in projectlist.cpp will never take effect.
>>>
>>> Commenting out this line made the columns moveable; however, then it
>>> does not restore the order of the columns at startup.
>>
>> i've seen that... according to the documentation, that shouldn't block the
>> headers, just set them once :?
>> well, good, thanks! now i'll try to make the restore work :)
>> --
>> Alberto Villa, FreeBSD committer <avi...@freebsd.org>
>> http://people.FreeBSD.org/~avilla
>>
>> Any stone in your boot always migrates against the pressure gradient to
>> exactly the point of most pressure.
>>               -- Milt Barber
>>
>
> --
> Sent from my mobile device
>
Index: src/projectlistview.cpp
===================================================================
--- src/projectlistview.cpp	(revision 4350)
+++ src/projectlistview.cpp	(working copy)
@@ -50,12 +50,9 @@
     setHeaderLabels(headers);
 
     QHeaderView* headerView = header();
-    headerView->setContextMenuPolicy(Qt::CustomContextMenu);
+    setCustomHeader();
     connect(headerView, SIGNAL(customContextMenuRequested(const QPoint&)),
             this, SLOT(configureColumns(const QPoint&)));
-    headerView->setClickable(true);
-    headerView->setSortIndicatorShown(true);
-    headerView->setMovable(false);
     sortByColumn(0, Qt::AscendingOrder);
     setSortingEnabled(true);
 
@@ -67,18 +64,30 @@
 {
 }
 
+void ProjectListView::setCustomHeader()
+{
+    QHeaderView* headerView = header();
+    headerView->setContextMenuPolicy(Qt::CustomContextMenu);
+    headerView->setClickable(true);
+    headerView->setMovable(true);
+    headerView->setSortIndicatorShown(true);
+}
+
 void ProjectListView::configureColumns(const QPoint& pos)
 {
     KMenu popup(this);
     popup.addTitle(i18nc("@title:menu", "Columns"));
 
     QHeaderView* headerView = header();
-    for (int i = 1; i < headerView->count(); ++i) {
+    for (int i = 0; i < headerView->count(); ++i) {
+        const int logicalIndex = headerView->logicalIndex(i);
         const QString text = model()->headerData(i, Qt::Horizontal).toString();
         QAction* action = popup.addAction(text);
         action->setCheckable(true);
-        action->setChecked(!headerView->isSectionHidden(i));
+        action->setChecked(!headerView->isSectionHidden(logicalIndex));
         action->setData(i);
+        if (logicalIndex == 0)
+            action->setEnabled(false);
     }
 
     QAction* activatedAction = popup.exec(header()->mapToGlobal(pos));
Index: src/projectlist.cpp
===================================================================
--- src/projectlist.cpp	(revision 4350)
+++ src/projectlist.cpp	(working copy)
@@ -200,6 +200,7 @@
 void ProjectList::setHeaderInfo(const QByteArray &state)
 {
     m_listView->header()->restoreState(state);
+    m_listView->setCustomHeader();
 }
 
 void ProjectList::slotEditClip()
Index: src/projectlistview.h
===================================================================
--- src/projectlistview.h	(revision 4350)
+++ src/projectlistview.h	(working copy)
@@ -36,6 +36,7 @@
 public:
     ProjectListView(QWidget *parent = 0);
     virtual ~ProjectListView();
+    void setCustomHeader();
 
 protected:
     virtual void contextMenuEvent(QContextMenuEvent * event);
------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Kdenlive-devel mailing list
Kdenlive-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kdenlive-devel

Reply via email to