OSDN Git Service

refactoring. but currently buggy.
authorikemo <ikemo@56b19765-1e22-0410-a548-a0f45d66c51a>
Mon, 31 Jan 2005 15:50:37 +0000 (15:50 +0000)
committerikemo <ikemo@56b19765-1e22-0410-a548-a0f45d66c51a>
Mon, 31 Jan 2005 15:50:37 +0000 (15:50 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/kita/kita/trunk@1690 56b19765-1e22-0410-a548-a0f45d66c51a

kita/src/board/boardview.cpp
kita/src/board/threadlistview.cpp

index 78936e2..a502ca3 100644 (file)
@@ -84,8 +84,8 @@ KitaBoardView::KitaBoardView( QWidget* parent, const char* name )
              SLOT( slotSizeChange( int, int, int ) ) );
 
     header->installEventFilter( this );
-    loadHeaderOnOff();
     loadLayout();
+    loadHeaderOnOff();
 }
 
 KitaBoardView::~KitaBoardView()
@@ -499,20 +499,9 @@ bool KitaBoardView::eventFilter( QObject* watched, QEvent* e )
             if ( id == 999 ) {
                 setAutoResize( ! popup.isItemChecked( 999 ) );
             } else if ( popup.isItemChecked( id ) ) {
-                // hide
-                subjectList->setColumnWidthMode( id, QListView::Manual );
-                subjectList->header() ->setResizeEnabled( false );
-                subjectList->setColumnWidth( id, 0 );
+                hideColumn( id );
             } else {
-                // show
-                subjectList->setColumnWidthMode( id, QListView::Manual );
-                subjectList->header() ->setResizeEnabled( true );
-#if QT_VERSION >= 0x030200
-                subjectList->adjustColumn( id );
-#else
-                subjectList->setColumnWidth( id, 30 );
-#endif
-
+                showColumn( id );
             }
             saveHeaderOnOff();
             return true;
@@ -548,19 +537,11 @@ void KitaBoardView::loadHeaderOnOff()
     config.setGroup( "Column" );
     for ( int i = Col_Begin; i <= Col_End; i++ ) {
         bool isShown = config.readBoolEntry( s_colAttr[ i ].keyName, s_colAttr[ i ].showDefault );
+        qDebug("%s: isShown %d", s_colAttr[i].keyName.latin1(), isShown );
         if ( isShown ) {
-            subjectList->setColumnWidthMode( i, QListView::Maximum );
-            header->setResizeEnabled( true, i );
-#if QT_VERSION >= 0x030200
-            subjectList->adjustColumn( i );
-#else
-            subjectList->setColumnWidth( i, 30 );
-#endif
-
+            showColumn( i );
         } else {
-            subjectList->setColumnWidthMode( i, QListView::Manual );
-            header->setResizeEnabled( false, i );
-            subjectList->setColumnWidth( i, 0 );
+            hideColumn( i );
         }
     }
 }
index 0dd70c0..4caf974 100644 (file)
@@ -206,6 +206,14 @@ void ThreadListView::hideColumn( int col )
 
 void ThreadListView::showColumn( int col )
 {
+    QHeader* header = subjectList->header();
+    subjectList->setColumnWidthMode( col, QListView::Maximum );
+    header->setResizeEnabled( true, col );
+#if QT_VERSION >= 0x030200
+    subjectList->adjustColumn( col );
+#else
+    subjectList->setColumnWidth( col, 30 );
+#endif
 }
 
 #include "threadlistview.moc"