#include "frontends/WorkAreaManager.h"
#include <QContextMenuEvent>
+#if (QT_VERSION < 0x050000)
#include <QInputContext>
+#endif
+#include <QDrag>
#include <QHelpEvent>
#ifdef Q_WS_MACX
#include <QMacStyle>
#endif
#include <QMainWindow>
+#include <QMimeData>
#include <QMenu>
#include <QPainter>
#include <QPalette>
#include <QPixmapCache>
#include <QScrollBar>
+#include <QStyleOption>
+#include <QStylePainter>
#include <QTimer>
#include <QToolButton>
#include <QToolTip>
}
// Show the cursor immediately after any operation.
startBlinkingCursor();
+#ifdef Q_WS_X11
QApplication::syncX();
+#endif
}
return;
}
+#if (QT_VERSION < 0x050000)
inputContext()->reset();
+#endif
FuncRequest const cmd(LFUN_MOUSE_PRESS, e->x(), e->y(),
q_button_state(e->button()));
d->buffer_view_->scroll(up ? -step : step);
d->buffer_view_->updateMetrics();
} else {
- d->buffer_view_->scrollDocView(value + up ? -step : step, false);
+ d->buffer_view_->scrollDocView(value + (up ? -step : step), false);
}
// In which paragraph do we have to set the cursor ?
#ifdef Q_WS_MACX
setStyle(&noTabFrameMacStyle);
#endif
-#if QT_VERSION < 0x040500
- lyxrc.single_close_tab_button = true;
-#endif
QPalette pal = palette();
pal.setColor(QPalette::Active, QPalette::Button,
tb->setContextMenuPolicy(Qt::CustomContextMenu);
connect(tb, SIGNAL(customContextMenuRequested(const QPoint &)),
this, SLOT(showContextMenu(const QPoint &)));
-#if QT_VERSION >= 0x040500
connect(tb, SIGNAL(tabCloseRequested(int)),
this, SLOT(closeTab(int)));
-#endif
setUsesScrollButtons(true);
}
// painting of the frame of the tab widget.
// This is needed for gtk style in Qt.
QStylePainter p(this);
+#if QT_VERSION < 0x050000
QStyleOptionTabWidgetFrameV2 opt;
+#else
+ QStyleOptionTabWidgetFrame opt;
+#endif
initStyleOption(&opt);
opt.rect = style()->subElementRect(QStyle::SE_TabWidgetTabPane,
&opt, this);
tabBar()->setEnabled(show);
tabBar()->setVisible(show);
closeBufferButton->setVisible(show && lyxrc.single_close_tab_button);
-#if QT_VERSION >= 0x040500
setTabsClosable(!lyxrc.single_close_tab_button);
-#endif
}
return 0;
GuiWorkArea * wa = dynamic_cast<GuiWorkArea *>(currentWidget());
- LASSERT(wa, /**/);
+ LATTEST(wa);
return wa;
}
{
while (count()) {
GuiWorkArea * wa = workArea(0);
- LASSERT(wa, /**/);
+ LASSERT(wa, return);
removeTab(0);
delete wa;
}
bool TabWorkArea::setCurrentWorkArea(GuiWorkArea * work_area)
{
- LASSERT(work_area, /**/);
+ LASSERT(work_area, return false);
int index = indexOf(work_area);
if (index == -1)
return false;
wa = currentWorkArea();
else {
wa = workArea(clicked_tab_);
- LASSERT(wa, /**/);
+ LASSERT(wa, return);
}
wa->view().closeWorkArea(wa);
}
wa = currentWorkArea();
else {
wa = workArea(clicked_tab_);
- LASSERT(wa, /**/);
+ LASSERT(wa, return);
}
wa->view().hideWorkArea(wa);
}
wa = currentWorkArea();
else {
wa = workArea(index);
- LASSERT(wa, /**/);
+ LASSERT(wa, return);
}
wa->view().closeWorkArea(wa);
}
: QTabBar(parent)
{
setAcceptDrops(true);
-#if QT_VERSION >= 0x040500
setTabsClosable(!lyxrc.single_close_tab_button);
-#endif
-}
-
-
-#if QT_VERSION < 0x040300
-int DragTabBar::tabAt(QPoint const & position) const
-{
- const int max = count();
- for (int i = 0; i < max; ++i) {
- if (tabRect(i).contains(position))
- return i;
- }
- return -1;
}
-#endif
void DragTabBar::mousePressEvent(QMouseEvent * event)
mimeData->setData("action", "tab-reordering") ;
drag->setMimeData(mimeData);
-#if QT_VERSION >= 0x040300
// get tab pixmap as cursor
QRect r = tabRect(tab);
QPixmap pixmap(r.size());
render(&pixmap, - r.topLeft());
drag->setPixmap(pixmap);
drag->exec();
-#else
- drag->start(Qt::MoveAction);
-#endif
-
}