From 8ddcc01712b0971c6a5714fa59ff3c7c6ad4c51f Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 23 Oct 2009 12:12:51 +0200 Subject: What's overkilling? checking EVERYTIME mouse move events to just fix some stupid cases? revert a good implementation just to bug fixing the 0.1% of the cases? Don't know! This implementation seems working to fix the flickering links But, these are really the UI problems I'd like to get rid... --- src/mainwindow.cpp | 42 ++++++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 12 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 6ec6a3a6..787ecdce 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -101,6 +101,7 @@ MainWindow::MainWindow() , m_mainBar( new KToolBar( QString("MainToolBar"), this, Qt::TopToolBarArea, true, false, false) ) , m_bmBar( new KToolBar( QString("BookmarkToolBar"), this, Qt::TopToolBarArea, true, false, false) ) , m_ac( new KActionCollection(this) ) + , m_flickeringZone(false) { // enable window size "auto-save" setAutoSaveSettings(); @@ -959,31 +960,42 @@ void MainWindow::notifyMessage(const QString &msg, Rekonq::Notify status) break; } + // useful values + int windowWidth = width(); + int pageHeight = m_view->currentWebView()->page()->viewportSize().height(); + int labelHeight = KGlobalSettings::generalFont().pointSize()*2 + 7; + bool scrollbarIsVisible = m_view->currentWebView()->page()->currentFrame()->scrollBarMaximum(Qt::Horizontal); + int scrollbarSize = 0; + if (scrollbarIsVisible) + { + //TODO: detect QStyle size + scrollbarSize = 17; + } + + // setting the popup m_popup->setFrameShape(QFrame::NoFrame); QLabel *label = new QLabel(msg); - label->setMaximumWidth(width()-8); m_popup->setLineWidth(0); m_popup->setView(label); - m_popup->setFixedSize(0, 0); + m_popup->setFixedSize(windowWidth/3, labelHeight); m_popup->layout()->setAlignment(Qt::AlignTop); m_popup->layout()->setMargin(4); - // setting popus in bottom-left position - int pageHeight = m_view->currentWebView()->page()->viewportSize().height(); - int labelHeight = KGlobalSettings::generalFont().pointSize()*2 + 7; - bool scrollbarIsVisible = m_view->currentWebView()->page()->currentFrame()->scrollBarMaximum(Qt::Horizontal); - int scrollbarSize = 0; - if (scrollbarIsVisible) scrollbarSize = 17; //TODO: detect QStyle size - + // setting popus in bottom-(left/right) position int x = geometry().x(); - int y = m_view->currentWebView()->mapToGlobal(QPoint(0,pageHeight)).y() - labelHeight -scrollbarSize; + if(m_flickeringZone) + { + x = width() - m_popup->width(); + label->setAlignment(Qt::AlignRight); + } + + int y = m_view->currentWebView()->mapToGlobal(QPoint(0,pageHeight)).y() - labelHeight - scrollbarSize; QPoint p(x,y); m_popup->show(p); if(popup_sav) delete popup_sav; - } @@ -1107,4 +1119,10 @@ bool MainWindow::homePage(const KUrl &url) return true; } return false; -} \ No newline at end of file +} + + +void MainWindow::setFlickeringZone(bool b) +{ + m_flickeringZone = b; +} -- cgit v1.2.1