mirror of
https://bitbucket.org/mfeemster/fractorium.git
synced 2025-01-22 05:30:06 -05:00
--User changes
-Draw selection circles around all selected xforms plus the current one. --Bug fixes -Add control key as a modifier to increase the amount a spinbox is changed when using right mouse drag to edit. Previously only observed shift key to decrease the value. -Change the copy/paste selected xforms shortcuts to be Ctrl+X+C and Ctrl+X+V. --Code changes -Add function Fractorium::IsXformSelected() to determine if an xform has been selected with the checkboxes.
This commit is contained in:
parent
f1dd20b0ca
commit
66f8f1e50c
@ -136,25 +136,18 @@ void DoubleSpinBox::OnTimeout()
|
|||||||
double scale, val;
|
double scale, val;
|
||||||
double d = value();
|
double d = value();
|
||||||
bool shift = QGuiApplication::keyboardModifiers().testFlag(Qt::ShiftModifier);
|
bool shift = QGuiApplication::keyboardModifiers().testFlag(Qt::ShiftModifier);
|
||||||
//bool ctrl = QGuiApplication::keyboardModifiers().testFlag(Qt::ControlModifier);
|
bool ctrl = QGuiApplication::keyboardModifiers().testFlag(Qt::ControlModifier);
|
||||||
double amount = (m_SmallStep + m_Step) * 0.5;
|
double amount = (m_SmallStep + m_Step) * 0.5;
|
||||||
|
|
||||||
if (shift)
|
if (shift)
|
||||||
{
|
|
||||||
//qDebug() << "Shift pressed";
|
|
||||||
scale = 0.0001;
|
scale = 0.0001;
|
||||||
}
|
else if (ctrl)
|
||||||
/* else if (ctrl)
|
|
||||||
{
|
|
||||||
qDebug() << "Control pressed";
|
|
||||||
scale = 0.01;
|
scale = 0.01;
|
||||||
}*/
|
|
||||||
else
|
else
|
||||||
scale = 0.001;
|
scale = 0.001;
|
||||||
|
|
||||||
val = d + (distance * amount * scale);
|
val = d + (distance * amount * scale);
|
||||||
setValue(val);
|
setValue(val);
|
||||||
//qDebug() << "Timer on, orig val: " << d << ", new val: " << val << ", distance " << distance;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -174,27 +167,6 @@ bool DoubleSpinBox::eventFilter(QObject* o, QEvent* e)
|
|||||||
{
|
{
|
||||||
m_MouseDownPoint = m_MouseMovePoint = me->pos();
|
m_MouseDownPoint = m_MouseMovePoint = me->pos();
|
||||||
StartTimer();
|
StartTimer();
|
||||||
//qDebug() << "Right mouse down";
|
|
||||||
// QPoint pt;
|
|
||||||
//
|
|
||||||
// if (QMouseEvent* me = (QMouseEvent*)e)
|
|
||||||
// pt = me->localPos().toPoint();
|
|
||||||
//
|
|
||||||
// int pos = lineEdit()->cursorPositionAt(pt);
|
|
||||||
//
|
|
||||||
// if (lineEdit()->selectedText() != "")
|
|
||||||
// {
|
|
||||||
// lineEdit()->deselect();
|
|
||||||
// lineEdit()->setCursorPosition(pos);
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
// else if (m_Select)
|
|
||||||
// {
|
|
||||||
// lineEdit()->setCursorPosition(pos);
|
|
||||||
// selectAll();
|
|
||||||
// m_Select = false;
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
else if (isEnabled() &&
|
else if (isEnabled() &&
|
||||||
me &&
|
me &&
|
||||||
@ -203,7 +175,6 @@ bool DoubleSpinBox::eventFilter(QObject* o, QEvent* e)
|
|||||||
{
|
{
|
||||||
StopTimer();
|
StopTimer();
|
||||||
m_MouseDownPoint = m_MouseMovePoint = me->pos();
|
m_MouseDownPoint = m_MouseMovePoint = me->pos();
|
||||||
//qDebug() << "Right mouse up";
|
|
||||||
}
|
}
|
||||||
else if (isEnabled() &&
|
else if (isEnabled() &&
|
||||||
me &&
|
me &&
|
||||||
@ -211,7 +182,6 @@ bool DoubleSpinBox::eventFilter(QObject* o, QEvent* e)
|
|||||||
QGuiApplication::mouseButtons() & Qt::RightButton)
|
QGuiApplication::mouseButtons() & Qt::RightButton)
|
||||||
{
|
{
|
||||||
m_MouseMovePoint = me->pos();
|
m_MouseMovePoint = me->pos();
|
||||||
qDebug() << "Mouse move while right down. Pt = " << me->pos() << ", global: " << mapToGlobal(me->pos());
|
|
||||||
}
|
}
|
||||||
else if (m_DoubleClick && e->type() == QMouseEvent::MouseButtonDblClick && isEnabled())
|
else if (m_DoubleClick && e->type() == QMouseEvent::MouseButtonDblClick && isEnabled())
|
||||||
{
|
{
|
||||||
@ -247,7 +217,6 @@ 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);
|
|
||||||
StopTimer();
|
StopTimer();
|
||||||
QDoubleSpinBox::focusInEvent(e);
|
QDoubleSpinBox::focusInEvent(e);
|
||||||
}
|
}
|
||||||
@ -261,8 +230,6 @@ 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()->setReadOnly(true);//Clever hack to clear the cursor when leaving.
|
|
||||||
StopTimer();
|
StopTimer();
|
||||||
QDoubleSpinBox::focusOutEvent(e);
|
QDoubleSpinBox::focusOutEvent(e);
|
||||||
}
|
}
|
||||||
@ -274,8 +241,6 @@ 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;
|
|
||||||
//setFocus();
|
|
||||||
StopTimer();
|
StopTimer();
|
||||||
QDoubleSpinBox::enterEvent(e);
|
QDoubleSpinBox::enterEvent(e);
|
||||||
}
|
}
|
||||||
@ -287,8 +252,6 @@ 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;
|
|
||||||
//clearFocus();.
|
|
||||||
StopTimer();
|
StopTimer();
|
||||||
QDoubleSpinBox::leaveEvent(e);
|
QDoubleSpinBox::leaveEvent(e);
|
||||||
}
|
}
|
||||||
|
@ -783,7 +783,7 @@ void Fractorium::ToggleTableRow(QTableView* table, int logicalIndex)
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < cols; i++)
|
for (int i = 0; i < cols; i++)
|
||||||
{
|
{
|
||||||
if (auto* spinBox = qobject_cast<DoubleSpinBox*>(tableWidget->cellWidget(logicalIndex, i)))
|
if (auto spinBox = qobject_cast<DoubleSpinBox*>(tableWidget->cellWidget(logicalIndex, i)))
|
||||||
{
|
{
|
||||||
if (!IsNearZero(spinBox->value()))
|
if (!IsNearZero(spinBox->value()))
|
||||||
{
|
{
|
||||||
@ -799,7 +799,7 @@ void Fractorium::ToggleTableRow(QTableView* table, int logicalIndex)
|
|||||||
double val = allZero ? 1.0 : 0.0;
|
double val = allZero ? 1.0 : 0.0;
|
||||||
|
|
||||||
for (int i = 0; i < cols; i++)
|
for (int i = 0; i < cols; i++)
|
||||||
if (auto* spinBox = qobject_cast<DoubleSpinBox*>(tableWidget->cellWidget(logicalIndex, i)))
|
if (auto spinBox = qobject_cast<DoubleSpinBox*>(tableWidget->cellWidget(logicalIndex, i)))
|
||||||
spinBox->setValue(val);
|
spinBox->setValue(val);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -844,7 +844,7 @@ void Fractorium::ToggleTableCol(QTableView* table, int logicalIndex)
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < rows; i++)
|
for (int i = 0; i < rows; i++)
|
||||||
{
|
{
|
||||||
if (auto* spinBox = qobject_cast<DoubleSpinBox*>(tableWidget->cellWidget(i, logicalIndex)))
|
if (auto spinBox = qobject_cast<DoubleSpinBox*>(tableWidget->cellWidget(i, logicalIndex)))
|
||||||
{
|
{
|
||||||
if (!IsNearZero(spinBox->value()))
|
if (!IsNearZero(spinBox->value()))
|
||||||
{
|
{
|
||||||
@ -860,7 +860,7 @@ void Fractorium::ToggleTableCol(QTableView* table, int logicalIndex)
|
|||||||
double val = allZero ? 1.0 : 0.0;
|
double val = allZero ? 1.0 : 0.0;
|
||||||
|
|
||||||
for (int i = 0; i < rows; i++)
|
for (int i = 0; i < rows; i++)
|
||||||
if (auto* spinBox = qobject_cast<DoubleSpinBox*>(tableWidget->cellWidget(i, logicalIndex)))
|
if (auto spinBox = qobject_cast<DoubleSpinBox*>(tableWidget->cellWidget(i, logicalIndex)))
|
||||||
spinBox->setValue(val);
|
spinBox->setValue(val);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -262,6 +262,7 @@ public slots:
|
|||||||
//Xforms Selection.
|
//Xforms Selection.
|
||||||
void OnXformsSelectAllButtonClicked(bool checked);
|
void OnXformsSelectAllButtonClicked(bool checked);
|
||||||
void OnXformsSelectNoneButtonClicked(bool checked);
|
void OnXformsSelectNoneButtonClicked(bool checked);
|
||||||
|
bool IsXformSelected(size_t i);
|
||||||
|
|
||||||
//Xaos.
|
//Xaos.
|
||||||
void OnXaosChanged(double d);
|
void OnXaosChanged(double d);
|
||||||
|
@ -3470,8 +3470,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>118</width>
|
<width>263</width>
|
||||||
<height>618</height>
|
<height>700</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="autoFillBackground">
|
<property name="autoFillBackground">
|
||||||
@ -5485,8 +5485,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>133</width>
|
<width>259</width>
|
||||||
<height>52</height>
|
<height>652</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -7098,7 +7098,7 @@
|
|||||||
<string>Copy selected xforms to the clipboard</string>
|
<string>Copy selected xforms to the clipboard</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="shortcut">
|
<property name="shortcut">
|
||||||
<string>Ctrl+C, X</string>
|
<string>Ctrl+X, Ctrl+C</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="ActionPasteSelectedXforms">
|
<action name="ActionPasteSelectedXforms">
|
||||||
@ -7109,7 +7109,7 @@
|
|||||||
<string>Paste copied xforms into the current flame</string>
|
<string>Paste copied xforms into the current flame</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="shortcut">
|
<property name="shortcut">
|
||||||
<string>Ctrl+V, X</string>
|
<string>Ctrl+X, Ctrl+V</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="ActionResetWorkspace">
|
<action name="ActionResetWorkspace">
|
||||||
|
@ -252,7 +252,7 @@ void FractoriumEmberController<T>::UpdateXform(std::function<void(Xform<T>*)> fu
|
|||||||
{
|
{
|
||||||
if (auto child = m_Fractorium->m_XformsSelectionLayout->itemAt(i))
|
if (auto child = m_Fractorium->m_XformsSelectionLayout->itemAt(i))
|
||||||
{
|
{
|
||||||
if (auto* w = qobject_cast<QCheckBox*>(child->widget()))
|
if (auto w = qobject_cast<QCheckBox*>(child->widget()))
|
||||||
{
|
{
|
||||||
if (w->isChecked())
|
if (w->isChecked())
|
||||||
{
|
{
|
||||||
@ -281,7 +281,7 @@ void FractoriumEmberController<T>::UpdateXform(std::function<void(Xform<T>*)> fu
|
|||||||
{
|
{
|
||||||
if (auto child = m_Fractorium->m_XformsSelectionLayout->itemAt(i))
|
if (auto child = m_Fractorium->m_XformsSelectionLayout->itemAt(i))
|
||||||
{
|
{
|
||||||
if (auto* w = qobject_cast<QCheckBox*>(child->widget()))
|
if (auto w = qobject_cast<QCheckBox*>(child->widget()))
|
||||||
{
|
{
|
||||||
if (w->isChecked())
|
if (w->isChecked())
|
||||||
{
|
{
|
||||||
|
@ -146,7 +146,7 @@ void FractoriumEmberController<T>::RandomXaos()
|
|||||||
{
|
{
|
||||||
for (size_t i = 0; i < m_Ember.XformCount(); i++)
|
for (size_t i = 0; i < m_Ember.XformCount(); i++)
|
||||||
{
|
{
|
||||||
if (auto* xform = m_Ember.GetXform(i))
|
if (auto xform = m_Ember.GetXform(i))
|
||||||
{
|
{
|
||||||
for (size_t j = 0; j < m_Ember.XformCount(); j++)
|
for (size_t j = 0; j < m_Ember.XformCount(); j++)
|
||||||
{
|
{
|
||||||
|
@ -143,7 +143,7 @@ void FractoriumEmberController<T>::AddLinkedXform()
|
|||||||
|
|
||||||
//Set the xaos for all xforms pointing to the new one to zero.
|
//Set the xaos for all xforms pointing to the new one to zero.
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
if (auto* xf = m_Ember.GetXform(i))
|
if (auto xf = m_Ember.GetXform(i))
|
||||||
xf->SetXaos(count - 1, 0);
|
xf->SetXaos(count - 1, 0);
|
||||||
|
|
||||||
xform->SetXaos(count - 1, 1);//Set the xaos value for the previous xform pointing to the new one to one.
|
xform->SetXaos(count - 1, 1);//Set the xaos value for the previous xform pointing to the new one to one.
|
||||||
|
@ -424,7 +424,7 @@ void FractoriumEmberController<T>::MoveXforms(double x, double y, bool pre)
|
|||||||
{
|
{
|
||||||
UpdateXform([&] (Xform<T>* xform)
|
UpdateXform([&] (Xform<T>* xform)
|
||||||
{
|
{
|
||||||
auto* affine = pre ? &xform->m_Affine : &xform->m_Post;
|
auto affine = pre ? &xform->m_Affine : &xform->m_Post;
|
||||||
affine->C(affine->C() + x);
|
affine->C(affine->C() + x);
|
||||||
affine->F(affine->F() + y);
|
affine->F(affine->F() + y);
|
||||||
}, eXformUpdate::UPDATE_SELECTED);
|
}, eXformUpdate::UPDATE_SELECTED);
|
||||||
|
@ -24,6 +24,19 @@ void Fractorium::OnXformsSelectAllButtonClicked(bool checked) { ForEachXformChec
|
|||||||
/// <param name="checked">Ignored</param>
|
/// <param name="checked">Ignored</param>
|
||||||
void Fractorium::OnXformsSelectNoneButtonClicked(bool checked) { ForEachXformCheckbox([&](int i, QCheckBox * w) { w->setChecked(false); }); }
|
void Fractorium::OnXformsSelectNoneButtonClicked(bool checked) { ForEachXformCheckbox([&](int i, QCheckBox * w) { w->setChecked(false); }); }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Return whether the checkbox at the specified index is checked.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="checked">True if checked, else false.</param>
|
||||||
|
bool Fractorium::IsXformSelected(size_t i)
|
||||||
|
{
|
||||||
|
if (auto child = m_XformsSelectionLayout->itemAt(int(i)))
|
||||||
|
if (auto w = qobject_cast<QCheckBox*>(child->widget()))
|
||||||
|
return w->isChecked();
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Clear all of the dynamically created xform checkboxes.
|
/// Clear all of the dynamically created xform checkboxes.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -35,7 +48,7 @@ void Fractorium::ClearXformsSelections()
|
|||||||
|
|
||||||
while (m_XformsSelectionLayout->count() && (child = m_XformsSelectionLayout->takeAt(0)))
|
while (m_XformsSelectionLayout->count() && (child = m_XformsSelectionLayout->takeAt(0)))
|
||||||
{
|
{
|
||||||
auto* w = child->widget();
|
auto w = child->widget();
|
||||||
delete child;
|
delete child;
|
||||||
delete w;
|
delete w;
|
||||||
}
|
}
|
||||||
@ -75,10 +88,8 @@ void Fractorium::ForEachXformCheckbox(std::function<void(int, QCheckBox*)> func)
|
|||||||
|
|
||||||
while (QLayoutItem* child = m_XformsSelectionLayout->itemAt(i))
|
while (QLayoutItem* child = m_XformsSelectionLayout->itemAt(i))
|
||||||
{
|
{
|
||||||
if (auto* w = qobject_cast<QCheckBox*>(child->widget()))
|
if (auto w = qobject_cast<QCheckBox*>(child->widget()))
|
||||||
{
|
|
||||||
func(i, w);
|
func(i, w);
|
||||||
}
|
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
@ -176,7 +176,7 @@ void FractoriumEmberController<T>::ClearVariationsTree()
|
|||||||
for (int i = 0; i < tree->topLevelItemCount(); i++)
|
for (int i = 0; i < tree->topLevelItemCount(); i++)
|
||||||
{
|
{
|
||||||
auto item = tree->topLevelItem(i);
|
auto item = tree->topLevelItem(i);
|
||||||
auto* spinBox = dynamic_cast<VariationTreeDoubleSpinBox*>(tree->itemWidget(item, 1));
|
auto spinBox = dynamic_cast<VariationTreeDoubleSpinBox*>(tree->itemWidget(item, 1));
|
||||||
spinBox->SetValueStealth(0);
|
spinBox->SetValueStealth(0);
|
||||||
|
|
||||||
for (int j = 0; j < item->childCount(); j++)//Iterate through all of the children, which will be the params.
|
for (int j = 0; j < item->childCount(); j++)//Iterate through all of the children, which will be the params.
|
||||||
|
@ -307,7 +307,7 @@ void GLEmberController<T>::DrawAffines(bool pre, bool post)
|
|||||||
for (size_t i = 0; i < ember->TotalXformCount(); i++)
|
for (size_t i = 0; i < ember->TotalXformCount(); i++)
|
||||||
{
|
{
|
||||||
auto xform = ember->GetTotalXform(i);
|
auto xform = ember->GetTotalXform(i);
|
||||||
bool selected = dragging ? (m_SelectedXform == xform) : (m_HoverXform == xform);
|
bool selected = m_Fractorium->IsXformSelected(i) || (dragging ? (m_SelectedXform == xform) : (m_HoverXform == xform));
|
||||||
DrawAffine(xform, true, selected);
|
DrawAffine(xform, true, selected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -321,7 +321,7 @@ void GLEmberController<T>::DrawAffines(bool pre, bool post)
|
|||||||
for (size_t i = 0; i < ember->TotalXformCount(); i++)
|
for (size_t i = 0; i < ember->TotalXformCount(); i++)
|
||||||
{
|
{
|
||||||
auto xform = ember->GetTotalXform(i);
|
auto xform = ember->GetTotalXform(i);
|
||||||
bool selected = dragging ? (m_SelectedXform == xform) : (m_HoverXform == xform);
|
bool selected = m_Fractorium->IsXformSelected(i) || (dragging ? (m_SelectedXform == xform) : (m_HoverXform == xform));
|
||||||
DrawAffine(xform, false, selected);
|
DrawAffine(xform, false, selected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -112,25 +112,18 @@ void SpinBox::OnTimeout()
|
|||||||
double scale, val;
|
double scale, val;
|
||||||
int d = value();
|
int d = value();
|
||||||
bool shift = QGuiApplication::keyboardModifiers().testFlag(Qt::ShiftModifier);
|
bool shift = QGuiApplication::keyboardModifiers().testFlag(Qt::ShiftModifier);
|
||||||
//bool ctrl = QGuiApplication::keyboardModifiers().testFlag(Qt::ControlModifier);
|
bool ctrl = QGuiApplication::keyboardModifiers().testFlag(Qt::ControlModifier);
|
||||||
double amount = (m_SmallStep + m_Step) * 0.5;
|
double amount = (m_SmallStep + m_Step) * 0.5;
|
||||||
|
|
||||||
if (shift)
|
if (shift)
|
||||||
{
|
|
||||||
//qDebug() << "Shift pressed";
|
|
||||||
scale = 0.001;
|
scale = 0.001;
|
||||||
}
|
else if (ctrl)
|
||||||
/* else if (ctrl)
|
scale = 0.01;
|
||||||
{
|
|
||||||
qDebug() << "Control pressed";
|
|
||||||
scale = 0.01;
|
|
||||||
}*/
|
|
||||||
else
|
else
|
||||||
scale = 0.01;
|
scale = 0.01;
|
||||||
|
|
||||||
val = d + (distance * amount * scale);
|
val = d + (distance * amount * scale);
|
||||||
setValue(int(val));
|
setValue(int(val));
|
||||||
//qDebug() << "Timer on, orig val: " << d << ", new val: " << val << ", distance " << distance;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -150,27 +143,6 @@ bool SpinBox::eventFilter(QObject* o, QEvent* e)
|
|||||||
{
|
{
|
||||||
m_MouseDownPoint = m_MouseMovePoint = me->pos();
|
m_MouseDownPoint = m_MouseMovePoint = me->pos();
|
||||||
StartTimer();
|
StartTimer();
|
||||||
//qDebug() << "Right mouse down";
|
|
||||||
// QPoint pt;
|
|
||||||
//
|
|
||||||
// if (QMouseEvent* me = (QMouseEvent*)e)
|
|
||||||
// pt = me->localPos().toPoint();
|
|
||||||
//
|
|
||||||
// int pos = lineEdit()->cursorPositionAt(pt);
|
|
||||||
//
|
|
||||||
// if (lineEdit()->selectedText() != "")
|
|
||||||
// {
|
|
||||||
// lineEdit()->deselect();
|
|
||||||
// lineEdit()->setCursorPosition(pos);
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
// else if (m_Select)
|
|
||||||
// {
|
|
||||||
// lineEdit()->setCursorPosition(pos);
|
|
||||||
// selectAll();
|
|
||||||
// m_Select = false;
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
else if (isEnabled() &&
|
else if (isEnabled() &&
|
||||||
me &&
|
me &&
|
||||||
@ -179,7 +151,6 @@ bool SpinBox::eventFilter(QObject* o, QEvent* e)
|
|||||||
{
|
{
|
||||||
StopTimer();
|
StopTimer();
|
||||||
m_MouseDownPoint = m_MouseMovePoint = me->pos();
|
m_MouseDownPoint = m_MouseMovePoint = me->pos();
|
||||||
//qDebug() << "Right mouse up";
|
|
||||||
}
|
}
|
||||||
else if (isEnabled() &&
|
else if (isEnabled() &&
|
||||||
me &&
|
me &&
|
||||||
@ -187,7 +158,6 @@ bool SpinBox::eventFilter(QObject* o, QEvent* e)
|
|||||||
QGuiApplication::mouseButtons() & Qt::RightButton)
|
QGuiApplication::mouseButtons() & Qt::RightButton)
|
||||||
{
|
{
|
||||||
m_MouseMovePoint = me->pos();
|
m_MouseMovePoint = me->pos();
|
||||||
qDebug() << "Mouse move while right down. Pt = " << me->pos() << ", global: " << mapToGlobal(me->pos());
|
|
||||||
}
|
}
|
||||||
else if (m_DoubleClick && e->type() == QMouseEvent::MouseButtonDblClick && isEnabled())
|
else if (m_DoubleClick && e->type() == QMouseEvent::MouseButtonDblClick && isEnabled())
|
||||||
{
|
{
|
||||||
@ -223,7 +193,6 @@ 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);
|
|
||||||
StopTimer();
|
StopTimer();
|
||||||
QSpinBox::focusInEvent(e);
|
QSpinBox::focusInEvent(e);
|
||||||
}
|
}
|
||||||
@ -237,8 +206,6 @@ 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()->setReadOnly(true);//Clever hack to clear the cursor when leaving.
|
|
||||||
StopTimer();
|
StopTimer();
|
||||||
QSpinBox::focusOutEvent(e);
|
QSpinBox::focusOutEvent(e);
|
||||||
}
|
}
|
||||||
@ -250,8 +217,6 @@ 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;
|
|
||||||
//setFocus();
|
|
||||||
StopTimer();
|
StopTimer();
|
||||||
QSpinBox::enterEvent(e);
|
QSpinBox::enterEvent(e);
|
||||||
}
|
}
|
||||||
@ -263,8 +228,6 @@ 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;
|
|
||||||
//clearFocus();
|
|
||||||
StopTimer();
|
StopTimer();
|
||||||
QSpinBox::leaveEvent(e);
|
QSpinBox::leaveEvent(e);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user