PanelTreeView::PanelTreeView(QWidget *parent) : QTreeView(parent) { connect(this, SIGNAL(itemHovered(QString)), parent, SIGNAL(itemHovered(QString))); connect(this, SIGNAL(openUrl(KUrl,Rekonq::OpenType)), parent, SIGNAL(openUrl(KUrl,Rekonq::OpenType))); setMouseTracking(true); setExpandsOnDoubleClick(false); }
void PanelTreeView::mouseMoveEvent(QMouseEvent *event) { QTreeView::mouseMoveEvent(event); const QModelIndex index = indexAt(event->pos()); if (!index.isValid()) { emit itemHovered(""); return; } emit itemHovered(qVariantValue< KUrl >(index.data(Qt::UserRole)).url()); }
void ColorMenu::populateList() { QStringList list = QColor::colorNames(); for (int i=0; i<list.size(); i++) { QPixmap pix(QSize(22,22)); pix.fill(QColor(list[i])); QAction *newAction = new QAction(QIcon(pix), "", parent); newAction->setToolTip(list[i]); newAction->setText(list[i]); menu.addAction(newAction); connect(newAction, SIGNAL(hovered()), this, SLOT(itemHovered())); } }
void MainWindow::setupPanels() { kDebug() << "setup panels..."; KAction* a; // STEP 1 // Setup history panel m_historyPanel = new HistoryPanel(i18n("History Panel"), this); connect(m_historyPanel, SIGNAL(openUrl(const KUrl&, const Rekonq::OpenType &)), Application::instance(), SLOT(loadUrl(const KUrl&, const Rekonq::OpenType &))); connect(m_historyPanel, SIGNAL(itemHovered(QString)), this, SLOT(notifyMessage(QString))); connect(m_historyPanel, SIGNAL(destroyed()), Application::instance(), SLOT(saveConfiguration())); addDockWidget(Qt::LeftDockWidgetArea, m_historyPanel); // setup history panel action a = (KAction *) m_historyPanel->toggleViewAction(); a->setShortcut(KShortcut(Qt::CTRL + Qt::Key_H)); a->setIcon(KIcon("view-history")); actionCollection()->addAction(QL1S("show_history_panel"), a); // STEP 2 // Setup bookmarks panel m_bookmarksPanel = new BookmarksPanel(i18n("Bookmarks Panel"), this); connect(m_bookmarksPanel, SIGNAL(openUrl(const KUrl&, const Rekonq::OpenType &)), Application::instance(), SLOT(loadUrl(const KUrl&, const Rekonq::OpenType &))); connect(m_bookmarksPanel, SIGNAL(itemHovered(QString)), this, SLOT(notifyMessage(QString))); connect(m_bookmarksPanel, SIGNAL(destroyed()), Application::instance(), SLOT(saveConfiguration())); addDockWidget(Qt::LeftDockWidgetArea, m_bookmarksPanel); Application::bookmarkProvider()->registerBookmarkPanel(m_bookmarksPanel); // setup bookmarks panel action a = (KAction *) m_bookmarksPanel->toggleViewAction(); a->setShortcut(KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_B)); a->setIcon(KIcon("bookmarks-organize")); actionCollection()->addAction(QL1S("show_bookmarks_panel"), a); // STEP 3 // Setup webinspector panel m_webInspectorPanel = new WebInspectorPanel(i18n("Web Inspector"), this); connect(mainView(), SIGNAL(currentChanged(int)), m_webInspectorPanel, SLOT(changeCurrentPage())); a = new KAction(KIcon("tools-report-bug"), i18n("Web &Inspector"), this); a->setCheckable(true); actionCollection()->addAction(QL1S("web_inspector"), a); connect(a, SIGNAL(triggered(bool)), m_webInspectorPanel, SLOT(toggle(bool))); addDockWidget(Qt::BottomDockWidgetArea, m_webInspectorPanel); m_webInspectorPanel->hide(); // STEP 4 // Setup Network analyzer panel m_analyzerPanel = new NetworkAnalyzerPanel( i18n("Network Analyzer"), this); connect(mainView(), SIGNAL(currentChanged(int)), m_analyzerPanel, SLOT(changeCurrentPage())); a = new KAction(KIcon("document-edit-decrypt-verify"), i18n("Network Analyzer"), this); a->setCheckable(true); actionCollection()->addAction(QL1S("net_analyzer"), a); connect(a, SIGNAL(triggered(bool)), this, SLOT(enableNetworkAnalysis(bool))); addDockWidget(Qt::BottomDockWidgetArea, m_analyzerPanel); m_analyzerPanel->hide(); }