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: ...@@ -31,25 +31,25 @@ protected:
catched = true; catched = true;
} }
} }
if (QEvent::ContextMenu == event->type()) { // if (QEvent::ContextMenu == event->type()) {
QContextMenuEvent * e = // QContextMenuEvent * e =
static_cast<QContextMenuEvent*>(event); // static_cast<QContextMenuEvent*>(event);
if (contextMenuWidget_ && e) { // if (contextMenuWidget_ && e) {
const QPoint position = e->globalPos(); // const QPoint position = e->globalPos();
QRect contextRect(position, contextMenuWidget_->size()); // QRect contextRect(position, contextMenuWidget_->size());
QDesktopWidget* screen = qApp->desktop(); // QDesktopWidget* screen = qApp->desktop();
const QRect screenRect = screen->availableGeometry(this); // const QRect screenRect = screen->availableGeometry(this);
if (contextRect.right() > screenRect.right()) { // if (contextRect.right() > screenRect.right()) {
contextRect.moveRight(screenRect.right()); // contextRect.moveRight(screenRect.right());
} // }
if (contextRect.left() < screenRect.left()) { // if (contextRect.left() < screenRect.left()) {
contextRect.moveLeft(screenRect.left()); // contextRect.moveLeft(screenRect.left());
} // }
contextMenuWidget_->move(contextRect.topLeft()); // contextMenuWidget_->move(contextRect.topLeft());
contextMenuWidget_->show(); // contextMenuWidget_->show();
catched = true; // catched = true;
} // }
} // }
if (catched) if (catched)
return false; return false;
......
...@@ -181,23 +181,23 @@ void TabWidgetElement::updateSettingsObject(SettingsPtr settings) ...@@ -181,23 +181,23 @@ void TabWidgetElement::updateSettingsObject(SettingsPtr settings)
bool TabWidgetElement::eventFilter(QObject *obj, QEvent *evt) bool TabWidgetElement::eventFilter(QObject *obj, QEvent *evt)
{ {
if (QEvent::ContextMenu==evt->type()) { // if (QEvent::ContextMenu==evt->type()) {
QContextMenuEvent * event = static_cast<QContextMenuEvent*>(evt); // QContextMenuEvent * event = static_cast<QContextMenuEvent*>(evt);
const QPoint position = event->globalPos(); // const QPoint position = event->globalPos();
QRect contextRect(position, toolbarContextMenu_->size()); // QRect contextRect(position, toolbarContextMenu_->size());
QDesktopWidget* screen = qApp->desktop(); // QDesktopWidget* screen = qApp->desktop();
const QRect screenRect = screen->availableGeometry(this); // const QRect screenRect = screen->availableGeometry(this);
if (contextRect.right() > screenRect.right()) { // if (contextRect.right() > screenRect.right()) {
contextRect.moveRight(screenRect.right()); // contextRect.moveRight(screenRect.right());
} // }
if (contextRect.left() < screenRect.left()) { // if (contextRect.left() < screenRect.left()) {
contextRect.moveLeft(screenRect.left()); // contextRect.moveLeft(screenRect.left());
} // }
toolbarContextMenu_->move(contextRect.topLeft()); // toolbarContextMenu_->move(contextRect.topLeft());
toolbarContextMenu_->show(); // toolbarContextMenu_->show();
return true; // return true;
} // }
return false; return false;
} }
......
...@@ -345,4 +345,9 @@ void ToolbarContextMenu::showMe() ...@@ -345,4 +345,9 @@ void ToolbarContextMenu::showMe()
} }
void ToolbarContextMenu::showEvent(QShowEvent *event)
{
QWidget::showEvent(event);
}
} // namespace CoreGUI } // namespace CoreGUI
...@@ -41,6 +41,7 @@ protected Q_SLOTS: ...@@ -41,6 +41,7 @@ protected Q_SLOTS:
void showMe(); void showMe();
protected: protected:
void showEvent(QShowEvent * event);
void paintEvent(QPaintEvent *event); void paintEvent(QPaintEvent *event);
QList<QAction*> items_; QList<QAction*> items_;
QSet<QString> forcedItemNames_; 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