aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core
diff options
context:
space:
mode:
authorKen Moore <ken@ixsystems.com>2017-11-14 14:17:27 -0500
committerKen Moore <ken@ixsystems.com>2017-11-14 14:17:27 -0500
commit79df03631348f217c5739fc097c3b7ee53df499c (patch)
treec9bf851a5fd2a466cd3b7a92f81b82d424b603db /src-qt5/core
parentFinish up a bit more cleanup of keyboard events in lumina-pdf (diff)
downloadlumina-79df03631348f217c5739fc097c3b7ee53df499c.tar.gz
lumina-79df03631348f217c5739fc097c3b7ee53df499c.tar.bz2
lumina-79df03631348f217c5739fc097c3b7ee53df499c.zip
Fix up some initial startmenu sizing.
Diffstat (limited to 'src-qt5/core')
-rw-r--r--src-qt5/core/libLumina/ResizeMenu.cpp18
-rw-r--r--src-qt5/core/libLumina/ResizeMenu.h5
-rw-r--r--src-qt5/core/lumina-desktop/panel-plugins/systemstart/LStartButton.cpp6
-rw-r--r--src-qt5/core/lumina-desktop/panel-plugins/systemstart/StartMenu.cpp2
4 files changed, 21 insertions, 10 deletions
diff --git a/src-qt5/core/libLumina/ResizeMenu.cpp b/src-qt5/core/libLumina/ResizeMenu.cpp
index 9f291134..cf5b124d 100644
--- a/src-qt5/core/libLumina/ResizeMenu.cpp
+++ b/src-qt5/core/libLumina/ResizeMenu.cpp
@@ -5,6 +5,7 @@
// See the LICENSE file for full details
//===========================================
#include "ResizeMenu.h"
+#include <QDebug>
// =======================
// RESIZEMENU CLASS
@@ -21,7 +22,7 @@ ResizeMenu::ResizeMenu(QWidget *parent) : QMenu(parent){
}
ResizeMenu::~ResizeMenu(){
-
+
}
void ResizeMenu::setContents(QWidget *con){
@@ -30,6 +31,15 @@ void ResizeMenu::setContents(QWidget *con){
this->addAction(cAct);
contents = con; //save for later
contents->setCursor(Qt::ArrowCursor);
+ resyncSize();
+}
+
+void ResizeMenu::resyncSize(){
+ if(contents==0){ return; }
+ qDebug() << "Resync Size:" << this->size() << contents->size();
+ this->resize(contents->size());
+ qDebug() << " - after menu resize:" << this->size() << contents->size();
+ emit MenuResized(this->size());
}
void ResizeMenu::mouseMoveEvent(QMouseEvent *ev){
@@ -46,21 +56,21 @@ void ResizeMenu::mouseMoveEvent(QMouseEvent *ev){
this->setGeometry(geom);
if(contents!=0){ contents->setFixedSize(QSize(geom.width()-2, geom.height()-2));}
handled = true;
- break;
+ break;
case BOTTOM:
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));}
handled = true;
- break;
+ break;
case LEFT:
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));}
handled = true;
- break;
+ break;
case RIGHT:
if(gpos.x() <= geom.left()+1){ break; }
geom.setRight(gpos.x());
diff --git a/src-qt5/core/libLumina/ResizeMenu.h b/src-qt5/core/libLumina/ResizeMenu.h
index ed909da3..029d2716 100644
--- a/src-qt5/core/libLumina/ResizeMenu.h
+++ b/src-qt5/core/libLumina/ResizeMenu.h
@@ -17,7 +17,7 @@
#include <QPoint>
//Special subclass for a menu which the user can grab the edges and resize as necessary
-// Note: Make sure that you don't set 0pixel contents margins on this menu
+// Note: Make sure that you don't set 0pixel contents margins on this menu
// - it needs at least 1 pixel margins for the user to be able to grab it
class ResizeMenu : public QMenu{
Q_OBJECT
@@ -26,13 +26,14 @@ public:
virtual ~ResizeMenu();
void setContents(QWidget *con);
+ void resyncSize();
private:
enum SideFlag{NONE, TOP, BOTTOM, LEFT, RIGHT};
SideFlag resizeSide;
QWidget *contents;
QWidgetAction *cAct;
-
+
private slots:
void clearFlags(){
resizeSide=NONE;
diff --git a/src-qt5/core/lumina-desktop/panel-plugins/systemstart/LStartButton.cpp b/src-qt5/core/lumina-desktop/panel-plugins/systemstart/LStartButton.cpp
index 30e82c47..562122ae 100644
--- a/src-qt5/core/lumina-desktop/panel-plugins/systemstart/LStartButton.cpp
+++ b/src-qt5/core/lumina-desktop/panel-plugins/systemstart/LStartButton.cpp
@@ -25,10 +25,10 @@ LStartButtonPlugin::LStartButtonPlugin(QWidget *parent, QString id, bool horizon
startmenu = new StartMenu(this);
connect(startmenu, SIGNAL(CloseMenu()), this, SLOT(closeMenu()) );
connect(startmenu, SIGNAL(UpdateQuickLaunch(QStringList)), this, SLOT(updateQuickLaunch(QStringList)));
- menu->setContents(startmenu);
- QRect screenSize = QApplication::desktop()->availableGeometry(this);
- QSize saved = LSession::handle()->DesktopPluginSettings()->value("panelPlugs/"+this->type()+"/MenuSize", QSize(screenSize.width() * 0.2, screenSize.height())).toSize();
+ //QRect screenSize = QApplication::desktop()->availableGeometry(this);
+ QSize saved = LSession::handle()->DesktopPluginSettings()->value("panelPlugs/"+this->type()+"/MenuSize", QSize(0, 0)).toSize();
if(!saved.isNull()){ startmenu->setFixedSize(saved); } //re-load the previously saved value
+ menu->setContents(startmenu);
button->setMenu(menu);
connect(menu, SIGNAL(aboutToHide()), this, SLOT(updateButtonVisuals()) );
diff --git a/src-qt5/core/lumina-desktop/panel-plugins/systemstart/StartMenu.cpp b/src-qt5/core/lumina-desktop/panel-plugins/systemstart/StartMenu.cpp
index c99e2b4b..beaa5d92 100644
--- a/src-qt5/core/lumina-desktop/panel-plugins/systemstart/StartMenu.cpp
+++ b/src-qt5/core/lumina-desktop/panel-plugins/systemstart/StartMenu.cpp
@@ -63,7 +63,7 @@ void StartMenu::UpdateAll(){
ui->tool_restart->setIcon(LXDG::findIcon("system-reboot",""));
ui->tool_shutdown->setIcon(LXDG::findIcon("system-shutdown",""));
ui->tool_suspend->setIcon(LXDG::findIcon("system-suspend",""));
-
+
//Update Visibility of system/session/OS options
// -- Control Panel
QString tmp = LOS::ControlPanelShortcut();
bgstack15