]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt/IconPalette.cpp
Fix readability
[lyx.git] / src / frontends / qt / IconPalette.cpp
index 325a96e881fb9bac92f2c48c7136312770680d5b..7a5b1f33331e26e064f040ebc7bf3b9f12f67c9b 100644 (file)
 #include <QToolTip>
 #include <QToolBar>
 #include <QApplication>
-#include <QDesktopWidget>
 #include <QPainter>
+#include <QScreen>
 #include <QStyle>
 #include <QStyleOptionFrame>
 #include <QMouseEvent>
 #include <QVBoxLayout>
+#include <QWindow>
 
 namespace lyx {
 namespace frontend {
@@ -49,7 +50,11 @@ void TearOff::mouseReleaseEvent(QMouseEvent * /*event*/)
 }
 
 
+#if QT_VERSION < 0x060000
 void TearOff::enterEvent(QEvent * event)
+#else
+void TearOff::enterEvent(QEnterEvent * event)
+#endif
 {
        highlighted_ = true;
        update();
@@ -76,7 +81,9 @@ void TearOff::paintEvent(QPaintEvent * /*event*/)
        menuOpt.checkType = QStyleOptionMenuItem::NotCheckable;
        menuOpt.menuRect = rect();
        menuOpt.maxIconWidth = 0;
+#if QT_VERSION < 0x060000
        menuOpt.tabWidth = 0;
+#endif
        menuOpt.menuItemType = QStyleOptionMenuItem::TearOff;
        menuOpt.rect.setRect(fw, fw, width() - (fw * 2),
                style()->pixelMetric(QStyle::PM_MenuTearoffHeight, 0, this));
@@ -92,12 +99,16 @@ IconPalette::IconPalette(QWidget * parent)
        : QWidget(parent, Qt::Popup), tornoff_(false)
 {
        QVBoxLayout * v = new QVBoxLayout(this);
-       v->setMargin(0);
+       v->setContentsMargins(0, 0, 0, 0);
        v->setSpacing(0);
        layout_ = new QGridLayout;
        layout_->setSpacing(0);
+#if QT_VERSION < 0x060000
        const int fw = style()->pixelMetric(QStyle::PM_MenuPanelWidth, 0, this);
        layout_->setMargin(fw);
+#else
+       layout_->setContentsMargins(0, 0, 0, 0);
+#endif
        tearoffwidget_ = new TearOff(this);
        connect(tearoffwidget_, SIGNAL(tearOff()), this, SLOT(tearOff()));
        v->addWidget(tearoffwidget_);
@@ -166,7 +177,7 @@ void IconPalette::showEvent(QShowEvent * /*event*/)
                voffset -= parheight;
        }
 
-       QRect const screen = qApp->desktop()->availableGeometry(this);
+       QRect const screen = window()->windowHandle()->screen()->availableGeometry();
        QPoint const gpos = parentWidget()->mapToGlobal(
                parentWidget()->geometry().bottomLeft());