view->zoomOriginal();
}
-void BufferWidget::addActionsToMenu(QMenu *menu) {
+void BufferWidget::addActionsToMenu(QMenu *menu, const QPointF &pos) {
+ Q_UNUSED(pos);
ActionCollection *coll = QtUi::actionCollection();
menu->addSeparator();
menu->addAction(coll->action("ZoomInChatView"));
menu->addAction(coll->action("ZoomOutChatView"));
menu->addAction(coll->action("ZoomOriginalChatView"));
-
}
bool BufferWidget::eventFilter(QObject *watched, QEvent *event) {
virtual bool eventFilter(QObject *watched, QEvent *event);
inline ChatViewSearchBar *searchBar() const { return ui.searchBar; }
- void addActionsToMenu(QMenu *);
+ void addActionsToMenu(QMenu *, const QPointF &pos);
protected:
virtual AbstractChatView *createChatView(BufferId);
scene()->setSenderCutoffMode(ChatScene::CutoffLeft);
}
-void ChatMonitorView::contextMenuEvent(QContextMenuEvent *event) {
- QMenu contextMenu(this);
-
- QAction *showOwnNicksAction = contextMenu.addAction(tr("Show own messages"), _filter, SLOT(setShowOwnMessages(bool)));
+void ChatMonitorView::addActionsToMenu(QMenu *menu, const QPointF &pos) {
+ ChatView::addActionsToMenu(menu, pos);
+ menu->addSeparator();
+ QAction *showOwnNicksAction = menu->addAction(tr("Show Own Messages"), _filter, SLOT(setShowOwnMessages(bool)));
showOwnNicksAction->setCheckable(true);
showOwnNicksAction->setChecked(_filter->showOwnMessages());
-
- if(scene()->columnByScenePos(event->pos()) == ChatLineModel::SenderColumn) {
- contextMenu.addSeparator();
- QAction *showNetworkAction = contextMenu.addAction(tr("Show network name"), this, SLOT(showFieldsChanged(bool)));
+ if(scene()->columnByScenePos(pos) == ChatLineModel::SenderColumn) {
+ menu->addSeparator();
+
+ QAction *showNetworkAction = menu->addAction(tr("Show Network Name"), this, SLOT(showFieldsChanged(bool)));
showNetworkAction->setCheckable(true);
showNetworkAction->setChecked(_filter->showFields() & ChatMonitorFilter::NetworkField);
showNetworkAction->setData(ChatMonitorFilter::NetworkField);
- QAction *showBufferAction = contextMenu.addAction(tr("Show buffer name"), this, SLOT(showFieldsChanged(bool)));
+ QAction *showBufferAction = menu->addAction(tr("Show Buffer Name"), this, SLOT(showFieldsChanged(bool)));
showBufferAction->setCheckable(true);
showBufferAction->setChecked(_filter->showFields() & ChatMonitorFilter::BufferField);
showBufferAction->setData(ChatMonitorFilter::BufferField);
}
-
- contextMenu.exec(QCursor::pos());
}
void ChatMonitorView::mouseDoubleClickEvent(QMouseEvent *event) {
ChatMonitorView(ChatMonitorFilter *filter, QWidget *parent);
protected:
- virtual void contextMenuEvent(QContextMenuEvent *event);
+ virtual void addActionsToMenu(QMenu *menu, const QPointF &pos);
virtual void mouseDoubleClickEvent(QMouseEvent *event);
private slots:
void showFieldsChanged(bool checked);
-
+
private:
ChatMonitorFilter *_filter;
};
QMenu menu;
// zoom actions and similar
- chatView()->addActionsToMenu(&menu);
+ chatView()->addActionsToMenu(&menu, pos);
+ menu.addSeparator();
if(isPosOverSelection(pos))
menu.addAction(SmallIcon("edit-copy"), tr("Copy Selection"),
ChatView::ChatView(MessageFilter *filter, QWidget *parent)
: QGraphicsView(parent),
AbstractChatView(),
+ _bufferContainer(0),
_currentScaleFactor(1)
{
init(filter);
return model->data(model->index(model->rowCount() - 1, 0), MessageModel::MsgIdRole).value<MsgId>();
}
-void ChatView::addActionsToMenu(QMenu *menu) {
+void ChatView::addActionsToMenu(QMenu *menu, const QPointF &pos) {
// zoom actions
BufferWidget *bw = qobject_cast<BufferWidget *>(bufferContainer());
if(bw) {
- bw->addActionsToMenu(menu);
+ bw->addActionsToMenu(menu, pos);
menu->addSeparator();
}
}
inline ChatScene *scene() const { return _scene; }
- void addActionsToMenu(QMenu *);
+ virtual void addActionsToMenu(QMenu *, const QPointF &pos);
public slots:
inline virtual void clear() {}