BUG: 155760
svn path=/trunk/KDE/kdebase/apps/; revision=762385
DolphinDetailsView::DolphinDetailsView(QWidget* parent, DolphinController* controller) :
QTreeView(parent),
DolphinDetailsView::DolphinDetailsView(QWidget* parent, DolphinController* controller) :
QTreeView(parent),
m_controller(controller),
m_font(),
m_decorationSize(),
m_controller(controller),
m_font(),
m_decorationSize(),
headerView->setContextMenuPolicy(Qt::CustomContextMenu);
connect(headerView, SIGNAL(customContextMenuRequested(const QPoint&)),
this, SLOT(configureColumns(const QPoint&)));
headerView->setContextMenuPolicy(Qt::CustomContextMenu);
connect(headerView, SIGNAL(customContextMenuRequested(const QPoint&)),
this, SLOT(configureColumns(const QPoint&)));
+ connect(headerView, SIGNAL(sectionResized(int, int, int)),
+ this, SLOT(slotHeaderSectionResized(int, int, int)));
+ connect(headerView, SIGNAL(sectionHandleDoubleClicked(int)),
+ this, SLOT(disableAutoResizing()));
connect(parent, SIGNAL(sortingChanged(DolphinView::Sorting)),
this, SLOT(setSortIndicatorSection(DolphinView::Sorting)));
connect(parent, SIGNAL(sortingChanged(DolphinView::Sorting)),
this, SLOT(setSortIndicatorSection(DolphinView::Sorting)));
void DolphinDetailsView::resizeEvent(QResizeEvent* event)
{
QTreeView::resizeEvent(event);
void DolphinDetailsView::resizeEvent(QResizeEvent* event)
{
QTreeView::resizeEvent(event);
-
- // 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)) {
+void DolphinDetailsView::slotHeaderSectionResized(int logicalIndex, int oldSize, int newSize)
+{
+ Q_UNUSED(logicalIndex);
+ Q_UNUSED(oldSize);
+ Q_UNUSED(newSize);
+ if (QApplication::mouseButtons() & Qt::LeftButton) {
+ disableAutoResizing();
+ }
+}
+
+void DolphinDetailsView::disableAutoResizing()
+{
+ m_autoResize = false;
+}
+
bool DolphinDetailsView::isZoomInPossible() const
{
DetailsModeSettings* settings = DolphinSettings::instance().detailsModeSettings();
bool DolphinDetailsView::isZoomInPossible() const
{
DetailsModeSettings* settings = DolphinSettings::instance().detailsModeSettings();
void updateColumnVisibility();
void updateColumnVisibility();
+ /**
+ * Disables the automatical resizing of columns, if the user has resized the columns
+ * with the mouse.
+ */
+ void slotHeaderSectionResized(int logicalIndex, int oldSize, int newSize);
+
+ /**
+ * Disables the automatical resizing of the columns. Per default all columns
+ * are resized to use the maximum available width of the view as good as possible.
+ */
+ void disableAutoResizing();
+
private:
bool isZoomInPossible() const;
bool isZoomOutPossible() const;
private:
bool isZoomInPossible() const;
bool isZoomOutPossible() const;
void resizeColumns();
private:
void resizeColumns();
private:
+ bool m_autoResize; // if true, the columns are resized automatically to the available width
+
DolphinController* m_controller;
QFont m_font;
DolphinController* m_controller;
QFont m_font;