diff options
author | Ken Moore <moorekou@gmail.com> | 2016-02-04 15:31:37 -0500 |
---|---|---|
committer | Ken Moore <moorekou@gmail.com> | 2016-02-04 15:31:37 -0500 |
commit | 3a1c090e928292828a6ce28e9684be83e515a5b1 (patch) | |
tree | b327144d3b2bfc4592175a1ccb7648e84fecd149 | |
parent | Clean up the thumbnail loading routine a bit more in lumina-fm. Due to the mu... (diff) | |
download | lumina-3a1c090e928292828a6ce28e9684be83e515a5b1.tar.gz lumina-3a1c090e928292828a6ce28e9684be83e515a5b1.tar.bz2 lumina-3a1c090e928292828a6ce28e9684be83e515a5b1.zip |
Tinker with the resizeMenu class to try and bypass a bug in Qt 5.5.1 (QWidget embedded in a QWidgetAction does not receive mouse-over events properly). Also ensure that when resizing the menu, the grabbed side cannot go beyond the opposite side.
-rw-r--r-- | libLumina/LuminaUtils.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/libLumina/LuminaUtils.cpp b/libLumina/LuminaUtils.cpp index a4c2792e..45fcaf76 100644 --- a/libLumina/LuminaUtils.cpp +++ b/libLumina/LuminaUtils.cpp @@ -786,11 +786,13 @@ void LUtils::LoadSystemDefaults(bool skipOS){ // ======================= ResizeMenu::ResizeMenu(QWidget *parent) : QMenu(parent){ this->setContentsMargins(1,1,1,1); + this->setMouseTracking(true); resizeSide = NONE; cAct = new QWidgetAction(this); contents = 0; connect(this, SIGNAL(aboutToShow()), this, SLOT(clearFlags()) ); connect(this, SIGNAL(aboutToHide()), this, SLOT(clearFlags()) ); + connect(cAct, SIGNAL(hovered()), this, SLOT(actionHovered()) ); } ResizeMenu::~ResizeMenu(){ @@ -810,24 +812,29 @@ void ResizeMenu::mouseMoveEvent(QMouseEvent *ev){ //Note: The exact position does not matter as much as the size // since the window will be moved again the next time it is shown // The "-2" in the sizing below accounts for the menu margins + QPoint gpos = this->mapToGlobal(ev->pos()); switch(resizeSide){ case TOP: - geom.setTop(this->mapToGlobal(ev->pos()).y()); + if(gpos.y() >= geom.bottom()-1){ break; } + geom.setTop(gpos.y()); this->setGeometry(geom); if(contents!=0){ contents->setFixedSize(QSize(geom.width()-2, geom.height()-2)); } break; case BOTTOM: - geom.setBottom( this->mapToGlobal(ev->pos()).y()); + if(gpos.y() <= geom.top()+1){ break; } + geom.setBottom( gpos.y()); this->setGeometry(geom); if(contents!=0){ contents->setFixedSize(QSize(geom.width()-2, geom.height()-2)); } break; case LEFT: - geom.setLeft(this->mapToGlobal(ev->pos()).x()); + if(gpos.x() >= geom.right()-1){ break; } + geom.setLeft(gpos.x()); this->setGeometry(geom); if(contents!=0){ contents->setFixedSize(QSize(geom.width()-2, geom.height()-2)); } break; case RIGHT: - geom.setRight(this->mapToGlobal(ev->pos()).x()); + if(gpos.x() <= geom.left()+1){ break; } + geom.setRight(gpos.x()); this->setGeometry(geom); if(contents!=0){ contents->setFixedSize(QSize(geom.width()-2, geom.height()-2)); } break; |