还是一堆bug的状态
This commit is contained in:
@@ -10,59 +10,63 @@ Frame_Less_Widget::Frame_Less_Widget(QWidget* parent) : QWidget(parent) {
|
||||
setAttribute(Qt::WA_TranslucentBackground);
|
||||
// setAttribute(Qt::WA_Mapped);
|
||||
setWindowFlags(
|
||||
Qt::Window |
|
||||
Qt::FramelessWindowHint |
|
||||
Qt::WindowSystemMenuHint |
|
||||
Qt::WindowMinimizeButtonHint |
|
||||
Qt::WindowMaximizeButtonHint);
|
||||
Qt::Window |
|
||||
Qt::FramelessWindowHint |
|
||||
Qt::WindowSystemMenuHint |
|
||||
Qt::WindowMinimizeButtonHint |
|
||||
Qt::WindowMaximizeButtonHint);
|
||||
space = 0;
|
||||
radius = 16;
|
||||
top_margin = 16;
|
||||
bottom_margin = 16;
|
||||
right_margin = 16;
|
||||
left_margin = 16;
|
||||
shapes = {Qt::SizeFDiagCursor, Qt::SizeVerCursor, Qt::SizeBDiagCursor,
|
||||
Qt::SizeHorCursor, Qt::ArrowCursor, Qt::SizeHorCursor,
|
||||
Qt::SizeBDiagCursor, Qt::SizeVerCursor, Qt::SizeFDiagCursor,
|
||||
Qt::ArrowCursor};
|
||||
change_sizes = {[this]() {
|
||||
// R11
|
||||
setGeometry(start_x + dx, start_y + dy, qMax(start_w - dx, get_min_width()), qMax(start_h - dy, get_min_height()));
|
||||
},
|
||||
[this]() {
|
||||
// R12
|
||||
setGeometry(start_x, start_y + dy, qMax(start_w, get_min_width()), qMax(start_h - dy, get_min_height()));
|
||||
},
|
||||
[this]() {
|
||||
// R13
|
||||
setGeometry(start_x, start_y + dy, qMax(start_w + dx, get_min_width()), qMax(start_h - dy, get_min_height()));
|
||||
},
|
||||
[this]() {
|
||||
// R21
|
||||
setGeometry(start_x + dx, start_y, qMax(start_w - dx, get_min_width()), qMax(start_h, get_min_height()));
|
||||
},
|
||||
[]() {
|
||||
// R22
|
||||
},
|
||||
[this]() {
|
||||
// R23
|
||||
setGeometry(start_x, start_y, qMax(start_w + dx, get_min_width()), qMax(start_h, get_min_height()));
|
||||
},
|
||||
[this]() {
|
||||
// R31
|
||||
setGeometry(start_x + dx, start_y, qMax(start_w - dx, get_min_width()), qMax(start_h + dy, get_min_height()));
|
||||
},
|
||||
[this]() {
|
||||
// R32
|
||||
setGeometry(start_x, start_y, qMax(start_w, get_min_width()), qMax(start_h + dy, get_min_height()));
|
||||
},
|
||||
[this]() {
|
||||
// R33
|
||||
setGeometry(start_x, start_y, qMax(start_w + dx, get_min_width()), qMax(start_h + dy, get_min_height()));
|
||||
},
|
||||
[]() {
|
||||
// null
|
||||
}};
|
||||
shapes = {
|
||||
Qt::SizeFDiagCursor, Qt::SizeVerCursor, Qt::SizeBDiagCursor,
|
||||
Qt::SizeHorCursor, Qt::ArrowCursor, Qt::SizeHorCursor,
|
||||
Qt::SizeBDiagCursor, Qt::SizeVerCursor, Qt::SizeFDiagCursor,
|
||||
Qt::ArrowCursor
|
||||
};
|
||||
change_sizes = {
|
||||
[this]() {
|
||||
// R11
|
||||
setGeometry(start_x + dx, start_y + dy, qMax(start_w - dx, get_min_width()), qMax(start_h - dy, get_min_height()));
|
||||
},
|
||||
[this]() {
|
||||
// R12
|
||||
setGeometry(start_x, start_y + dy, qMax(start_w, get_min_width()), qMax(start_h - dy, get_min_height()));
|
||||
},
|
||||
[this]() {
|
||||
// R13
|
||||
setGeometry(start_x, start_y + dy, qMax(start_w + dx, get_min_width()), qMax(start_h - dy, get_min_height()));
|
||||
},
|
||||
[this]() {
|
||||
// R21
|
||||
setGeometry(start_x + dx, start_y, qMax(start_w - dx, get_min_width()), qMax(start_h, get_min_height()));
|
||||
},
|
||||
[]() {
|
||||
// R22
|
||||
},
|
||||
[this]() {
|
||||
// R23
|
||||
setGeometry(start_x, start_y, qMax(start_w + dx, get_min_width()), qMax(start_h, get_min_height()));
|
||||
},
|
||||
[this]() {
|
||||
// R31
|
||||
setGeometry(start_x + dx, start_y, qMax(start_w - dx, get_min_width()), qMax(start_h + dy, get_min_height()));
|
||||
},
|
||||
[this]() {
|
||||
// R32
|
||||
setGeometry(start_x, start_y, qMax(start_w, get_min_width()), qMax(start_h + dy, get_min_height()));
|
||||
},
|
||||
[this]() {
|
||||
// R33
|
||||
setGeometry(start_x, start_y, qMax(start_w + dx, get_min_width()), qMax(start_h + dy, get_min_height()));
|
||||
},
|
||||
[]() {
|
||||
// null
|
||||
}
|
||||
};
|
||||
}
|
||||
int Frame_Less_Widget::get_min_width() {
|
||||
return 0;
|
||||
@@ -116,7 +120,7 @@ void Frame_Less_Widget::paintEvent(QPaintEvent* event) {
|
||||
bool Frame_Less_Widget::event(QEvent* event) {
|
||||
if (event->type() == QEvent::HoverMove) {
|
||||
auto* hover_event = static_cast<QHoverEvent*>(event);
|
||||
// qDebug() << hover_event->pos();
|
||||
// std::cout << hover_event->pos();
|
||||
QMouseEvent mouse_event(QEvent::MouseMove, hover_event->pos(),
|
||||
Qt::NoButton, Qt::NoButton, Qt::NoModifier);
|
||||
mouseMoveEvent(&mouse_event);
|
||||
|
||||
Reference in New Issue
Block a user