From 0336e3e0e2eb02f9ad8925f1def081d6e46d750b Mon Sep 17 00:00:00 2001 From: Arno Date: Mon, 13 Dec 2010 18:10:47 +0100 Subject: Buxfixes for HoverWindow Resize widget to content when switching from pixmap to text content. To get the size let QTextDocument render the HTML and then get the size. Also set the initial opacity to the configured value in the constructor. --- hoverwindow.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'hoverwindow.cpp') diff --git a/hoverwindow.cpp b/hoverwindow.cpp index 9e09728..e9fcc64 100644 --- a/hoverwindow.cpp +++ b/hoverwindow.cpp @@ -10,13 +10,17 @@ #include #include #include +#include +#include #include "hoverwindow.h" #include "smglobals.h" HoverWindow::HoverWindow(QWidget *parent, Qt::WindowFlags f) : QWidget(parent, f), mAlignCenter(false), mDesktopHeight(-1){ setVisible(false); - setWindowOpacity(0.7); + QSettings s; + int opacity = s.value("ui/hoveropacity", 7).toInt(); + setWindowOpacity(opacity / 10.0); setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum); setStyleSheet("QLabel { background-color: #D6A583; color: black; border-width: 2px; border-style: solid; padding: 4px; }"); QDesktopWidget *desktop = qApp->desktop(); @@ -44,7 +48,11 @@ void HoverWindow::setContent(const QString &parent, const QStringList &children) curText.append("
  • ...
  • "); } curText.append(""); + QTextDocument doc; + doc.setHtml(curText); mLabel->setText(curText); + setMinimumSize(doc.size().width() + 10, doc.size().height() + 10); + setMaximumSize(doc.size().width() + 10, doc.size().height() + 10); } void HoverWindow::setPixmap(const QPixmap &pm, bool scale){ -- cgit v1.2.3-70-g09d2