[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [calligra] krita/ui/widgets: removed delete button in the preset strip as that triggered accidential
From: Sven Langkamp <sven.langkamp () gmail ! com>
Date: 2013-06-30 21:05:46
Message-ID: E1UtOoc-00025R-Jq () scm ! kde ! org
[Download RAW message or body]
Git commit d5f62e2e075be875e18ba5b776e702541070475b by Sven Langkamp.
Committed on 30/06/2013 at 21:04.
Pushed by langkamp into branch 'master'.
removed delete button in the preset strip as that triggered accidential delete \
operations for many users BUG:319852
M +0 -59 krita/ui/widgets/kis_preset_selector_strip.cpp
M +1 -29 krita/ui/widgets/kis_preset_selector_strip.h
http://commits.kde.org/calligra/d5f62e2e075be875e18ba5b776e702541070475b
diff --git a/krita/ui/widgets/kis_preset_selector_strip.cpp \
b/krita/ui/widgets/kis_preset_selector_strip.cpp index 4eddfc4..1953d91 100644
--- a/krita/ui/widgets/kis_preset_selector_strip.cpp
+++ b/krita/ui/widgets/kis_preset_selector_strip.cpp
@@ -27,7 +27,6 @@
#include <QAbstractScrollArea>
#include <QMouseEvent>
-#include <QTimer>
KisPresetSelectorStrip::KisPresetSelectorStrip(QWidget* parent)
: QWidget(parent)
@@ -38,69 +37,19 @@ KisPresetSelectorStrip::KisPresetSelectorStrip(QWidget* parent)
m_resourceItemView = smallPresetChooser->itemChooser()->itemView();
m_resourceItemView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
m_resourceItemView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
-
- m_refresher = new QTimer(this);
- m_refresher->setSingleShot(true);
/* This is an heuristic to fill smallPresetChooser with only the presets
* for the paintop that comes selected by default: Pixel Brush. */
const QString PIXEL_BRUSH_ID = "paintbrush";
- deletePresetBtn->setIcon(koIcon("trash-empty"));
- deletePresetBtn->setVisible(true);
-
connect(smallPresetChooser, SIGNAL(resourceSelected(KoResource*)),
this, SLOT(prepareDeleteButton()));
connect(smallPresetChooser, SIGNAL(resourceSelected(KoResource*)),
this, SLOT(startRefreshingTimer()));
- connect(m_refresher, SIGNAL(timeout()), this, SLOT(repaintDeleteButton()));
}
KisPresetSelectorStrip::~KisPresetSelectorStrip()
{
- delete m_refresher;
-}
-
-void KisPresetSelectorStrip::showEvent(QShowEvent* event)
-{
- deletePresetBtn->hide();
- QWidget::showEvent(event);
-}
-
-void KisPresetSelectorStrip::currentPaintopChanged(QString paintOpID)
-{
- deletePresetBtn->hide();
-}
-
-void KisPresetSelectorStrip::startRefreshingTimer()
-{
- // Estimated time it takes for the ResourceView to scroll when a widget
- // that is only partially visible becomes visible
- m_refresher->start(450);
-}
-
-void KisPresetSelectorStrip::repaintDeleteButton()
-{
- if (deletePresetBtn->isVisible()) {
- prepareDeleteButton();
- }
-}
-
-void KisPresetSelectorStrip::prepareDeleteButton()
-{
- const quint8 HEURISTIC_OFFSET = 7; // This number is just conjured out of the \
nether to make
- // things look good
- quint16 buttonWidth = deletePresetBtn->width();
- quint16 buttonHeight = deletePresetBtn->height();
- quint16 columnWidth = m_resourceItemView->columnWidth(0); // All columns \
assumed equal in width
- quint16 currentColumn = m_resourceItemView->currentIndex().column();
- quint16 rowHeight = m_resourceItemView->rowHeight(0); // There is only \
1 row in this widget
- quint16 yPos = rowHeight - deletePresetBtn->height() + \
HEURISTIC_OFFSET;
- quint16 xPos = \
m_resourceItemView->columnViewportPosition(currentColumn)
- + columnWidth + HEURISTIC_OFFSET - buttonWidth;
-
- deletePresetBtn->setGeometry(xPos, yPos, buttonWidth, buttonHeight);
- deletePresetBtn->setVisible(true);
}
void KisPresetSelectorStrip::on_leftScrollBtn_pressed()
@@ -121,12 +70,4 @@ void KisPresetSelectorStrip::on_rightScrollBtn_pressed()
deletePresetBtn->setVisible(false);
}
-void KisPresetSelectorStrip::on_deletePresetBtn_clicked()
-{
- KoResourceItemChooser* itemChooser = smallPresetChooser->itemChooser();
- itemChooser->slotButtonClicked(KoResourceItemChooser::Button_Remove);
- deletePresetBtn->hide();
- smallPresetChooser->updateViewSettings();
-}
-
#include "kis_preset_selector_strip.moc"
diff --git a/krita/ui/widgets/kis_preset_selector_strip.h \
b/krita/ui/widgets/kis_preset_selector_strip.h index 1a92270..580a9cc 100644
--- a/krita/ui/widgets/kis_preset_selector_strip.h
+++ b/krita/ui/widgets/kis_preset_selector_strip.h
@@ -45,47 +45,19 @@ public:
KisPresetSelectorStrip(QWidget *parent);
virtual ~KisPresetSelectorStrip();
- virtual void showEvent(QShowEvent *event);
-
-public slots:
- /// Updates the contents of the strip item view, show only presets for @param \
paintOpID
- void currentPaintopChanged(QString paintOpID);
-
- /**
- * startRefreshingTimer() and repaintDeleteButton() are heuristics
- * to reposition the delete button when the strip auto-scrolls
- * to show a selected item that's partly outside the item view
- */
- void startRefreshingTimer();
- void repaintDeleteButton();
-
private slots:
- /**
- * Properly position the delete button on the bottom right corner of the \
currently
- * selected preset item
- */
- void prepareDeleteButton();
-
/// Scrolls the strip's item view to the left
void on_leftScrollBtn_pressed();
/// Scrolls the strip's item view to the right
void on_rightScrollBtn_pressed();
-
- /**
- * This small button will hover over a preset when it is selected;
- * and will remove the preset when clicked
- */
- void on_deletePresetBtn_clicked();
-
+
private:
/**
* This is a workaround to access members of KisPresetChooser using the QObject \
tree
* instead of class methods
*/
KoResourceItemView* m_resourceItemView;
-
- QTimer* m_refresher;
};
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic