Commit c2434f03 authored by Halla Rempt's avatar Halla Rempt
Browse files

Improvements to the Image docker

patches by Christer Stenbrenden (christer.stenbrenden@gmail.com)
CCBUG: 297535

* Displays a color picker when hover over the image in the docker
* Image docker scales horizontally to fit filenames
* Use the theme highlight color for selected icon
parent 84b682d4
......@@ -98,6 +98,12 @@
</item>
<item>
<widget class="QTreeView" name="treeView">
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAsNeeded</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
......@@ -136,9 +142,18 @@
<property name="minimumSize">
<size>
<width>50</width>
<height>50</height>
<height>110</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>110</height>
</size>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
</widget>
</widget>
</item>
......
......@@ -184,7 +184,7 @@ ImageDockerDock::ImageDockerDock():
m_ui->cmbImg->setModel(m_imgListModel);
m_ui->bnPopup->setIcon(koIcon("zoom-original"));
m_ui->bnPopup->setPopupWidget(m_popupUi);
m_popupUi->zoomSlider->setRange(5, 500);
m_popupUi->zoomSlider->setValue(100);
......@@ -194,7 +194,8 @@ ImageDockerDock::ImageDockerDock():
m_zoomButtons->addButton(m_popupUi->bnZoom50 , 50);
m_zoomButtons->addButton(m_popupUi->bnZoom75 , 75);
m_zoomButtons->addButton(m_popupUi->bnZoom100 , 100);
installEventFilter(this);
m_ui->cmbPath->addItem(koIcon("folder-image"), QDesktopServices::storageLocation(QDesktopServices::PicturesLocation));
m_ui->cmbPath->addItem(koIcon("folder-documents"), QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation));
......@@ -502,3 +503,15 @@ void ImageDockerDock::slotChangeRoot(const QString &path)
m_ui->treeView->setRootIndex(m_proxyModel->mapFromSource(m_model->index(path)));
updatePath(path);
}
bool ImageDockerDock::eventFilter(QObject *obj, QEvent *event)
{
Q_UNUSED(obj);
if (event->type() == QEvent::Resize)
{
m_ui->treeView->setColumnWidth(0, width());
return true;
}
return false;
}
......@@ -75,6 +75,9 @@ private slots:
void slotCloseZoomPopup();
void slotChangeRoot(const QString& path);
protected:
bool eventFilter(QObject *obj, QEvent *event);
private:
void addCurrentPathToHistory();
void updatePath(const QString& path);
......
......@@ -92,7 +92,10 @@ void KisImageItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* opti
}
if(isSelected())
painter->fillRect(boundingRect(), Qt::Dense5Pattern);
{
QPen pen(palette().color(QPalette::Active, QPalette::Highlight), 3);
painter->setPen(pen);
}
painter->drawRect(boundingRect());
}
......
......@@ -16,6 +16,7 @@
*/
#include "kis_image_view.h"
#include <kis_cursor.h>
#include <QPaintEvent>
#include <QMouseEvent>
......@@ -32,6 +33,7 @@ KisImageViewport::KisImageViewport():
m_rubberBand(QRubberBand::Rectangle, this)
{
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
setCursor(KisCursor::pickerCursor());
}
void KisImageViewport::paintEvent(QPaintEvent* event)
......@@ -91,6 +93,7 @@ void KisImageViewport::mousePressEvent(QMouseEvent* event)
void KisImageViewport::mouseMoveEvent(QMouseEvent* event)
{
if(m_mousePressed) {
setCursor(KisCursor::arrowCursor());
QPoint size = event->pos() - m_selection.topLeft();
m_selection.setSize(QSize(size.x(), size.y()));
m_rubberBand.setGeometry(m_selection.normalized());
......@@ -100,6 +103,7 @@ void KisImageViewport::mouseMoveEvent(QMouseEvent* event)
void KisImageViewport::mouseReleaseEvent(QMouseEvent* event)
{
m_selection = m_selection.normalized();
setCursor(KisCursor::pickerCursor());
if(m_selection.width() > 5 && m_selection.height() > 5) {
QRect imgRect = imageRect();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment