]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphindetailsview.cpp
Fix i18n
[dolphin.git] / src / dolphindetailsview.cpp
index 3fd1e94680dc6b654ede2cf107a06dbba14db05f..f3d55a8c30ccfcfe22028515b113f33e2a6a8d04 100644 (file)
@@ -60,6 +60,7 @@ DolphinDetailsView::DolphinDetailsView(QWidget* parent, DolphinController* contr
     setDragDropMode(QAbstractItemView::DragDrop);
     setDropIndicatorShown(false);
     setAlternatingRowColors(true);
+    setItemsExpandable(false);
 
     setMouseTracking(true);
     viewport()->setAttribute(Qt::WA_Hover);
@@ -136,7 +137,7 @@ bool DolphinDetailsView::event(QEvent* event)
 {
     if (event->type() == QEvent::Polish) {
         QHeaderView* headerView = header();
-        headerView->setResizeMode(QHeaderView::Fixed);
+        headerView->setResizeMode(QHeaderView::Interactive);
         headerView->setMovable(false);
 
         updateColumnVisibility();
@@ -251,7 +252,8 @@ void DolphinDetailsView::dragMoveEvent(QDragMoveEvent* event)
         m_dragging = false;
     } else {
         m_dragging = true;
-        if (itemForIndex(index).isDir()) {
+        const KFileItem item = itemForIndex(index);
+        if (!item.isNull() && item.isDir()) {
             m_dropRect = visualRect(index);
         } else {
             m_dropRect.setSize(QSize()); // set as invalid
@@ -321,7 +323,15 @@ void DolphinDetailsView::keyPressEvent(QKeyEvent* event)
 void DolphinDetailsView::resizeEvent(QResizeEvent* event)
 {
     QTreeView::resizeEvent(event);
-    resizeColumns();
+
+    // TODO: There seems to be no easy way to find out whether the resize event
+    // has been triggered because of resizing the window or by adjusting the column-width
+    // by a left mouse-click (the columns should only be resized automatically when the window
+    // size is adjusted). The following workaround works well, but it should be
+    // considered solving this in a more transparent way.
+    if (!(QApplication::mouseButtons() & Qt::LeftButton)) {
+        resizeColumns();
+    }
 }
 
 void DolphinDetailsView::closeEvent(QCloseEvent* event)