Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 22ccd662 authored by Wolthera van Hövell's avatar Wolthera van Hövell 🛍

Make prettier and change previous color focus event.

Ref 2438
parent 8c291425
...@@ -53,6 +53,7 @@ KisInternalColorSelector::KisInternalColorSelector(QWidget *parent, KoColor colo ...@@ -53,6 +53,7 @@ KisInternalColorSelector::KisInternalColorSelector(QWidget *parent, KoColor colo
,m_d(new Private) ,m_d(new Private)
{ {
setModal(modal); setModal(modal);
this->setFocusPolicy(Qt::ClickFocus);
m_ui = new Ui_WdgDlgInternalColorSelector(); m_ui = new Ui_WdgDlgInternalColorSelector();
m_ui->setupUi(this); m_ui->setupUi(this);
if (!modal) { if (!modal) {
...@@ -90,9 +91,12 @@ KisInternalColorSelector::KisInternalColorSelector(QWidget *parent, KoColor colo ...@@ -90,9 +91,12 @@ KisInternalColorSelector::KisInternalColorSelector(QWidget *parent, KoColor colo
m_ui->currentColor->setColor(m_d->currentColor); m_ui->currentColor->setColor(m_d->currentColor);
m_ui->currentColor->setDisplayRenderer(displayRenderer); m_ui->currentColor->setDisplayRenderer(displayRenderer);
m_ui->currentColor->setFrameStyle(QFrame::StyledPanel);
m_ui->previousColor->setColor(m_d->currentColor); m_ui->previousColor->setColor(m_d->currentColor);
m_ui->previousColor->setDisplayRenderer(displayRenderer); m_ui->previousColor->setDisplayRenderer(displayRenderer);
m_ui->previousColor->setFrameStyle(QFrame::StyledPanel);
connect(this, SIGNAL(accepted()), this, SLOT(setPreviousColor())); connect(this, SIGNAL(accepted()), this, SLOT(setPreviousColor()));
connect(m_ui->previousColor, SIGNAL(triggered(KoColorPatch*)), SLOT(slotSetColorFromPatch(KoColorPatch*)));
connect(this, SIGNAL(signalForegroundColorChosen(KoColor)), this, SLOT(slotLockSelector())); connect(this, SIGNAL(signalForegroundColorChosen(KoColor)), this, SLOT(slotLockSelector()));
m_d->compressColorChanges = new KisSignalCompressor(100 /* ms */, KisSignalCompressor::POSTPONE, this); m_d->compressColorChanges = new KisSignalCompressor(100 /* ms */, KisSignalCompressor::POSTPONE, this);
...@@ -205,8 +209,12 @@ void KisInternalColorSelector::endUpdateWithNewColor() ...@@ -205,8 +209,12 @@ void KisInternalColorSelector::endUpdateWithNewColor()
m_d->allowUpdates = true; m_d->allowUpdates = true;
} }
void KisInternalColorSelector::leaveEvent(QEvent *) void KisInternalColorSelector::focusInEvent(QFocusEvent *e)
{ {
setPreviousColor(); setPreviousColor();
}
void KisInternalColorSelector::slotSetColorFromPatch(KoColorPatch* patch)
{
slotColorUpdated(patch->color());
} }
...@@ -113,6 +113,9 @@ private Q_SLOTS: ...@@ -113,6 +113,9 @@ private Q_SLOTS:
*/ */
void setPreviousColor(); void setPreviousColor();
void slotSetColorFromPatch(KoColorPatch* patch);
private: private:
Ui_WdgDlgInternalColorSelector *m_ui; //the UI Ui_WdgDlgInternalColorSelector *m_ui; //the UI
struct Private; //The private struct struct Private; //The private struct
...@@ -125,7 +128,7 @@ private: ...@@ -125,7 +128,7 @@ private:
*/ */
void updateAllElements(QObject *source); void updateAllElements(QObject *source);
virtual void leaveEvent(QEvent *); virtual void focusInEvent(QFocusEvent *e);
}; };
#endif // KISINTERNALCOLORSELECTOR_H #endif // KISINTERNALCOLORSELECTOR_H
...@@ -116,7 +116,7 @@ void KoColorSetWidget::KoColorSetWidgetPrivate::addRecent(const KoColor &color) ...@@ -116,7 +116,7 @@ void KoColorSetWidget::KoColorSetWidgetPrivate::addRecent(const KoColor &color)
{ {
if(numRecents<6) { if(numRecents<6) {
recentPatches[numRecents] = new KoColorPatch(thePublic); recentPatches[numRecents] = new KoColorPatch(thePublic);
recentPatches[numRecents]->setFrameShape(QFrame::Box); recentPatches[numRecents]->setFrameShape(QFrame::StyledPanel);
recentPatches[numRecents]->setDisplayRenderer(displayRenderer); recentPatches[numRecents]->setDisplayRenderer(displayRenderer);
recentsLayout->insertWidget(numRecents+1, recentPatches[numRecents]); recentsLayout->insertWidget(numRecents+1, recentPatches[numRecents]);
connect(recentPatches[numRecents], SIGNAL(triggered(KoColorPatch *)), thePublic, SLOT(colorTriggered(KoColorPatch *))); connect(recentPatches[numRecents], SIGNAL(triggered(KoColorPatch *)), thePublic, SLOT(colorTriggered(KoColorPatch *)));
......
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