void ExampleView::mousePressEvent(QMouseEvent* event) { startMove = imatrix.map(QPointF(event->pos())); QPointF pos(imatrix.map(QPointF(event->pos()))); foreach (Element* e, elementsAt(pos)) { if (e->type() == ElementType::NOTE) { emit noteClicked(static_cast<Note*>(e)); break; } } }
void MainWindow::createCentralWidget() { mWebView = new EnView(this); mWebView->setContextMenuPolicy(Qt::NoContextMenu); if(isFirstRun) mWebView->setHtml(defaultPage(false)); else mWebView->setHtml(defaultPage(true)); connect(mWebView, SIGNAL(noteClicked(QString)), &mEnExport, SLOT(openNote(QString))); //connect(mWebView, SIGNAL(linkClicked(QUrl)), SLOT(openUrl(QUrl))); QPalette navigationPalette; navigationPalette.setColor(QPalette::Window, QColor(mBgColor)); mToolBar = new QToolBar(this); addToolBar(Qt::TopToolBarArea, mToolBar); mToolBar->setBackgroundRole(QPalette::Window); mToolBar->setAutoFillBackground(true); mToolBar->setPalette(navigationPalette); mToolBar->setMovable(false); mToolBar->setIconSize(QSize(30, 30)); //mPageNumberLabel = new QLabel("4 / 7", this); //mPageNumberLabel->setFont(QFont("Times", 18)); QAction* settingsAction = new QAction(QIcon(":/images/gear2.png"), tr("Settings"), mToolBar); QAction* prevAction = new QAction(QIcon(":/images/prev.png"), tr("Prev"), mToolBar); QAction* nextAction = new QAction(QIcon(":/images/next.png"), tr("Next"), mToolBar); mToolBar->addAction(settingsAction); mToolBar->addAction(prevAction); mToolBar->addAction(nextAction); mNavigationLabel = new QLabel(mToolBar); mNavigationLabel->setFont(QFont("Times", 18)); mToolBar->addWidget(mNavigationLabel); connect(settingsAction, SIGNAL(triggered()), SLOT(loadDialogSettings())); //connect(settingsAction, SIGNAL(triggered()), mDialog, SLOT(show())); connect(prevAction, SIGNAL(triggered()), SLOT(prevNote())); connect(nextAction, SIGNAL(triggered()), SLOT(nextNote())); setCentralWidget(mWebView); }