[widgets] still flawed coordonates
This commit is contained in:
parent
3255c144d1
commit
8a9abd5ee9
5 changed files with 20 additions and 42 deletions
2
Hardware/3rdparty/bugui
vendored
2
Hardware/3rdparty/bugui
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 586572a187266d3752e735774a6de62e1463af27
|
||||
Subproject commit 74617670a95ac6cf8bc59c999db89eddc5caed4c
|
|
@ -1,10 +1,12 @@
|
|||
#include <widgets/container_widget.hpp>
|
||||
|
||||
#include "IntervalWidget.hpp"
|
||||
|
||||
namespace Hardware
|
||||
{
|
||||
IntervalWidget::IntervalWidget(Scenario::IntervalModel& interval,
|
||||
container_widget* parent)
|
||||
: bugui::container_widget{parent}
|
||||
bugui::container_widget* parent)
|
||||
: bugui::base_widget{parent}
|
||||
, model{interval}
|
||||
, skin{Process::Style::instance()}
|
||||
{ }
|
||||
|
@ -43,32 +45,20 @@ bool IntervalWidget::contains(int px, int py) const
|
|||
return false;
|
||||
}
|
||||
|
||||
bool IntervalWidget::on_press(int x, int y, bool pressed)
|
||||
void IntervalWidget::on_press(int x, int y, bool pressed)
|
||||
{
|
||||
if (!contains(x, y)) return false;
|
||||
|
||||
qDebug() << "is inside!";
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IntervalWidget::on_double_press(int x, int y)
|
||||
void IntervalWidget::on_double_press(int x, int y)
|
||||
{
|
||||
if (!contains(x, y)) return false;
|
||||
|
||||
qDebug() << "double pressed !";
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IntervalWidget::on_drag(int from_x, int from_y, int to_x, int to_y)
|
||||
void IntervalWidget::on_drag(int from_x, int from_y, int to_x, int to_y)
|
||||
{
|
||||
if (!contains(from_x, from_y)) return false;
|
||||
|
||||
if (from_y != to_y)
|
||||
model.requestHeightChange(to_y / static_cast<double>(parent->height()));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
const Scenario::IntervalModel& IntervalWidget::get_model() const
|
||||
|
|
|
@ -2,19 +2,19 @@
|
|||
|
||||
#include <Scenario/Document/Interval/IntervalModel.hpp>
|
||||
#include <Process/Style/ScenarioStyle.hpp>
|
||||
#include <widgets/container_widget.hpp>
|
||||
#include <widgets/base_widget.hpp>
|
||||
|
||||
namespace Hardware
|
||||
{
|
||||
struct IntervalWidget final : bugui::container_widget
|
||||
struct IntervalWidget final : bugui::base_widget
|
||||
{
|
||||
explicit IntervalWidget(Scenario::IntervalModel& interval,
|
||||
container_widget* parent);
|
||||
bugui::container_widget* parent);
|
||||
|
||||
void paint(bugui::painter& painter) const override;
|
||||
bool on_press(int x, int y, bool pressed) override;
|
||||
bool on_double_press(int x, int y) override;
|
||||
bool on_drag(int from_x, int from_y, int to_x, int to_y) override;
|
||||
void on_press(int x, int y, bool pressed) override;
|
||||
void on_double_press(int x, int y) override;
|
||||
void on_drag(int from_x, int from_y, int to_x, int to_y) override;
|
||||
|
||||
int x() const override;
|
||||
int y() const override;
|
||||
|
|
|
@ -38,32 +38,20 @@ bool StateWidget::contains(int px, int py) const
|
|||
return false;
|
||||
}
|
||||
|
||||
bool StateWidget::on_press(int x, int y, bool pressed)
|
||||
void StateWidget::on_press(int x, int y, bool pressed)
|
||||
{
|
||||
if (!contains(x, y)) return false;
|
||||
|
||||
qDebug() << "is inside!";
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool StateWidget::on_double_press(int x, int y)
|
||||
void StateWidget::on_double_press(int x, int y)
|
||||
{
|
||||
if (!contains(x, y)) return false;
|
||||
|
||||
qDebug() << "double pressed !";
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool StateWidget::on_drag(int from_x, int from_y, int to_x, int to_y)
|
||||
void StateWidget::on_drag(int from_x, int from_y, int to_x, int to_y)
|
||||
{
|
||||
if (!contains(from_x, from_y)) return false;
|
||||
|
||||
if (from_y != to_y)
|
||||
model.setHeightPercentage(to_y / static_cast<double>(parent->height()));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
const Scenario::StateModel& StateWidget::get_model() const
|
||||
|
|
|
@ -12,9 +12,9 @@ struct StateWidget final : bugui::container_widget
|
|||
container_widget* parent);
|
||||
|
||||
void paint(bugui::painter& painter) const override;
|
||||
bool on_press(int x, int y, bool pressed) override;
|
||||
bool on_double_press(int x, int y) override;
|
||||
bool on_drag(int from_x, int from_y, int to_x, int to_y) override;
|
||||
void on_press(int x, int y, bool pressed) override;
|
||||
void on_double_press(int x, int y) override;
|
||||
void on_drag(int from_x, int from_y, int to_x, int to_y) override;
|
||||
|
||||
int x() const override;
|
||||
int y() const override;
|
||||
|
|
Loading…
Add table
Reference in a new issue