Author: mir3x
Date: Mon Jan 16 13:57:22 2017
New Revision: 34845
URL: http://svn.gna.org/viewcvs/freeciv?rev=34845&view=rev
Log:
Qt client - fix position of tax rates dialog
See bug #25427
Modified:
branches/S3_0/client/gui-qt/ratesdlg.cpp
Modified: branches/S3_0/client/gui-qt/ratesdlg.cpp
URL:
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/client/gui-qt/ratesdlg.cpp?rev=34845&r1=34844&r2=34845&view=diff
==============================================================================
--- branches/S3_0/client/gui-qt/ratesdlg.cpp (original)
+++ branches/S3_0/client/gui-qt/ratesdlg.cpp Mon Jan 16 13:57:22 2017
@@ -16,6 +16,8 @@
#endif
// Qt
+#include <QApplication>
+#include <QDesktopWidget>
#include <QMouseEvent>
#include <QPainter>
@@ -229,12 +231,23 @@
void popup_rates_dialog(void)
{
QPoint p;
+ QRect rect;
p = QCursor::pos();
+ rect = QApplication::desktop()->availableGeometry();
tax_rates_dialog *trd = new tax_rates_dialog(gui()->central_wdg);
+ p.setY(p.y() - trd->height() / 2);
+ if (p.y() < 50) {
+ p.setY(50);
+ }
+ if (p.y() + trd->height() > rect.bottom()) {
+ p.setY(rect.bottom() - trd->height());
+ }
+ if (p.x() + trd->width() > rect.right()) {
+ p.setX(rect.right() - trd->width());
+ }
+ trd->move(p);
trd->show();
- p.setX(p.x() - trd->width() /2);
- trd->move(p);
}
/**************************************************************************
_______________________________________________
Freeciv-commits mailing list
[email protected]
https://mail.gna.org/listinfo/freeciv-commits