Commit b32a729d authored by Denis Khachko's avatar Denis Khachko

Merge branch 'master' of gitorious.org:kumir2/kumir2

parents 66adeba0 44711b89
......@@ -31,25 +31,25 @@ protected:
catched = true;
}
}
if (QEvent::ContextMenu == event->type()) {
QContextMenuEvent * e =
static_cast<QContextMenuEvent*>(event);
if (contextMenuWidget_ && e) {
const QPoint position = e->globalPos();
QRect contextRect(position, contextMenuWidget_->size());
QDesktopWidget* screen = qApp->desktop();
const QRect screenRect = screen->availableGeometry(this);
if (contextRect.right() > screenRect.right()) {
contextRect.moveRight(screenRect.right());
}
if (contextRect.left() < screenRect.left()) {
contextRect.moveLeft(screenRect.left());
}
contextMenuWidget_->move(contextRect.topLeft());
contextMenuWidget_->show();
catched = true;
}
}
// if (QEvent::ContextMenu == event->type()) {
// QContextMenuEvent * e =
// static_cast<QContextMenuEvent*>(event);
// if (contextMenuWidget_ && e) {
// const QPoint position = e->globalPos();
// QRect contextRect(position, contextMenuWidget_->size());
// QDesktopWidget* screen = qApp->desktop();
// const QRect screenRect = screen->availableGeometry(this);
// if (contextRect.right() > screenRect.right()) {
// contextRect.moveRight(screenRect.right());
// }
// if (contextRect.left() < screenRect.left()) {
// contextRect.moveLeft(screenRect.left());
// }
// contextMenuWidget_->move(contextRect.topLeft());
// contextMenuWidget_->show();
// catched = true;
// }
// }
if (catched)
return false;
......
......@@ -181,23 +181,23 @@ void TabWidgetElement::updateSettingsObject(SettingsPtr settings)
bool TabWidgetElement::eventFilter(QObject *obj, QEvent *evt)
{
if (QEvent::ContextMenu==evt->type()) {
QContextMenuEvent * event = static_cast<QContextMenuEvent*>(evt);
const QPoint position = event->globalPos();
QRect contextRect(position, toolbarContextMenu_->size());
QDesktopWidget* screen = qApp->desktop();
const QRect screenRect = screen->availableGeometry(this);
if (contextRect.right() > screenRect.right()) {
contextRect.moveRight(screenRect.right());
}
if (contextRect.left() < screenRect.left()) {
contextRect.moveLeft(screenRect.left());
}
// if (QEvent::ContextMenu==evt->type()) {
// QContextMenuEvent * event = static_cast<QContextMenuEvent*>(evt);
// const QPoint position = event->globalPos();
// QRect contextRect(position, toolbarContextMenu_->size());
// QDesktopWidget* screen = qApp->desktop();
// const QRect screenRect = screen->availableGeometry(this);
// if (contextRect.right() > screenRect.right()) {
// contextRect.moveRight(screenRect.right());
// }
// if (contextRect.left() < screenRect.left()) {
// contextRect.moveLeft(screenRect.left());
// }
toolbarContextMenu_->move(contextRect.topLeft());
toolbarContextMenu_->show();
return true;
}
// toolbarContextMenu_->move(contextRect.topLeft());
// toolbarContextMenu_->show();
// return true;
// }
return false;
}
......
......@@ -345,4 +345,9 @@ void ToolbarContextMenu::showMe()
}
void ToolbarContextMenu::showEvent(QShowEvent *event)
{
QWidget::showEvent(event);
}
} // namespace CoreGUI
......@@ -41,6 +41,7 @@ protected Q_SLOTS:
void showMe();
protected:
void showEvent(QShowEvent * event);
void paintEvent(QPaintEvent *event);
QList<QAction*> items_;
QSet<QString> forcedItemNames_;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment