mirror of
https://bitbucket.org/mfeemster/fractorium.git
synced 2025-01-21 21:20:07 -05:00
Remove focus handling code from spin boxes. It was originally done to compensate for a bug in Qt, but required the user to make very precise mouse movements. This is no longer needed since the bug has been fixed.
Prevent spatial and density filters from returning empty filters. Another attempt at properly setting the locale for the affine rotate/move/scale combo boxes.
This commit is contained in:
parent
2e054820f7
commit
f5a707ea63
@ -56,6 +56,12 @@ public:
|
|||||||
|
|
||||||
if (m_MaxRad < m_MinRad)
|
if (m_MaxRad < m_MinRad)
|
||||||
m_MaxRad = m_MinRad + 1;
|
m_MaxRad = m_MinRad + 1;
|
||||||
|
|
||||||
|
//Ensure it's valid.
|
||||||
|
while (!Valid())
|
||||||
|
{
|
||||||
|
m_Curve += T(0.1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -244,6 +244,8 @@ bool Renderer<T, bucketT>::CreateSpatialFilter(bool& newAlloc)
|
|||||||
{
|
{
|
||||||
m_SpatialFilter = unique_ptr<SpatialFilter<T>>(
|
m_SpatialFilter = unique_ptr<SpatialFilter<T>>(
|
||||||
SpatialFilterCreator<T>::Create(m_Ember.m_SpatialFilterType, m_Ember.m_SpatialFilterRadius, m_Ember.m_Supersample, m_PixelAspectRatio));
|
SpatialFilterCreator<T>::Create(m_Ember.m_SpatialFilterType, m_Ember.m_SpatialFilterRadius, m_Ember.m_Supersample, m_PixelAspectRatio));
|
||||||
|
|
||||||
|
m_Ember.m_SpatialFilterRadius = m_SpatialFilter->FilterRadius();//It may have been changed internally if it was too small, so ensure they're synced.
|
||||||
newAlloc = true;
|
newAlloc = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,6 +104,8 @@ public:
|
|||||||
/// The caller must manually call this after construction.
|
/// The caller must manually call this after construction.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void Create()
|
void Create()
|
||||||
|
{
|
||||||
|
do
|
||||||
{
|
{
|
||||||
T fw = T(2.0) * m_Support * m_Supersample * m_FilterRadius / m_PixelAspectRatio;
|
T fw = T(2.0) * m_Support * m_Supersample * m_FilterRadius / m_PixelAspectRatio;
|
||||||
T adjust, ii, jj;
|
T adjust, ii, jj;
|
||||||
@ -139,11 +141,15 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Normalize, and return a bad value if the values were too small.
|
//Attempt to normalize, and increase the filter width if the values were too small.
|
||||||
if (!Normalize())
|
if (!Normalize())
|
||||||
m_FinalFilterWidth = -1;
|
{
|
||||||
else
|
|
||||||
m_FinalFilterWidth = fwidth;
|
m_FinalFilterWidth = fwidth;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_FilterRadius += T(0.01);//Values were too small.
|
||||||
|
} while (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -117,26 +117,26 @@ bool DoubleSpinBox::eventFilter(QObject* o, QEvent* e)
|
|||||||
{
|
{
|
||||||
if (e->type() == QMouseEvent::MouseButtonPress && isEnabled())
|
if (e->type() == QMouseEvent::MouseButtonPress && isEnabled())
|
||||||
{
|
{
|
||||||
QPoint pt;
|
// QPoint pt;
|
||||||
|
//
|
||||||
if (QMouseEvent* me = (QMouseEvent*)e)
|
// if (QMouseEvent* me = (QMouseEvent*)e)
|
||||||
pt = me->localPos().toPoint();
|
// pt = me->localPos().toPoint();
|
||||||
|
//
|
||||||
int pos = lineEdit()->cursorPositionAt(pt);
|
// int pos = lineEdit()->cursorPositionAt(pt);
|
||||||
|
//
|
||||||
if (lineEdit()->selectedText() != "")
|
// if (lineEdit()->selectedText() != "")
|
||||||
{
|
// {
|
||||||
lineEdit()->deselect();
|
// lineEdit()->deselect();
|
||||||
lineEdit()->setCursorPosition(pos);
|
// lineEdit()->setCursorPosition(pos);
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
else if (m_Select)
|
// else if (m_Select)
|
||||||
{
|
// {
|
||||||
lineEdit()->setCursorPosition(pos);
|
// lineEdit()->setCursorPosition(pos);
|
||||||
selectAll();
|
// selectAll();
|
||||||
m_Select = false;
|
// m_Select = false;
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
else if (m_DoubleClick && e->type() == QMouseEvent::MouseButtonDblClick && isEnabled())
|
else if (m_DoubleClick && e->type() == QMouseEvent::MouseButtonDblClick && isEnabled())
|
||||||
{
|
{
|
||||||
@ -172,7 +172,7 @@ bool DoubleSpinBox::eventFilter(QObject* o, QEvent* e)
|
|||||||
/// <param name="e">The event</param>
|
/// <param name="e">The event</param>
|
||||||
void DoubleSpinBox::focusInEvent(QFocusEvent* e)
|
void DoubleSpinBox::focusInEvent(QFocusEvent* e)
|
||||||
{
|
{
|
||||||
lineEdit()->setReadOnly(false);
|
//lineEdit()->setReadOnly(false);
|
||||||
QDoubleSpinBox::focusInEvent(e);
|
QDoubleSpinBox::focusInEvent(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,8 +185,8 @@ void DoubleSpinBox::focusInEvent(QFocusEvent* e)
|
|||||||
/// <param name="e">The event</param>
|
/// <param name="e">The event</param>
|
||||||
void DoubleSpinBox::focusOutEvent(QFocusEvent* e)
|
void DoubleSpinBox::focusOutEvent(QFocusEvent* e)
|
||||||
{
|
{
|
||||||
lineEdit()->deselect();//Clear selection when leaving.
|
//lineEdit()->deselect();//Clear selection when leaving.
|
||||||
lineEdit()->setReadOnly(true);//Clever hack to clear the cursor when leaving.
|
//lineEdit()->setReadOnly(true);//Clever hack to clear the cursor when leaving.
|
||||||
QDoubleSpinBox::focusOutEvent(e);
|
QDoubleSpinBox::focusOutEvent(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,8 +197,8 @@ void DoubleSpinBox::focusOutEvent(QFocusEvent* e)
|
|||||||
/// <param name="e">The event</param>
|
/// <param name="e">The event</param>
|
||||||
void DoubleSpinBox::enterEvent(QEvent* e)
|
void DoubleSpinBox::enterEvent(QEvent* e)
|
||||||
{
|
{
|
||||||
m_Select = true;
|
//m_Select = true;
|
||||||
setFocus();
|
//setFocus();
|
||||||
QDoubleSpinBox::enterEvent(e);
|
QDoubleSpinBox::enterEvent(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,7 +209,7 @@ void DoubleSpinBox::enterEvent(QEvent* e)
|
|||||||
/// <param name="e">The event</param>
|
/// <param name="e">The event</param>
|
||||||
void DoubleSpinBox::leaveEvent(QEvent* e)
|
void DoubleSpinBox::leaveEvent(QEvent* e)
|
||||||
{
|
{
|
||||||
m_Select = false;
|
//m_Select = false;
|
||||||
clearFocus();
|
//clearFocus();
|
||||||
QDoubleSpinBox::leaveEvent(e);
|
QDoubleSpinBox::leaveEvent(e);
|
||||||
}
|
}
|
||||||
|
@ -33,13 +33,21 @@ void Fractorium::InitXformsAffineUI()
|
|||||||
SetupAffineSpinner(table, this, 2, 0, m_PostO1Spin, spinHeight, affineMin, affineMax, affineStep, affinePrec, SIGNAL(valueChanged(double)), SLOT(OnO1Changed(double)));
|
SetupAffineSpinner(table, this, 2, 0, m_PostO1Spin, spinHeight, affineMin, affineMax, affineStep, affinePrec, SIGNAL(valueChanged(double)), SLOT(OnO1Changed(double)));
|
||||||
SetupAffineSpinner(table, this, 2, 1, m_PostO2Spin, spinHeight, affineMin, affineMax, affineStep, affinePrec, SIGNAL(valueChanged(double)), SLOT(OnO2Changed(double)));
|
SetupAffineSpinner(table, this, 2, 1, m_PostO2Spin, spinHeight, affineMin, affineMax, affineStep, affinePrec, SIGNAL(valueChanged(double)), SLOT(OnO2Changed(double)));
|
||||||
|
|
||||||
ui.PreRotateCombo->setValidator(new QDoubleValidator(ui.PreRotateCombo));
|
QDoubleValidator* preRotateVal = new QDoubleValidator(ui.PreRotateCombo); preRotateVal->setLocale(QLocale::system());
|
||||||
ui.PreMoveCombo->setValidator( new QDoubleValidator(ui.PreMoveCombo));
|
QDoubleValidator* preMoveVal = new QDoubleValidator(ui.PreMoveCombo); preMoveVal->setLocale(QLocale::system());
|
||||||
ui.PreScaleCombo->setValidator( new QDoubleValidator(ui.PreScaleCombo));
|
QDoubleValidator* preScaleVal = new QDoubleValidator(ui.PreScaleCombo); preScaleVal->setLocale(QLocale::system());
|
||||||
|
|
||||||
ui.PostRotateCombo->setValidator(new QDoubleValidator(ui.PostRotateCombo));
|
QDoubleValidator* postRotateVal = new QDoubleValidator(ui.PostRotateCombo); postRotateVal->setLocale(QLocale::system());
|
||||||
ui.PostMoveCombo->setValidator( new QDoubleValidator(ui.PostMoveCombo));
|
QDoubleValidator* postMoveVal = new QDoubleValidator(ui.PostMoveCombo); postMoveVal->setLocale(QLocale::system());
|
||||||
ui.PostScaleCombo->setValidator( new QDoubleValidator(ui.PostScaleCombo));
|
QDoubleValidator* postScaleVal = new QDoubleValidator(ui.PostScaleCombo); postScaleVal->setLocale(QLocale::system());
|
||||||
|
|
||||||
|
ui.PreRotateCombo->setValidator(preRotateVal);
|
||||||
|
ui.PreMoveCombo->setValidator(preMoveVal);
|
||||||
|
ui.PreScaleCombo->setValidator(preScaleVal);
|
||||||
|
|
||||||
|
ui.PostRotateCombo->setValidator(postRotateVal);
|
||||||
|
ui.PostMoveCombo->setValidator(postMoveVal);
|
||||||
|
ui.PostScaleCombo->setValidator(postScaleVal);
|
||||||
|
|
||||||
connect(ui.PreFlipHorizontalButton, SIGNAL(clicked(bool)), this, SLOT(OnFlipHorizontalButtonClicked(bool)), Qt::QueuedConnection);
|
connect(ui.PreFlipHorizontalButton, SIGNAL(clicked(bool)), this, SLOT(OnFlipHorizontalButtonClicked(bool)), Qt::QueuedConnection);
|
||||||
connect(ui.PreFlipVerticalButton, SIGNAL(clicked(bool)), this, SLOT(OnFlipVerticalButtonClicked(bool)), Qt::QueuedConnection);
|
connect(ui.PreFlipVerticalButton, SIGNAL(clicked(bool)), this, SLOT(OnFlipVerticalButtonClicked(bool)), Qt::QueuedConnection);
|
||||||
|
@ -107,26 +107,26 @@ bool SpinBox::eventFilter(QObject* o, QEvent* e)
|
|||||||
{
|
{
|
||||||
if (e->type() == QMouseEvent::MouseButtonPress && isEnabled())
|
if (e->type() == QMouseEvent::MouseButtonPress && isEnabled())
|
||||||
{
|
{
|
||||||
QPoint pt;
|
//QPoint pt;
|
||||||
|
//
|
||||||
if (QMouseEvent* me = (QMouseEvent*)e)
|
//if (QMouseEvent* me = (QMouseEvent*)e)
|
||||||
pt = me->localPos().toPoint();
|
// pt = me->localPos().toPoint();
|
||||||
|
//
|
||||||
int pos = lineEdit()->cursorPositionAt(pt);
|
//int pos = lineEdit()->cursorPositionAt(pt);
|
||||||
|
//
|
||||||
if (lineEdit()->selectedText() != "")
|
//if (lineEdit()->selectedText() != "")
|
||||||
{
|
//{
|
||||||
lineEdit()->deselect();
|
// lineEdit()->deselect();
|
||||||
lineEdit()->setCursorPosition(pos);
|
// lineEdit()->setCursorPosition(pos);
|
||||||
return true;
|
// return true;
|
||||||
}
|
//}
|
||||||
else if (m_Select)
|
//else if (m_Select)
|
||||||
{
|
//{
|
||||||
lineEdit()->setCursorPosition(pos);
|
// lineEdit()->setCursorPosition(pos);
|
||||||
selectAll();
|
// selectAll();
|
||||||
m_Select = false;
|
// m_Select = false;
|
||||||
return true;
|
// return true;
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
else if (m_DoubleClick && e->type() == QMouseEvent::MouseButtonDblClick && isEnabled())
|
else if (m_DoubleClick && e->type() == QMouseEvent::MouseButtonDblClick && isEnabled())
|
||||||
{
|
{
|
||||||
@ -153,7 +153,7 @@ bool SpinBox::eventFilter(QObject* o, QEvent* e)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return QSpinBox::eventFilter(o, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -162,7 +162,7 @@ bool SpinBox::eventFilter(QObject* o, QEvent* e)
|
|||||||
/// <param name="e">The event</param>
|
/// <param name="e">The event</param>
|
||||||
void SpinBox::focusInEvent(QFocusEvent* e)
|
void SpinBox::focusInEvent(QFocusEvent* e)
|
||||||
{
|
{
|
||||||
lineEdit()->setReadOnly(false);
|
//lineEdit()->setReadOnly(false);
|
||||||
QSpinBox::focusInEvent(e);
|
QSpinBox::focusInEvent(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,8 +175,8 @@ void SpinBox::focusInEvent(QFocusEvent* e)
|
|||||||
/// <param name="e">The event</param>
|
/// <param name="e">The event</param>
|
||||||
void SpinBox::focusOutEvent(QFocusEvent* e)
|
void SpinBox::focusOutEvent(QFocusEvent* e)
|
||||||
{
|
{
|
||||||
lineEdit()->deselect();//Clear selection when leaving.
|
//lineEdit()->deselect();//Clear selection when leaving.
|
||||||
lineEdit()->setReadOnly(true);//Clever hack to clear the cursor when leaving.
|
//lineEdit()->setReadOnly(true);//Clever hack to clear the cursor when leaving.
|
||||||
QSpinBox::focusOutEvent(e);
|
QSpinBox::focusOutEvent(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,8 +187,8 @@ void SpinBox::focusOutEvent(QFocusEvent* e)
|
|||||||
/// <param name="e">The event</param>
|
/// <param name="e">The event</param>
|
||||||
void SpinBox::enterEvent(QEvent* e)
|
void SpinBox::enterEvent(QEvent* e)
|
||||||
{
|
{
|
||||||
m_Select = true;
|
//m_Select = true;
|
||||||
setFocus();
|
//setFocus();
|
||||||
QSpinBox::enterEvent(e);
|
QSpinBox::enterEvent(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,7 +199,7 @@ void SpinBox::enterEvent(QEvent* e)
|
|||||||
/// <param name="e">The event</param>
|
/// <param name="e">The event</param>
|
||||||
void SpinBox::leaveEvent(QEvent* e)
|
void SpinBox::leaveEvent(QEvent* e)
|
||||||
{
|
{
|
||||||
m_Select = false;
|
//m_Select = false;
|
||||||
clearFocus();
|
//clearFocus();
|
||||||
QSpinBox::leaveEvent(e);
|
QSpinBox::leaveEvent(e);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user