#include "LayoutBox.h"
#include "LyX.h"
#include "LyXRC.h"
+#include "Menus.h"
#include "qt_helpers.h"
#include "Session.h"
#include "Text.h"
setIconSize(owner.iconSize());
connect(&owner, SIGNAL(iconSizeChanged(QSize)), this,
SLOT(setIconSize(QSize)));
+ setContextMenuPolicy(Qt::CustomContextMenu);
+ connect(this, SIGNAL(customContextMenuRequested(QPoint)),
+ SLOT(showContextMenu(QPoint)));
// This is used by QMainWindow::restoreState for proper main window state
// restoration.
}
+void GuiToolbar::showContextMenu(QPoint pos)
+{
+ QMenu * menu = guiApp->menus().menu(toqstr("context-toolbars"), owner_);
+ menu->exec(mapToGlobal(pos));
+}
+
+
Action * GuiToolbar::addItem(ToolbarItem const & item, bool menu)
{
QString text = toqstr(item.label);
connect(this, SIGNAL(triggerShowDialog(QString const &, QString const &, Inset *)),
SLOT(doShowDialog(QString const &, QString const &, Inset *)));
- // set custom application bars context menu, e.g. tool bar and menu bar
- setContextMenuPolicy(Qt::CustomContextMenu);
- connect(this, SIGNAL(customContextMenuRequested(const QPoint &)),
- SLOT(toolBarPopup(const QPoint &)));
-
// Forbid too small unresizable window because it can happen
// with some window manager under X11.
setMinimumSize(300, 200);
}
-void GuiView::toolBarPopup(const QPoint & /*pos*/)
-{
- QMenu * menu = guiApp->menus().menu(toqstr("context-toolbars"), * this);
- menu->exec(QCursor::pos());
-}
-
-
template<class T>
Buffer::ExportStatus GuiView::GuiViewPrivate::runAndDestroy(const T& func,
Buffer const * orig, Buffer * clone, string const & format)
void updateStatusBarMessage(QString const & str);
void clearMessageText();
- ///
- void toolBarPopup(const QPoint &pos);
-
private:
/// Open given child document in current buffer directory.
void openChildDocument(std::string const & filename);