Skip to content

Commit

Permalink
theme tweaks
Browse files Browse the repository at this point in the history
fix contextmenu appearing off-screen #220
  • Loading branch information
easymodo committed May 18, 2020
1 parent 13abbbe commit ff1dfe9
Show file tree
Hide file tree
Showing 11 changed files with 1,125 additions and 1,057 deletions.
10 changes: 10 additions & 0 deletions qimgv/gui/contextmenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,16 @@ void ContextMenu::showAt(QPoint pos) {
show();
}

void ContextMenu::setGeometry(QRect geom) {
auto screen = QGuiApplication::primaryScreen();
// fit inside the current screen
if(geom.bottom() > screen->geometry().bottom())
geom.moveBottom(screen->geometry().bottom());
if(geom.right() > screen->geometry().right())
geom.moveRight(screen->geometry().right());
QWidget::setGeometry(geom);
}

void ContextMenu::mousePressEvent(QMouseEvent *event) {
QWidget::mousePressEvent(event);
hide();
Expand Down
3 changes: 3 additions & 0 deletions qimgv/gui/contextmenu.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once

#include <QScreen>
#include <QStyleOption>
#include <QTimer>
#include <QPainter>
Expand All @@ -18,6 +19,8 @@ class ContextMenu : public QWidget {

public slots:
void showAt(QPoint pos);
void setGeometry(QRect geom);

private:
Ui::ContextMenu *ui;
QTimer mTimer;
Expand Down
2 changes: 1 addition & 1 deletion qimgv/gui/customwidgets/thumbnailwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ ThumbnailWidget::ThumbnailWidget(QGraphicsItem *parent) :

void ThumbnailWidget::readSettings() {
nameColor = settings->colorScheme().text;
highlightColor = settings->colorScheme().accent;
highlightColor = settings->colorScheme().accent_light;
}

void ThumbnailWidget::setThumbnailSize(int size) {
Expand Down
1 change: 1 addition & 0 deletions qimgv/gui/dialogs/settingsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ SettingsDialog::SettingsDialog(QWidget *parent) :
#endif

setupSidebar();
ui->sideBar->setCurrentRow(0);

connect(this, &SettingsDialog::settingsChanged, settings, &Settings::sendChangeNotification);
readSettings();
Expand Down
Loading

0 comments on commit ff1dfe9

Please sign in to comment.