On 07/23/2012 11:35 PM, Thomas Lübking wrote: > Am 23.07.2012, 22:12 Uhr, schrieb Jan Kundrát <[email protected]>: > >> Hi Thomas/Thomas, >> there's a bug in how the header view works > > Is there a particular reason why you put the SimplePartWidget (being > an EmbeddedWebView being a QWbview, providing nice scrolling > facilities) into an extra scrollarea? > Ie. do you intend to have some more complex layout (like for the > MessageView) here afterwards? > > Otherwise you could just use the SimplePartWidget to replace > "QScrollArea *area" - should work out of the box (but you'll have to > re-enable scrollbars in general and doubt after > "handlePageLoadFinished") - see attachment. > > If you require/intend more complex layouts > >> (right-click on any message in the MsgListView and select "View >> Message Headers.." > Ahhh - there it is ;-) > > > Regards, > Thomas > > PS: i spent most of yesterday playing with git rebase after i figured > (should have read /that/ sources *before*) that the stupid QCompleter > uses a stupid SearchFilterProxyModel and cannot thus not search as we > want, so yesterday evening i was basically where i started Saturday > noon :-( > > Then i figured what problems you had (found) with (in) QFormLayout > (thus deconstructed it) - there's no ::removeRow() so if one wants to > insert, things get complex ;-) > > No, did not spend all time on coding on trojitá - sorry ;-P Took the liberty to make the patch work with current master since there were quite some changes and it wouldn't apply.
Cheers, Thomas
>From 2b7c47320f1508eb259ca108c3e3d7139f400c37 Mon Sep 17 00:00:00 2001 From: Thomas Gahr <[email protected]> Date: Tue, 24 Jul 2012 00:16:18 +0200 Subject: [PATCH] header-scrollers --- src/Gui/EmbeddedWebView.cpp | 12 +++++++++--- src/Gui/Window.cpp | 12 +++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Gui/EmbeddedWebView.cpp b/src/Gui/EmbeddedWebView.cpp index 61d8b18..c99aaf9 100644 --- a/src/Gui/EmbeddedWebView.cpp +++ b/src/Gui/EmbeddedWebView.cpp @@ -123,8 +123,9 @@ void EmbeddedWebView::handlePageLoadFinished(bool ok) // We've already set in in our constructor, but apparently it isn't enough (Qt 4.8.0 on X11). // Let's do it again here, it works. - page()->mainFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff); - page()->mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff); + Qt::ScrollBarPolicy policy = isWindow() ? Qt::ScrollBarAsNeeded : Qt::ScrollBarAlwaysOff; + page()->mainFrame()->setScrollBarPolicy(Qt::Horizontal, policy); + page()->mainFrame()->setScrollBarPolicy(Qt::Vertical, policy); page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks); } @@ -181,7 +182,12 @@ void EmbeddedWebView::findScrollParent() void EmbeddedWebView::showEvent(QShowEvent *se) { QWebView::showEvent(se); - if (!m_scrollParent) // it would be much easier if the parents were just passed with the constructor ;-) + Qt::ScrollBarPolicy policy = isWindow() ? Qt::ScrollBarAsNeeded : Qt::ScrollBarAlwaysOff; + page()->mainFrame()->setScrollBarPolicy(Qt::Horizontal, policy); + page()->mainFrame()->setScrollBarPolicy(Qt::Vertical, policy); + if (isWindow()) { + resize(800,600); + } else if (!m_scrollParent) // it would be much easier if the parents were just passed with the constructor ;-) findScrollParent(); } diff --git a/src/Gui/Window.cpp b/src/Gui/Window.cpp index 2e4d08c..a3b3452 100644 --- a/src/Gui/Window.cpp +++ b/src/Gui/Window.cpp @@ -1268,19 +1268,13 @@ void MainWindow::slotViewMsgHeaders() Imap::Network::MsgPartNetAccessManager *netAccess = new Imap::Network::MsgPartNetAccessManager(this); netAccess->setModelMessage(messageIndex); - QScrollArea *area = new QScrollArea(); - area->setWidgetResizable(true); SimplePartWidget *headers = new SimplePartWidget(0, netAccess, messageIndex.model()->index( 0, Imap::Mailbox::TreeItem::OFFSET_HEADER, messageIndex) ); - area->setWidget(headers); - area->setAttribute(Qt::WA_DeleteOnClose); - connect(area, SIGNAL(destroyed()), headers, SLOT(deleteLater())); - connect(area, SIGNAL(destroyed()), netAccess, SLOT(deleteLater())); - area->resize(800, 600); - area->show(); - // FIXME: add an event filter for scrolling... + headers->setAttribute(Qt::WA_DeleteOnClose); + connect(headers, SIGNAL(destroyed()), netAccess, SLOT(deleteLater())); + headers->show(); } } -- 1.7.8.6
